2020-10-29 13:53:48 -07:00
|
|
|
name: tests
|
2020-02-17 10:23:47 -08:00
|
|
|
|
|
|
|
on: [push, pull_request]
|
|
|
|
|
2020-06-09 11:50:09 -07:00
|
|
|
env:
|
|
|
|
RUN: docker run --shm-size 1G --rm opendbc /bin/sh -c
|
|
|
|
BUILD: |
|
|
|
|
docker pull $(grep -ioP '(?<=^from)\s+\S+' Dockerfile) || true
|
|
|
|
docker pull docker.io/commaai/opendbc:latest || true
|
|
|
|
docker build --cache-from docker.io/commaai/opendbc:latest -t opendbc -f Dockerfile .
|
|
|
|
|
2020-02-17 10:23:47 -08:00
|
|
|
jobs:
|
|
|
|
test:
|
2020-10-29 13:53:48 -07:00
|
|
|
runs-on: ubuntu-20.04
|
2020-02-17 10:23:47 -08:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2020-06-09 11:50:09 -07:00
|
|
|
- name: Build Docker image
|
|
|
|
run: eval "$BUILD"
|
2020-05-28 18:53:42 -07:00
|
|
|
- name: Static analysis
|
|
|
|
run: |
|
|
|
|
docker run opendbc bash -c "cd opendbc && git init && git add -A && pre-commit run --all"
|
2020-06-09 11:50:09 -07:00
|
|
|
- name: Generator test
|
|
|
|
run: |
|
2020-12-03 13:07:09 -08:00
|
|
|
docker run opendbc bash -c "cd opendbc/generator && ./test_generator.py"
|
2020-10-29 13:53:48 -07:00
|
|
|
- name: Unit tests
|
|
|
|
run: |
|
|
|
|
docker run opendbc bash -c "python -m unittest discover opendbc"
|
2020-06-09 11:50:09 -07:00
|
|
|
- name: Push to dockerhub
|
|
|
|
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/opendbc'
|
|
|
|
run: |
|
2020-06-11 16:25:58 -07:00
|
|
|
docker login -u wmelching -p ${{ secrets.COMMA_DOCKERHUB_TOKEN}}
|
2020-06-09 11:50:09 -07:00
|
|
|
docker tag opendbc docker.io/commaai/opendbc:latest
|
|
|
|
docker push docker.io/commaai/opendbc:latest
|
|
|
|
|