CI: split up jobs + update requirements (#819)

This commit is contained in:
Adeeb Shihadeh 2023-04-15 23:18:45 -07:00 committed by GitHub
parent 003baff1ac
commit 7191f4472f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 50 additions and 34 deletions

View File

@ -3,7 +3,7 @@ name: tests
on: [push, pull_request]
env:
RUN: docker run -e PYTHONWARNINGS=error --shm-size 1G --rm opendbc /bin/sh -c
RUN: docker run -v $GITHUB_WORKSPACE:/project/opendbc -w /project/opendbc -e PYTHONWARNINGS=error --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
@ -11,25 +11,43 @@ env:
PYTHONWARNINGS: error
jobs:
test:
unit-tests:
name: unit tests
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
- 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

View File

@ -44,16 +44,14 @@ RUN pip install --no-cache-dir pre-commit==2.15.0 pylint==2.5.2
ENV PYTHONPATH=/project
RUN git config --global --add safe.directory '*'
WORKDIR /project
# TODO: Add tag to cereal
RUN git clone https://github.com/commaai/cereal.git /project/cereal && \
cd /project/cereal && \
git checkout 959ff79963b80829be9902d146c31fda44dbbd20
git checkout 959ff79963b80829be9902d146c31fda44dbbd20 && \
rm -rf .git && \
scons -j$(nproc)
COPY SConstruct .
COPY ./site_scons /project/site_scons
COPY . /project/opendbc
RUN rm -rf /project/opendbc/.git && \
rm -rf /project/cereal/.git
RUN scons -c && scons -j$(nproc)

View File

@ -1,8 +1,8 @@
Cython==0.29.14
flake8==3.7.9
Jinja2==3.0.3
numpy==1.21.0
pycapnp==1.0.0
pylint==2.15.4
pyyaml==5.4
Cython==0.29.34
flake8==6.0.0
Jinja2==3.1.2
numpy==1.24.2
pycapnp==1.3.0
pylint==2.17.2
pyyaml==6.0
scons