:Text -> :Data #3577
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: tests | |
on: [push, pull_request] | |
env: | |
DOCKER_REGISTRY: ghcr.io/commaai | |
RUN: docker run -e PYTHONWARNINGS=error --shm-size 1G --name cereal cereal /bin/sh -c | |
RUN_NAMED: docker run -e PYTHONWARNINGS=error --shm-size 1G --rm cereal /bin/sh -c | |
CI_RUN: docker run -e GITHUB_ACTION -e GITHUB_REF -e GITHUB_HEAD_REF -e GITHUB_SHA -e GITHUB_REPOSITORY -e GITHUB_RUN_ID --rm cerealci /bin/bash -c | |
BUILD: | | |
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile) || true | |
docker pull $DOCKER_REGISTRY/cereal:latest || true | |
docker build --cache-from $DOCKER_REGISTRY/cereal:latest -t cereal -f Dockerfile . | |
PYTHONWARNINGS: error | |
jobs: | |
build: | |
name: build | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build docker image | |
run: eval "$BUILD" | |
- name: Push to dockerhub | |
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/cereal' | |
run: | | |
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} | |
docker tag cereal $DOCKER_REGISTRY/cereal:latest | |
docker push $DOCKER_REGISTRY/cereal:latest | |
unit_tests: | |
name: unit tests | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
flags: ['', '--asan', '--ubsan'] | |
backend: ['MSGQ', 'ZMQ'] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build docker image | |
run: eval "$BUILD" | |
- name: C++ tests | |
run: | | |
$RUN "export ${{ matrix.backend }}=1 && \ | |
scons ${{ matrix.flags }} -j$(nproc) && \ | |
messaging/test_runner && \ | |
visionipc/test_runner" | |
- name: python tests | |
run: $RUN_NAMED "${{ matrix.backend }}=1 coverage run -m unittest discover ." | |
- name: Upload coverage | |
run: | | |
docker commit cereal cerealci | |
$CI_RUN "cd /project/cereal && bash <(curl -s https://codecov.io/bash) -v -F unit_tests_${{ matrix.backend }}" | |
static_analysis: | |
name: static analysis | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build docker image | |
run: eval "$BUILD" | |
- name: Static analysis | |
# TODO: a package pre-commit installs has a warning, remove the unset once that's fixed | |
run: $RUN "git init && git add -A && unset PYTHONWARNINGS && pre-commit run --all" |