From 76ba397c2be37f1bb7c57c400dc4368179febd1f Mon Sep 17 00:00:00 2001 From: Alexandre Abadie Date: Wed, 22 Jul 2020 15:51:09 +0200 Subject: [PATCH] .github/workflows: run tests on IoT-LAB --- .github/workflows/test-on-iotlab.yml | 126 +++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 .github/workflows/test-on-iotlab.yml diff --git a/.github/workflows/test-on-iotlab.yml b/.github/workflows/test-on-iotlab.yml new file mode 100644 index 0000000000..136b2b4476 --- /dev/null +++ b/.github/workflows/test-on-iotlab.yml @@ -0,0 +1,126 @@ +name: test-on-iotlab + +# Run 'compile_and_test_for_board.py' on IoT-LAB boards. +# +# This workflow will launch all tests on a list of IoT-LAB boards. +# +# This workflow is only run periodically on master with a cron and on new +# pushed release candidates tags. + +on: + # Schedule weekly runs on Monday at 00:00 on master + schedule: + - cron: '00 0 * * 1' + push: + # Run on all new releases and release candidates tags + tags: + - '[0-9][0-9][0-9][0-9].[0-9][0-9]-RC[0-9]*' + - '[0-9][0-9][0-9][0-9].[0-9][0-9]' + - '[0-9][0-9][0-9][0-9].[0-9][0-9].*' + # Allow manual trigger + workflow_dispatch: + inputs: + riot_version: + description: 'RIOT version to checkout' + required: true + default: 'master' + +jobs: + # Runs all tests on IoT-LAB boards + compile_and_test_for_board: + strategy: + max-parallel: 8 + fail-fast: false + matrix: + boards: + - riot: iotlab-m3 + iotlab: + archi: m3:at86rf231 + site: saclay + - riot: nrf51dk + iotlab: + archi: nrf51dk:ble + site: saclay + - riot: nrf52dk + iotlab: + archi: nrf52dk:ble + site: saclay + - riot: nrf52840dk + iotlab: + archi: nrf52840dk:multi + site: saclay + - riot: nrf52832-mdk + iotlab: + archi: nrf52832mdk:ble + site: saclay + - riot: samr21-xpro + iotlab: + archi: samr21:at86rf233 + site: saclay + - riot: b-l072z-lrwan1 + iotlab: + archi: st-lrwan1:sx1276 + site: saclay + - riot: b-l475e-iot01a + iotlab: + archi: st-iotnode:multi + site: saclay + runs-on: ubuntu-latest + name: ${{ matrix.boards.riot }} + env: + IOTLAB_NODE: auto-ssh + BUILD_IN_DOCKER: 1 + # Force .bin files generation because these files are used to flash on IoT-LAB and + # because compile_and_test_for_board forces RIOT_CI_BUILD which skip .bin + # files generation + DOCKER_ENVIRONMENT_CMDLINE: -e BUILD_FILES=\$$\(BINFILE\) + COMPILE_AND_TEST_FOR_BOARD: ./dist/tools/compile_and_test_for_board/compile_and_test_for_board.py + COMPILE_AND_TEST_ARGS: --with-test-only --jobs=2 + steps: + - name: Set up Python 3.8 + uses: actions/setup-python@v2 + with: + python-version: 3.8 + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install iotlabcli pexpect + - name: Configure credentials + run: echo '${{ secrets.IOTLABRC }}' > ~/.iotlabrc + - name: Setup SSH agent + uses: webfactory/ssh-agent@v0.4.0 + with: + ssh-private-key: ${{ secrets.IOTLAB_PRIVATE_KEY }} + - name: Fetch host key from IoT-LAB ${{ matrix.boards.iotlab.site }} site + run: | + IOTLAB_USER=$(cat ~/.iotlabrc | cut -f1 -d:) + ssh -oStrictHostKeyChecking=accept-new \ + ${IOTLAB_USER}@${{ matrix.boards.iotlab.site }}.iot-lab.info exit + - name: Pull riotbuild docker image + run: | + docker pull riot/riotbuild:latest + - name: Checkout RIOT + uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.riot_version }} + - name: Launch IoT-LAB experiment + run: | + IOTLAB_EXP_ID=$(iotlab-experiment --jmespath="id" submit \ + -n "riot-ci-${{ matrix.boards.riot }}" -d 360 \ + -l 1,site=${{ matrix.boards.iotlab.site }}+archi=${{ matrix.boards.iotlab.archi }}) + iotlab-experiment wait -i ${IOTLAB_EXP_ID} + echo "::set-env name=IOTLAB_EXP_ID::${IOTLAB_EXP_ID}" + - name: Run compile_and_test_for_board.py on ${{ matrix.boards.riot }} + run: | + ${COMPILE_AND_TEST_FOR_BOARD} . ${{ matrix.boards.riot }} \ + results-${{ matrix.boards.riot }} ${COMPILE_AND_TEST_ARGS} + - name: Stop IoT-LAB experiment + if: always() + run: iotlab-experiment stop -i ${IOTLAB_EXP_ID} + - name: Archive results + if: always() + # Store generated results- artifact + uses: actions/upload-artifact@v2 + with: + name: ${{ matrix.boards.riot }} + path: results-${{ matrix.boards.riot }}