Skip to content

Move minimal Rust from riotbuild to static-test-tools #467

Move minimal Rust from riotbuild to static-test-tools

Move minimal Rust from riotbuild to static-test-tools #467

Workflow file for this run

---
# This workflow will run on all pull-request branches and on 'master',
# 'staging', and 'trying'
#
# In all cases it will incrementally build: riotdocker-base, static-test-tools
# and riotbuild
#
# If riotbuild is successfully built then it will run a simple compile test on
# a subset of BOARDs using gcc and llvm
#
# On master if the building and testing succeeds it will push the generated image
# to ${DOCKER_REGISTRY}
#
# * Requirements:
# * Add the following secrets:
# * DOCKER_REGISTRY: the registry to pull and push images from/to
# * DOCKERHUB_USERNAME: the Docker Hub username account that can
# publish to ${DOCKER_REGISTRY}
# * DOCKERHUB_TOKEN: the Docker Hub access token for ${DOCKERHUB_USERNAME}
#
name: build
on:
push:
branches:
- trying
- staging
- master
pull_request:
branches:
- '*'
merge_group:
jobs:
build-test:
name: Build and Test
runs-on: ubuntu-latest
env:
RIOT_BRANCH: '2024.01-branch'
VERSION_TAG: '2024.01'
DOCKER_REGISTRY: "${{ secrets.DOCKER_REGISTRY || 'local' }}"
steps:
- name: Checkout
uses: actions/checkout@v2
with:
lfs: 'true'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker
- name: Build riotdocker-base
uses: docker/build-push-action@v2
with:
context: ./riotdocker-base
tags: |
${{ env.DOCKER_REGISTRY }}/riotdocker-base:latest
${{ env.DOCKER_REGISTRY }}/riotdocker-base:${{ env.VERSION_TAG }}
- name: Build static-test-tools
uses: docker/build-push-action@v2
with:
context: ./static-test-tools
tags: |
${{ env.DOCKER_REGISTRY }}/static-test-tools:latest
${{ env.DOCKER_REGISTRY }}/static-test-tools:${{ env.VERSION_TAG }}
build-args: |
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
- name: Set environment variables
run: |
echo "RIOTBUILD_BRANCH=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV
echo "RIOTBUILD_COMMIT=$(git rev-parse HEAD)" >> $GITHUB_ENV
echo "RIOTBUILD_VERSION=$(git describe --always)" >> $GITHUB_ENV
- name: Build riotbuild
uses: docker/build-push-action@v2
with:
context: ./riotbuild
tags: |
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
${{ env.DOCKER_REGISTRY }}/riotbuild:${{ env.VERSION_TAG }}
build-args: |
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
RIOTBUILD_BRANCH=${{ env.RIOTBUILD_BRANCH }}
RIOTBUILD_COMMIT=${{ env.RIOTBUILD_COMMIT }}
RIOTBUILD_VERSION=${{ env.RIOTBUILD_VERSION }}
- name: Checkout RIOT
uses: actions/checkout@v2
with:
repository: RIOT-OS/RIOT
ref: ${{ env.RIOT_BRANCH }}
path: RIOT
- name: GNU build test
run: |
make -CRIOT/examples/hello-world BUILDTEST_MAKE_REDIRECT='' buildtest
env:
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
BOARDS: "arduino-uno esp32-wroom-32 hifive1b msb-430h native samr21-xpro"
- name: GNU microbit qemu test
run: >
docker run --rm -t -v $(pwd)/RIOT:/data/riotbuild
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
make -Ctests/sys/fmt_print all test
env:
BOARD: "microbit"
EMULATE: 1
- name: tests/nanopb test
run: >
docker run --rm -t -v $(pwd)/RIOT:/data/riotbuild
${{ env.DOCKER_REGISTRY }}/riotbuild:latest
make -Ctests/pkg/nanopb all test
- name: LLVM build test
run: |
make -CRIOT/examples/hello-world BUILDTEST_MAKE_REDIRECT='' buildtest
env:
TOOLCHAIN: llvm
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
BOARDS: "native samr21-xpro"
- name: Rust build test
run: |
# Some of the above are executed by root, creating ~/.cargo/git as
# that user, blocking downloads of own libraries.
rm -rf ~/.cargo
make -CRIOT/examples/rust-hello-world BUILDTEST_MAKE_REDIRECT='' buildtest
# TODO: temporarily disabled (sock_udp.h not found)
#make -CRIOT/examples/rust-gcoap BUILDTEST_MAKE_REDIRECT='' buildtest
env:
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
# Not all of them are actually available; still using the "canonical"
# list of representative boards above to keep this stable whil Rust
# support expands
BOARDS: "arduino-uno esp32-wroom-32 hifive1b msb-430h native samr21-xpro"
- name: C++ build test
run: |
make -C RIOT/tests/sys/cpp11_condition_variable BUILDTEST_MAKE_REDIRECT='' buildtest
env:
BUILD_IN_DOCKER: 1
DOCKER_IMAGE: ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
BOARDS: "esp32-wroom-32 hifive1b native samr21-xpro"
- name: laze test
run: |
docker run --rm -t ${{ env.DOCKER_REGISTRY }}/riotbuild:latest \
laze --version
- name: Run static tests
run: |
docker run --rm -t -v $(pwd)/RIOT:/data/riotbuild \
-e CI_BASE_BRANCH=${{ env.RIOT_BRANCH }} ${{ env.DOCKER_REGISTRY }}/riotbuild:latest \
./dist/tools/ci/static_tests.sh
- name: Build murdock worker
uses: docker/build-push-action@v2
with:
context: ./murdock-worker
tags: |
${{ env.DOCKER_REGISTRY }}/murdock-worker:latest
${{ env.DOCKER_REGISTRY }}/murdock-worker:${{ env.VERSION_TAG }}
build-args: |
DOCKER_REGISTRY=${{ env.DOCKER_REGISTRY }}
- name: Login to DockerHub
if: "${{ github.ref == 'refs/heads/master' }}"
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Push Images
if: "${{ github.ref == 'refs/heads/master' }}"
run: |
docker image push ${{ env.DOCKER_REGISTRY }}/riotdocker-base:latest
docker image push ${{ env.DOCKER_REGISTRY }}/riotdocker-base:${{ env.VERSION_TAG }}
docker image push ${{ env.DOCKER_REGISTRY }}/static-test-tools:latest
docker image push ${{ env.DOCKER_REGISTRY }}/static-test-tools:${{ env.VERSION_TAG }}
docker image push ${{ env.DOCKER_REGISTRY }}/riotbuild:latest
docker image push ${{ env.DOCKER_REGISTRY }}/riotbuild:${{ env.VERSION_TAG }}
docker image push ${{ env.DOCKER_REGISTRY }}/murdock-worker:latest
docker image push ${{ env.DOCKER_REGISTRY }}/murdock-worker:${{ env.VERSION_TAG }}