Skip to content

Commit 46bcddd

Browse files
authored
RSDK-7558 Add extended motion tests (viamrobotics#4125)
1 parent fa17f9b commit 46bcddd

File tree

3 files changed

+72
-1
lines changed

3 files changed

+72
-1
lines changed

.github/workflows/motion-pull-request-trusted.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,4 @@ jobs:
2323
github.event_name == 'workflow_dispatch' ||
2424
(github.event_name == 'pull_request_target' && (github.event.label.name == 'safe to test' || github.event.label.name == 'appimage') && contains(github.event.pull_request.labels.*.name, 'safe to test'))
2525
uses: viamrobotics/rdk/.github/workflows/motion-benchmarks.yml@main
26+

.github/workflows/motion-tests.yml

+64
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
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"

.github/workflows/test.yml

+7-1
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,10 @@ jobs:
200200
- name: Run go unit tests on Pi
201201
run: make test-pi
202202

203+
motion_tests:
204+
name: Test Longer-running Motion Plans if affected
205+
uses: viamrobotics/rdk/.github/workflows/motion-tests.yml@main
206+
203207
test_web_e2e:
204208
name: Test End-to-End and Web
205209
runs-on: [buildjet-4vcpu-ubuntu-2204]
@@ -236,7 +240,7 @@ jobs:
236240

237241
test_passing:
238242
name: All Tests Passing
239-
needs: [test_go, test_web_e2e, test_pi, test32]
243+
needs: [test_go, test_web_e2e, test_pi, test32, motion_tests]
240244
runs-on: [ubuntu-latest]
241245
if: always()
242246
steps:
@@ -246,10 +250,12 @@ jobs:
246250
echo Go 32-bit Tests: ${{ needs.test32.result }}
247251
echo Go Pi Tests: ${{ needs.test_pi.result }}
248252
echo Web/E2E Tests: ${{ needs.test_web_e2e.result }}
253+
echo Motion Tests: ${{ needs.motion_tests.result }}
249254
[ "${{ needs.test_go.result }}" == "success" ] && \
250255
[ "${{ needs.test32.result }}" == "success" ] && \
251256
[ "${{ needs.test_pi.result }}" == "success" ] && \
252257
[ "${{ needs.test_web_e2e.result }}" == "success" ]
258+
[ "${{ needs.motion_tests.result }}" == "success" ]
253259
254260
# Now that RDK is public, can't directly comment without token having full read/write access
255261
# code-coverage-comment.yml will trigger seperately and post the actual comments

0 commit comments

Comments
 (0)