Caching dev container

This commit is contained in:
Teagan Glenn 2026-01-31 06:40:25 -07:00 committed by Teagan glenn
parent 1cc14bc94c
commit bbbc31c32c

View File

@ -10,6 +10,8 @@ on:
env:
DEFAULT_PYTHON: 3.11
REGISTRY: ghcr.io
DEV_IMAGE_NAME: ${{ github.repository }}-dev
jobs:
web_lint:
@ -70,6 +72,27 @@ jobs:
run: |
ruff check frigate migrations docker *.py
devcontainer:
runs_on: ubuntu-latest
name: Build devcontainer
steps:
- name: Check out code
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-build devcontainer image
uses: devcontainers/ci@v0.3
with:
imageName: ${{ env.REGISTRY }}/${{ env.DEV_IMAGE_NAME }}:latest
cacheFrom: ${{ env.REGISTRY }}/${{ env.DEV_IMAGE_NAME }}:latest
push: always
python_tests:
runs-on: ubuntu-latest
name: Python Tests
@ -78,18 +101,21 @@ jobs:
uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
node-version: 20.x
- name: Install devcontainer cli
run: npm install --global @devcontainers/cli
- name: Build devcontainer
env:
DOCKER_BUILDKIT: "1"
run: devcontainer build --workspace-folder .
- name: Start devcontainer
run: devcontainer up --workspace-folder .
- name: Run mypy in devcontainer
run: devcontainer exec --workspace-folder . bash -lc "python3 -u -m mypy --config-file frigate/mypy.ini frigate"
- name: Run unit tests in devcontainer
run: devcontainer exec --workspace-folder . bash -lc "python3 -u -m unittest"
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pre-Run mypy in devcontainer
uses: devcontainers/ci@v0.3
with:
cacheFrom: ${{ env.REGISTRY }}/${{ env.DEV_IMAGE_NAME }}:latest
push: never
runCmd: python3 -u -m mypy --config-file frigate/mypy.ini frigate
- name: Pre-Run mypy in devcontainer
uses: devcontainers/ci@v0.3
with:
cacheFrom: ${{ env.REGISTRY }}/${{ env.DEV_IMAGE_NAME }}:latest
push: never
runCmd: python3 -u -m unittest