Skip to content

Commit

Permalink
CI: Run own tests instead of RIOT tests
Browse files Browse the repository at this point in the history
The tests are now run using individual steps for the same reasons the
examples were switched over.

In [68], the tests were accidentally switched over to running all RIOT
instead of all own tests (which may also make sense but is really
excessive, and most importantly lost the own tests)

[68]: #68
  • Loading branch information
chrysn committed Dec 2, 2023
1 parent 9d6851e commit 0a6ed66
Showing 1 changed file with 37 additions and 42 deletions.
79 changes: 37 additions & 42 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@ on:
workflow_dispatch:

jobs:
quick-examples:
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:
Expand Down Expand Up @@ -56,12 +59,30 @@ jobs:
run: |
make all BOARD=${{ matrix.board }} -C RIOT/${{ matrix.example }}
most-tests:
enumerate-wrappers-tests:
runs-on: ubuntu-latest
outputs:
test-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: |
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.tests-list) }}
steps:
# common steps start here
- name: Check out riot-wrappers
Expand Down Expand Up @@ -95,51 +116,25 @@ jobs:
done
# common steps end here

- name: Build and run tests
- name: Build and run test
run: |
set -x
export RIOTBASE=$(pwd)/RIOT
# Removing tests/pkg/lvgl due to https://github.com/RIOT-OS/RIOT/issues/20110
#
# Skipping examples because ... not sure, did it that way before
# https://github.com/RIOT-OS/rust-riot-wrappers/pull/68, and examples
# are built extra
#
# Skipping peripheral and driver tests because we don't implement those
# with wrappers; the valuable ones are those like saul where there are
# modules that use Rust.
DIRS=$(make --quiet -C ${RIOTBASE} -f makefiles/app_dirs.inc.mk info-applications | grep -v tests/pkg/lvgl |grep -v examples |grep -v periph |grep -v driver)
for D in ${DIRS}; do
echo "::group::Building ${D}"
cd ${D}
if BOARDS=${{ matrix.board }} make info-boards-supported | grep -q .
then
# RIOTNOLINK is a workaround for boards with insufficient memory
# showing as supported but still being known not to be buildable.
# Other CI works around by having RIOT_CI_BUILD set RIOTNOLINK if
# the board is known to not have enough memory from
# BOARD_INSUFFICIENT_MEMORY, but that information is not piped out.
#
# Until a better workaround is found, no boards are linked, and if
# a board does exceed its memory due to a Rust change, that will
# only be spotted when the Rust crate is updated in RIOT and a full
# test with the precise criterion is run.
BOARD=${{ matrix.board }} make all RIOTNOLINK=1
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 "::group::Testing ${D}"
make all test BOARD=native
echo "::endgroup::"
fi
BOARD=${{ matrix.board }} make clean
else
echo "Board is not supported for this test, skipping."
if [ "native" = "${{ matrix.board }}" ] && make test/available BOARD=native
then
echo
echo "Testing ${D}"
echo
make all test BOARD=native
fi
cd -
echo "::endgroup::"
done
echo "::echo ::off"
else
echo "Board is not supported for this test, skipping."
fi
rustfmt:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 0a6ed66

Please sign in to comment.