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