|
| 1 | +name: Motion Extended Tests |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + workflow_call: |
| 6 | + |
| 7 | +jobs: |
| 8 | + check-files: |
| 9 | + name: Check files |
| 10 | + runs-on: ubuntu-latest |
| 11 | + outputs: |
| 12 | + EXTENDED_MOTION_TEST: ${{ steps.file_checker.outputs.EXTENDED_MOTION_TEST }} |
| 13 | + steps: |
| 14 | + - name: Checkout code |
| 15 | + uses: actions/checkout@v4 |
| 16 | + with: |
| 17 | + ref: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.head.sha || github.ref }} |
| 18 | + fetch-depth: 0 |
| 19 | + - name: check modified files |
| 20 | + id: file_checker |
| 21 | + run: | |
| 22 | + ( git diff --name-only origin/${{github.base_ref}} | grep -e "motionplan" \ |
| 23 | + -e "referenceframe" \ |
| 24 | + -e "spatialmath" \ |
| 25 | + -e "components/base/wheeled" \ |
| 26 | + -e "components/base/kinematicbase" \ |
| 27 | + -e "components/encoder/fake" \ |
| 28 | + -e "components/motor/fake" \ |
| 29 | + -e "services/motion/builtin" && echo "EXTENDED_MOTION_TEST=true" >> "$GITHUB_OUTPUT" ) || \ |
| 30 | + ( echo "EXTENDED_MOTION_TEST=false" >> "$GITHUB_OUTPUT" ) |
| 31 | +
|
| 32 | + motion-tests-extended: |
| 33 | + name: Motion Extended Tests |
| 34 | + needs: check-files |
| 35 | + runs-on: [buildjet-8vcpu-ubuntu-2204] |
| 36 | + container: ghcr.io/viamrobotics/rdk-devenv:amd64-cache |
| 37 | + if: ${{ needs.check-files.outputs.EXTENDED_MOTION_TEST == 'true' }} |
| 38 | + timeout-minutes: 30 |
| 39 | + steps: |
| 40 | + |
| 41 | + - name: Check out PR branch code |
| 42 | + if: github.event_name == 'pull_request_target' |
| 43 | + uses: actions/checkout@v3 |
| 44 | + with: |
| 45 | + ref: ${{ github.event.pull_request.head.sha }} |
| 46 | + |
| 47 | + - name: Check out code in motion-testing repository |
| 48 | + uses: actions/checkout@v3 |
| 49 | + with: |
| 50 | + repository: viamrobotics/motion-testing |
| 51 | + path: motion-testing |
| 52 | + |
| 53 | + - name: Change ownership to testbot |
| 54 | + run: chown -R testbot:testbot . |
| 55 | + |
| 56 | + - name: Run motion tests on PR branch |
| 57 | + shell: bash |
| 58 | + env: |
| 59 | + URL: ${{ github.event.pull_request.head.repo.html_url }} |
| 60 | + SHA: ${{ github.event.pull_request.head.sha }} |
| 61 | + run: | |
| 62 | + cd motion-testing |
| 63 | + go mod edit -replace go.viam.com/rdk=${URL#"https://"}@$SHA |
| 64 | + sudo -Hu testbot bash -lc "go mod tidy && go test ./... -v -run TestMotionExtended" |
0 commit comments