Skip to content

Commit

Permalink
CI: Run everything in parallel
Browse files Browse the repository at this point in the history
The largest amount of time is the machine checkout -- 2 minutes. The 7
seconds of `cargo update` are dwarved by that, and running in parallel
means we don't have to eat those 2 minutes twice.

(Also, I couldn't figure out how to carry the output state of the
`needs`'d preparations over to the actual working steps).
  • Loading branch information
chrysn committed Nov 24, 2023
1 parent 725d049 commit 224f485
Showing 1 changed file with 39 additions and 12 deletions.
51 changes: 39 additions & 12 deletions .github/workflows/buildtest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ on:
workflow_dispatch:

jobs:
prepare:
build-examples:
runs-on: ubuntu-latest
container: riot/riotbuild
strategy:
matrix:
example: [examples/rust-hello-world, examples/rust-gcoap, tests/rust_minimal]
board: [native, sltb001a, samr32-xpro, stk3700]
steps:
# common steps start here
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
Expand All @@ -29,7 +34,7 @@ jobs:
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, the
# and all relevant crates once, and after that, just make some notes in Cargo.lock
run: |
# It appears that there has to be output before :: commands really catch on
echo "Pulling updates"
Expand All @@ -42,28 +47,50 @@ jobs:
cargo tree --manifest-path $MANIF
echo "::endgroup::"
done
# common steps end here

build-examples:
needs: prepare
runs-on: ubuntu-latest
container: riot/riotbuild
strategy:
matrix:
example: [examples/rust-hello-world, examples/rust-gcoap, tests/rust_minimal]
board: [native, sltb001a, samr32-xpro, stk3700]
steps:
- name: Build on selected platforms
run: |
make buildtest BUILDTEST_MAKE_REDIRECT='' BOARD=${{ matrix.board }} -C RIOT/${{ matrix.example }}
build-tests:
needs: prepare
runs-on: ubuntu-latest
container: riot/riotbuild
strategy:
matrix:
board: [native, sltb001a, samr21-xpro, stk3700]
steps:
# common steps start here
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: RIOT-OS/RIOT
path: RIOT
- name: Patch .cargo/config.toml to use current checkout
run: |
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: |
# It appears that there has to be output before :: commands really catch on
echo "Pulling updates"
echo "::echo ::on"
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 tests
run: |
DIRS=$(echo RIOT/tests/*/)
Expand Down

0 comments on commit 224f485

Please sign in to comment.