Initial commit #4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
# yamllint disable-line rule:truthy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
pre-commit: | |
name: pre-commit | |
runs-on: ubuntu-latest | |
env: | |
PRE_COMMIT_HOME: /tmp/pre-commit-cache | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🏗 Set up uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: 🏗 Set pre-commit cache | |
uses: actions/cache@v3 | |
with: | |
path: ${{ env.PRE_COMMIT_HOME }} | |
key: ${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml','.python-version') }} | |
- name: 🚀 Run pre-commit | |
env: | |
# Skipping branch check and pytest as pytest is run in a separate job | |
SKIP: no-commit-to-branch,pytest | |
run: uv run --frozen pre-commit run -a | |
pytest: | |
name: pytest | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.12"] | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
- name: 🏗 Set up uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: 🏗 Set up Python ${{ matrix.python }} | |
run: uv python install ${{ matrix.python }} | |
- name: 🏗 Install dependencies | |
run: uv sync --frozen --dev | |
- name: 🚀 Run pytest | |
run: uv run pytest --cov go2rtc_client tests | |
- name: ⬆️ Upload coverage artifact | |
uses: actions/[email protected] | |
with: | |
include-hidden-files: true | |
name: coverage-${{ matrix.python }} | |
coverage: | |
runs-on: ubuntu-latest | |
needs: pytest | |
steps: | |
- name: ⤵️ Check out code from GitHub | |
uses: actions/[email protected] | |
with: | |
fetch-depth: 0 | |
- name: ⬇️ Download coverage data | |
uses: actions/[email protected] | |
- name: 🏗 Set up uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
enable-cache: true | |
- name: 🚀 Process coverage results | |
run: | | |
poetry run --forzen coverage combine coverage*/.coverage* | |
poetry run --frozen coverage xml -i | |
- name: 🚀 Upload coverage report | |
uses: codecov/[email protected] | |
with: | |
fail_ci_if_error: true |