Skip to content

Commit

Permalink
Enable docker cache (#39)
Browse files Browse the repository at this point in the history
* enable docker cache

* env lowercase

* fix space

* action/checkout version4

* change name repo
  • Loading branch information
bongbui321 authored Feb 27, 2024
1 parent c5762e8 commit 1dc61a6
Showing 1 changed file with 23 additions and 5 deletions.
28 changes: 23 additions & 5 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,33 @@ name: tests

on: [push, pull_request]

env:
REGISTRY: ghcr.io/commaai
BUILD: docker buildx build --pull --load --cache-to type=inline --cache-from $REGISTRY/rednose:latest -t rednose -f Dockerfile .
RUN: docker run rednose bash -c

jobs:
test:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Build docker image
run: docker build -t rednose .
run: eval ${{ env.BUILD }}
- name: Static analysis
run: |
docker run rednose bash -c "git init && git add -A && pre-commit run --all"
run: ${{ env.RUN }} "git init && git add -A && pre-commit run --all"
- name: Unit Tests
run: docker run rednose bash -c "cd /project/examples; python -m unittest discover"
run: ${{ env.RUN }} "cd /project/examples; python -m unittest discover"

docker_push:
name: docker push
runs-on: ubuntu-20.04
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request' && github.repository == 'commaai/rednose'
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: eval ${{ env.BUILD }}
- name: Push to dockerhub
run: |
docker login ghcr.io -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }}
docker tag rednose ${{ env.REGISTRY }}/rednose:latest
docker push ${{ env.REGISTRY }}/rednose:latest

0 comments on commit 1dc61a6

Please sign in to comment.