name: tests on: [push, pull_request] env: RUN: docker run -v $GITHUB_WORKSPACE:/project/opendbc -w /project/opendbc -e PYTHONWARNINGS="error,default::DeprecationWarning" --shm-size 1G --rm opendbc /bin/bash -c BUILD: | docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile) || true docker pull ghcr.io/commaai/opendbc:latest || true docker build --cache-from ghcr.io/commaai/opendbc:latest -t opendbc -f Dockerfile . PYTHONWARNINGS: error jobs: unit-tests: name: unit tests runs-on: ubuntu-20.04 #strategy: # fail-fast: false # matrix: # run: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] steps: - uses: actions/checkout@v3 - name: Build Docker image run: eval "$BUILD" - name: Build opendbc run: ${{ env.RUN }} "cd ../ && scons -j$(nproc)" - name: Unit tests run: ${{ env.RUN }} "python -m unittest discover ." static-analysis: name: static analysis runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v3 - name: Build Docker image run: eval "$BUILD" - name: Build opendbc run: ${{ env.RUN }} "cd ../ && scons -j$(nproc)" - name: pre-commit # TODO: a package pre-commit installs has a warning, remove the unset once that's fixed run: ${{ env.RUN }} "unset PYTHONWARNINGS && pre-commit run --all" - name: Generator test run: ${{ env.RUN }} "generator/test_generator.py" docker-push: name: docker push runs-on: ubuntu-20.04 if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/opendbc' steps: - uses: actions/checkout@v3 - name: Build Docker image run: eval "$BUILD" - name: Push to dockerhub run: | docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} docker tag opendbc ghcr.io/commaai/opendbc:latest docker push ghcr.io/commaai/opendbc:latest