Use devcontainer build to run tests (#20212)

* Use devcontainer build to run tests

* Make ignored github changes more restrictive
This commit is contained in:
Nicolas Mowen
2025-09-25 08:59:18 -06:00
committed by GitHub
parent 2c4a043dbb
commit 9a22404015

View File

@@ -4,38 +4,14 @@ on:
pull_request: pull_request:
paths-ignore: paths-ignore:
- "docs/**" - "docs/**"
- ".github/**" - ".github/*.yml"
- ".github/DISCUSSION_TEMPLATE/**"
- ".github/ISSUE_TEMPLATE/**"
env: env:
DEFAULT_PYTHON: 3.11 DEFAULT_PYTHON: 3.11
jobs: jobs:
build_devcontainer:
runs-on: ubuntu-latest
name: Build Devcontainer
# The Dockerfile contains features that requires buildkit, and since the
# devcontainer cli uses docker-compose to build the image, the only way to
# ensure docker-compose uses buildkit is to explicitly enable it.
env:
DOCKER_BUILDKIT: "1"
steps:
- uses: actions/checkout@v5
with:
persist-credentials: false
- uses: actions/setup-node@master
with:
node-version: 20.x
- name: Install devcontainer cli
run: npm install --global @devcontainers/cli
- name: Build devcontainer
run: devcontainer build --workspace-folder .
# It would be nice to also test the following commands, but for some
# reason they don't work even though in VS Code devcontainer works.
# - name: Start devcontainer
# run: devcontainer up --workspace-folder .
# - name: Run devcontainer scripts
# run: devcontainer run-user-commands --workspace-folder .
web_lint: web_lint:
name: Web - Lint name: Web - Lint
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -102,13 +78,18 @@ jobs:
uses: actions/checkout@v5 uses: actions/checkout@v5
with: with:
persist-credentials: false persist-credentials: false
- name: Set up QEMU - uses: actions/setup-node@master
uses: docker/setup-qemu-action@v3 with:
- name: Set up Docker Buildx node-version: 20.x
uses: docker/setup-buildx-action@v3 - name: Install devcontainer cli
- name: Build run: npm install --global @devcontainers/cli
run: make debug - name: Build devcontainer
- name: Run mypy env:
run: docker run --rm --entrypoint=python3 frigate:latest -u -m mypy --config-file frigate/mypy.ini frigate DOCKER_BUILDKIT: "1"
- name: Run tests run: devcontainer build --workspace-folder .
run: docker run --rm --entrypoint=python3 frigate:latest -u -m unittest - 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"