Skip to content

Add: Tests on local runners with shared USB resources #231

Add: Tests on local runners with shared USB resources

Add: Tests on local runners with shared USB resources #231

Workflow file for this run

name: Test all targets
on: [push, pull_request]
env:
CI_PING_IP: 192.168.1.185
jobs:
quick-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
- name: Check Type
run: cargo fmt -- --check
- name: Run internal tests
run: cargo test --verbose -- --nocapture
- name: Build
run: cargo build
build:
needs: quick-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
- name: Build docs
run: cargo doc
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/master' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./target/doc
tests:
runs-on: raspbian-armv7-kernel-5.10.33
steps:
- name: Run CI management script
run: /etc/github_runner/ci_management.sh
- name: Determine CI number
run: |
ls -la
- name: Post CI management script
if: always()
run: |
source /etc/github_runner/ci_management.sh
clear_busy_state
deploy:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout to repository
uses: actions/checkout@v2
with:
submodules: recursive
- name: Setup Rust toolchain
uses: actions-rs/[email protected]
with:
toolchain: stable
override: true
- name: Install cargo-bump
run: cargo install cargo-bump --force
- name: Modify version with tag
run: cargo bump ${{ github.ref_name }}
- name: Automatic commit for crate version upgrade
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: master
commit_message: "Cargo: Update the crate version to ${{ github.ref_name }}"
- name: Publish to crates.io
uses: katyo/publish-crates@v1
with:
args: --allow-dirty
registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }}
ci-cleanup:
needs: [quick-tests, build, deploy, tests]
runs-on: raspbian-armv7-kernel-5.10.33
if: always()
steps:
- name: Clear busy state2
run: |
curl -X POST "http://${{ env.CI_PING_IP }}/button/end_ci_run__clear_busy_/press"
sleep 2
BUSY_STATE=$(curl -s "http://${{ env.CI_PING_IP }}/switch/ci_busy_flag" | jq -r '.state')
if [ "$BUSY_STATE" != "OFF" ]; then
echo "Failed to clear busy state"
exit 1
fi