frigate/.github/workflows/pull_request.yml
2026-02-16 01:36:06 -07:00

123 lines
3.4 KiB
YAML

name: On pull request
on:
pull_request:
paths-ignore:
- "docs/**"
- ".github/*.yml"
- ".github/DISCUSSION_TEMPLATE/**"
- ".github/ISSUE_TEMPLATE/**"
env:
DEFAULT_PYTHON: 3.11
REGISTRY: ghcr.io
DEV_IMAGE_NAME: ${{ github.repository }}-dev
jobs:
web_lint:
name: Web - Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 20.x
- run: npm install
working-directory: ./web
- name: Lint
run: npm run lint
working-directory: ./web
web_test:
name: Web - Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
persist-credentials: false
- uses: actions/setup-node@v6
with:
node-version: 20.x
- run: npm install
working-directory: ./web
- name: Build web
run: npm run build
working-directory: ./web
# - name: Test
# run: npm run test
# working-directory: ./web
python_checks:
runs-on: ubuntu-latest
name: Python Checks
steps:
- name: Check out the repository
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Set up Python ${{ env.DEFAULT_PYTHON }}
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ env.DEFAULT_PYTHON }}
- name: Install requirements
run: |
python3 -m pip install -U pip
python3 -m pip install -r docker/main/requirements-dev.txt
- name: Check formatting
run: |
ruff format --check --diff frigate migrations docker *.py
- name: Check lint
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
needs: devcontainer
name: Python Tests
steps:
- name: Check out code
uses: actions/checkout@v6
with:
persist-credentials: false
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
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