Enable async operation #41
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ideally this should be replaced with a call out to Murdock; until that is | |
# practical, building representative examples. | |
name: test | |
on: | |
pull_request: | |
push: | |
branches: [main] | |
workflow_dispatch: | |
jobs: | |
examples-and-tests: | |
runs-on: ubuntu-latest | |
container: riot/riotbuild | |
# Best would be "continue until there are errors from different examples *and* different boards" | |
continue-on-error: true | |
strategy: | |
matrix: | |
# This is the subset of `make -f makefiles/app_dirs.inc.mk | |
# info-applications` that is probably relevant; more is covered when | |
# riot-wrappers are updated in RIOT. | |
example: [examples/rust-hello-world, examples/rust-gcoap, tests/rust_minimal] | |
board: [native, sltb001a, samr21-xpro, stk3700] | |
steps: | |
# common steps start here | |
- name: Check out riot-wrappers | |
uses: actions/checkout@v3 | |
- name: Check out RIOT | |
uses: actions/checkout@v3 | |
with: | |
repository: RIOT-OS/RIOT | |
path: RIOT | |
- name: Patch .cargo/config.toml to use current checkout | |
run: | | |
set -x | |
cd RIOT | |
rm -f .cargo/config.toml | |
mkdir -p .cargo # Keep working if RIOT ever decides it doesn't need overrides any more | |
echo '[patch.crates-io]' >> .cargo/config.toml | |
echo 'riot-wrappers = { path = "../", version = "*" }' >> .cargo/config.toml | |
echo 'riot-sys = { git = "https://github.com/RIOT-OS/rust-riot-sys" }' >> .cargo/config.toml | |
- name: Pull cargo updates | |
# No sense in running this in parallel -- this will download the index | |
# and all relevant crates once, and after that, just make some notes in Cargo.lock | |
run: | | |
set -x | |
for MANIF in $(find RIOT -name Cargo.toml) | |
do | |
echo "::group::Updating ${MANIF}" | |
cargo update -p riot-sys -p riot-wrappers --aggressive --manifest-path $MANIF | |
cargo fetch --manifest-path $MANIF | |
cargo tree --manifest-path $MANIF | |
echo "::endgroup::" | |
done | |
# common steps end here | |
- name: Build the example | |
run: | | |
make all BOARD=${{ matrix.board }} -C RIOT/${{ matrix.example }} | |
enumerate-wrappers-tests: | |
runs-on: ubuntu-latest | |
outputs: | |
list: ${{ steps.enumerate.outputs.tests }} | |
steps: | |
- name: Check out riot-wrappers | |
uses: actions/checkout@v3 | |
- name: List tests in riot-wrappers | |
id: enumerate | |
run: | | |
echo "tests=[$(ls -d tests/*/ -1 | sed 's/.*/\"&\"/' | tr '\n' ',' | sed 's/,$//')]" >> "${GITHUB_OUTPUT}" | |
cat "${GITHUB_OUTPUT}" | |
- name: Set job summary | |
run: | | |
# This doubles as a check to see that our JSON is right | |
echo 'Local tests were enumerated to be `${{ toJSON(fromJSON( steps.enumerate.outputs.tests )) }}`' >> $GITHUB_STEP_SUMMARY | |
wrappers-tests: | |
runs-on: ubuntu-latest | |
needs: enumerate-wrappers-tests | |
container: riot/riotbuild | |
strategy: | |
matrix: | |
board: [native, sltb001a, samr21-xpro, stk3700] | |
testdir: ${{ fromJSON(needs.enumerate-wrappers-tests.outputs.list) }} | |
steps: | |
# common steps start here | |
- name: Check out riot-wrappers | |
uses: actions/checkout@v3 | |
- name: Check out RIOT | |
uses: actions/checkout@v3 | |
with: | |
repository: RIOT-OS/RIOT | |
path: RIOT | |
- name: Patch .cargo/config.toml to use current checkout | |
run: | | |
set -x | |
cd RIOT | |
rm -f .cargo/config.toml | |
mkdir -p .cargo # Keep working if RIOT ever decides it doesn't need overrides any more | |
echo '[patch.crates-io]' >> .cargo/config.toml | |
echo 'riot-wrappers = { path = "../", version = "*" }' >> .cargo/config.toml | |
echo 'riot-sys = { git = "https://github.com/RIOT-OS/rust-riot-sys" }' >> .cargo/config.toml | |
- name: Pull cargo updates | |
# No sense in running this in parallel -- this will download the index | |
# and all relevant crates once, and after that, just make some notes in Cargo.lock | |
run: | | |
set -x | |
for MANIF in $(find RIOT -name Cargo.toml) | |
do | |
echo "::group::Updating ${MANIF}" | |
cargo update -p riot-sys -p riot-wrappers --aggressive --manifest-path $MANIF | |
cargo fetch --manifest-path $MANIF | |
cargo tree --manifest-path $MANIF | |
echo "::endgroup::" | |
done | |
# common steps end here | |
- name: Build and run test | |
run: | | |
set -x | |
export RIOTBASE=$(pwd)/RIOT | |
cd ${{ matrix.testdir }} | |
if BOARDS=${{ matrix.board }} make info-boards-supported | grep -q . | |
then | |
BOARD=${{ matrix.board }} make all | |
if [ "native" = "${{ matrix.board }}" ] && make test/available BOARD=native | |
then | |
echo | |
echo "Testing ${D}" | |
echo | |
make all test BOARD=native | |
fi | |
else | |
echo "Board is not supported for this test, skipping." | |
fi | |
rustfmt: | |
runs-on: ubuntu-latest | |
container: rustlang/rust:nightly | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Run cargo-fmt | |
run: cargo fmt --check | |
all-done: | |
needs: [rustfmt, wrappers-tests, examples-and-tests] | |
# It'd suffice to just do "needs", but GitHub actions insist to have steps | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "All done" | |