From af33c06763ca4f4bcd700a707dfd44d1b474824d Mon Sep 17 00:00:00 2001 From: Martine Lenders Date: Sun, 12 Jul 2020 01:15:14 +0200 Subject: [PATCH] gh-actions: add workflow for release tests --- .github/workflows/release-test.yml | 190 +++++++++++++++++++++++++++++ 1 file changed, 190 insertions(+) create mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..985f45c6 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,190 @@ +name: Release tests + +on: + schedule: + - cron: '0 3 * * 6' + workflow_dispatch: + inputs: + riot_version: + description: 'RIOT version to checkout' + required: true + default: 'master' + docker_version: + description: 'riot/riotbuild docker image version' + required: true + default: 'latest' + +# split up native and IoT-LAB tasks to parallelize somewhat and prevent +# to hit Github Limit of 6h per job +jobs: + native-tasks: + runs-on: ubuntu-latest + timeout-minutes: 360 + strategy: + matrix: + python-version: [3.8] + + steps: + - name: Generate .riotgithubtoken + run: | + echo '${{ secrets.ACCESS_TOKEN }}' > ~/.riotgithubtoken + - name: Checkout Release-Specs + uses: actions/checkout@v2 + with: + path: Release-Specs + - name: Checkout RIOT + uses: actions/checkout@v2 + with: + repository: RIOT-OS/RIOT + path: RIOT + fetch-depth: 1 + ref: ${{ github.event.inputs.riot_version }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions junit2html + - name: Pull riotbuild docker image + run: | + DOCKER_VERSION="${{ github.event.inputs.docker_version }}" + if [ -z "$DOCKER_VERSION" ]; then + DOCKER_VERSION="latest" + fi + docker pull riot/riotbuild:$DOCKER_VERSION + - name: Create TAP interfaces + run: | + sudo RIOT/dist/tools/tapsetup/tapsetup -c 11 + - name: Run release tests + timeout-minutes: 350 + run: | + RIOTBASE="$GITHUB_WORKSPACE/RIOT" + TOX_ARGS="" + if ! echo ${{ github.event.inputs.riot_version }} | \ + grep -q "[0-9]\{4\}.[0-9]\{2\}-RC[0-9]\+"; then + TOX_ARGS+="--non-RC " + fi + CORES=$(cat /proc/cpuinfo | grep 'processor\s*:\s*[0-9]\+' | wc -l) + DOCKER_MAKE_ARGS="-j${CORES}" + + cd Release-Specs + # definition in env does not work since $GITHUB_WORKSPACE seems not to + # be accessible + sudo \ + BUILD_IN_DOCKER=1 \ + DOCKER_MAKE_ARGS=${DOCKER_MAKE_ARGS} \ + DOCKER_ENV_VARS=USEMODULE \ + GITHUB_REPOSITORY=${GITHUB_REPOSITORY} \ + GITHUB_RUN_ID=${GITHUB_RUN_ID} \ + GITHUB_SERVER_URL=${GITHUB_SERVER_URL} \ + RIOTBASE=${RIOTBASE} \ + $(which tox) -- ${TOX_ARGS} -m "not iotlab_creds" + - name: junit2html and XML deploy + if: ${{ always() }} + run: | + DATE=$(date +"%Y-%m-%d-%H-%M-%S") + if echo ${{ github.event.inputs.riot_version }} | \ + grep -q "[0-9]\{4\}.[0-9]\{2\}"; then + VER=${{ github.event.inputs.riot_version }} + else + VER=$(git -C $GITHUB_WORKSPACE/RIOT rev-parse --short HEAD) + fi + mkdir test-reports/ + junit2html $GITHUB_WORKSPACE/Release-Specs/test-report.xml \ + test-reports/test-report-native-$VER-$DATE.html + cp $GITHUB_WORKSPACE/Release-Specs/test-report.xml \ + test-reports/test-report-native-$VER-$DATE.xml + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: Upload test report + path: test-reports/* + iotlab-tasks: + runs-on: ubuntu-latest + timeout-minutes: 360 + strategy: + matrix: + python-version: [3.8] + + steps: + - name: Setup IoT-LAB credentials + run: | + echo '${{ secrets.IOTLABRC }}' > ~/.iotlabrc + - name: Generate .riotgithubtoken + run: | + echo '${{ secrets.ACCESS_TOKEN }}' > ~/.riotgithubtoken + - 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 saclay site + run: | + IOTLAB_USER=$(cat ~/.iotlabrc | cut -f1 -d:) + ssh -oStrictHostKeyChecking=accept-new \ + ${IOTLAB_USER}@saclay.iot-lab.info exit + - name: Checkout Release-Specs + uses: actions/checkout@v2 + with: + path: Release-Specs + - name: Checkout RIOT + uses: actions/checkout@v2 + with: + repository: RIOT-OS/RIOT + path: RIOT + fetch-depth: 1 + ref: ${{ github.event.inputs.riot_version }} + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + - name: Install Python dependencies + run: | + python -m pip install --upgrade pip + pip install tox tox-gh-actions junit2html + - name: Pull riotbuild docker image + run: | + DOCKER_VERSION="${{ github.event.inputs.docker_version }}" + if [ -z "$DOCKER_VERSION" ]; then + DOCKER_VERSION="latest" + fi + docker pull riot/riotbuild:$DOCKER_VERSION + - name: Run release tests + timeout-minutes: 350 + run: | + # definition in env does not work since $GITHUB_WORKSPACE seems not to + # be accessible + export RIOTBASE="$GITHUB_WORKSPACE/RIOT" + TOX_ARGS="" + if ! echo ${{ github.event.inputs.riot_version }} | \ + grep -q "[0-9]\{4\}.[0-9]\{2\}-RC[0-9]\+"; then + TOX_ARGS+="--non-RC " + fi + CORES=$(cat /proc/cpuinfo | grep 'processor\s*:\s*[0-9]\+' | wc -l) + export DOCKER_MAKE_ARGS="-j${CORES}" + + cd Release-Specs + BUILD_IN_DOCKER=1 \ + DOCKER_ENV_VARS=USEMODULE \ + $(which tox) -- ${TOX_ARGS} -m "iotlab_creds" + - name: junit2html and XML deploy + if: ${{ always() }} + run: | + DATE=$(date +"%Y-%m-%d-%H-%M-%S") + if echo ${{ github.event.inputs.riot_version }} | \ + grep -q "[0-9]\{4\}.[0-9]\{2\}"; then + VER=${{ github.event.inputs.riot_version }} + else + VER=$(git -C $GITHUB_WORKSPACE/RIOT rev-parse --short HEAD) + fi + mkdir test-reports/ + junit2html $GITHUB_WORKSPACE/Release-Specs/test-report.xml \ + test-reports/test-report-iotlab-$VER-$DATE.html + cp $GITHUB_WORKSPACE/Release-Specs/test-report.xml \ + test-reports/test-report-iotlab-$VER-$DATE.xml + - uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: Upload test report + path: test-reports/*