Skip to content

Commit

Permalink
test: run example directly
Browse files Browse the repository at this point in the history
  • Loading branch information
RaulTrombin committed Oct 10, 2024
1 parent 602bc19 commit 21d14b1
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions .github/workflows/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,54 @@ jobs:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc

compile-example:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/[email protected]
with:
toolchain: stable
target: armv7-unknown-linux-gnueabihf
override: true
- name: Install cross-compilation tools
run: |
sudo apt-get update
sudo apt-get install -y gcc-arm-linux-gnueabihf
- name: Compile ping_1d example for ARM v7
run: |
cargo build --example ping_1d --target armv7-unknown-linux-gnueabihf --release
- name: Upload compiled example
uses: actions/upload-artifact@v2
with:
name: ping_1d-armv7
path: target/armv7-unknown-linux-gnueabihf/release/examples/ping_1d

tests:
needs: compile-example
runs-on: raspbian-armv7-kernel-5.10.33
if: ${{ github.repository_owner == 'bluerobotics' }}
steps:
- name: Run CI management script
run: /etc/github_runner/ci_management.sh
- name: Determine CI number
- name: Download compiled ping_1d example
uses: actions/download-artifact@v2
with:
name: ping_1d-armv7
path: ./ping_1d-armv7
- name: Make ping_1d executable
run: chmod +x ./ping_1d-armv7/ping_1d
- name: Run ping_1d test
run: |
ls /dev/*
timeout 30s ./ping_1d-armv7/ping_1d --serial-port /dev/ttyUSB_Ping1D || exit_code=$?
if [ $exit_code -eq 124 ]; then
echo "Test timed out after 30 seconds"
exit 1
elif [ $exit_code -ne 0 ]; then
echo "Test failed with exit code $exit_code"
exit $exit_code
else
echo "Test completed successfully"
fi
- name: Post CI management script
if: always()
run: |
Expand Down

0 comments on commit 21d14b1

Please sign in to comment.