Squashed commit of the following: #25
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: | |
RUN: docker run --shm-size 1G --rm opendbc /bin/sh -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 . | |
jobs: | |
test: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build Docker image | |
run: eval "$BUILD" | |
- name: Static analysis | |
run: | | |
docker run opendbc bash -c "cd opendbc && git init && git add -A && pre-commit run --all" | |
- name: Generator test | |
run: | | |
docker run opendbc bash -c "cd opendbc/generator && ./test_generator.py" | |
- name: Unit tests | |
run: | | |
docker run opendbc bash -c "python -m unittest discover opendbc" | |
- name: Push to dockerhub | |
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/opendbc' | |
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 | |