mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-07-02 02:04:19 +00:00
3d1e6d171b
Bumps the actions group with 14 updates: | Package | From | To | | --- | --- | --- | | [actions/checkout](https://github.com/actions/checkout) | `6.0.2` | `7.0.0` | | [actions/setup-python](https://github.com/actions/setup-python) | `6.2.0` | `6.3.0` | | [astral-sh/setup-uv](https://github.com/astral-sh/setup-uv) | `8.1.0` | `8.2.0` | | [codecov/codecov-action](https://github.com/codecov/codecov-action) | `6.0.1` | `7.0.0` | | [actions/cache](https://github.com/actions/cache) | `5.0.5` | `6.1.0` | | [pnpm/action-setup](https://github.com/pnpm/action-setup) | `6.0.8` | `6.0.9` | | [lewagon/wait-on-check-action](https://github.com/lewagon/wait-on-check-action) | `1.7.0` | `1.8.0` | | [release-drafter/release-drafter](https://github.com/release-drafter/release-drafter) | `7.3.1` | `7.4.0` | | [shogo82148/actions-upload-release-asset](https://github.com/shogo82148/actions-upload-release-asset) | `1.10.1` | `1.10.2` | | [zizmorcore/zizmor-action](https://github.com/zizmorcore/zizmor-action) | `0.5.6` | `0.5.7` | | [github/codeql-action/upload-sarif](https://github.com/github/codeql-action) | `4.36.0` | `4.36.2` | | [github/codeql-action/init](https://github.com/github/codeql-action) | `4.36.0` | `4.36.2` | | [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.36.0` | `4.36.2` | | [crowdin/github-action](https://github.com/crowdin/github-action) | `2.16.2` | `2.16.3` | Updates `actions/checkout` from 6.0.2 to 7.0.0 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/de0fac2e4500dabe0009e67214ff5f5447ce83dd...9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0) Updates `actions/setup-python` from 6.2.0 to 6.3.0 - [Release notes](https://github.com/actions/setup-python/releases) - [Commits](https://github.com/actions/setup-python/compare/a309ff8b426b58ec0e2a45f0f869d46889d02405...ece7cb06caefa5fff74198d8649806c4678c61a1) Updates `astral-sh/setup-uv` from 8.1.0 to 8.2.0 - [Release notes](https://github.com/astral-sh/setup-uv/releases) - [Commits](https://github.com/astral-sh/setup-uv/compare/08807647e7069bb48b6ef5acd8ec9567f424441b...fac544c07dec837d0ccb6301d7b5580bf5edae39) Updates `codecov/codecov-action` from 6.0.1 to 7.0.0 - [Release notes](https://github.com/codecov/codecov-action/releases) - [Changelog](https://github.com/codecov/codecov-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/codecov/codecov-action/compare/e79a6962e0d4c0c17b229090214935d2e33f8354...fb8b3582c8e4def4969c97caa2f19720cb33a72f) Updates `actions/cache` from 5.0.5 to 6.1.0 - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/27d5ce7f107fe9357f9df03efb73ab90386fccae...55cc8345863c7cc4c66a329aec7e433d2d1c52a9) Updates `pnpm/action-setup` from 6.0.8 to 6.0.9 - [Release notes](https://github.com/pnpm/action-setup/releases) - [Commits](https://github.com/pnpm/action-setup/compare/0e279bb959325dab635dd2c09392533439d90093...0ebf47130e4866e96fce0953f49152a61190b271) Updates `lewagon/wait-on-check-action` from 1.7.0 to 1.8.0 - [Release notes](https://github.com/lewagon/wait-on-check-action/releases) - [Changelog](https://github.com/lewagon/wait-on-check-action/blob/master/CHANGELOG.md) - [Commits](https://github.com/lewagon/wait-on-check-action/compare/9312864dfbc9fd208e9c0417843430751c042800...96d9100b431964d10e0136aff8b9ccb92470505e) Updates `release-drafter/release-drafter` from 7.3.1 to 7.4.0 - [Release notes](https://github.com/release-drafter/release-drafter/releases) - [Commits](https://github.com/release-drafter/release-drafter/compare/693d20e7c1ce1a81d3a41962f85914253b518449...ed4bc48ec97379be2258e7b7ac2624a3e26ab809) Updates `shogo82148/actions-upload-release-asset` from 1.10.1 to 1.10.2 - [Release notes](https://github.com/shogo82148/actions-upload-release-asset/releases) - [Commits](https://github.com/shogo82148/actions-upload-release-asset/compare/ee2ae851dc5d938b90075b3ef12c540abfd1ee72...394b3c11c3cfc038b5396ad265c074065cf875c3) Updates `zizmorcore/zizmor-action` from 0.5.6 to 0.5.7 - [Release notes](https://github.com/zizmorcore/zizmor-action/releases) - [Commits](https://github.com/zizmorcore/zizmor-action/compare/5f14fd08f7cf1cb1609c1e344975f152c7ee938d...192e21d79ab29983730a13d1382995c2307fbcaa) Updates `github/codeql-action/upload-sarif` from 4.36.0 to 4.36.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/7211b7c8077ea37d8641b6271f6a365a22a5fbfa...8aad20d150bbac5944a9f9d289da16a4b0d87c1e) Updates `github/codeql-action/init` from 4.36.0 to 4.36.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/7211b7c8077ea37d8641b6271f6a365a22a5fbfa...8aad20d150bbac5944a9f9d289da16a4b0d87c1e) Updates `github/codeql-action/analyze` from 4.36.0 to 4.36.2 - [Release notes](https://github.com/github/codeql-action/releases) - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md) - [Commits](https://github.com/github/codeql-action/compare/7211b7c8077ea37d8641b6271f6a365a22a5fbfa...8aad20d150bbac5944a9f9d289da16a4b0d87c1e) Updates `crowdin/github-action` from 2.16.2 to 2.16.3 - [Release notes](https://github.com/crowdin/github-action/releases) - [Commits](https://github.com/crowdin/github-action/compare/8868a33591d21088edfc398968173a3b98d51706...52aa776766211d83d975df51f3b9c53c2f8ba35f) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/setup-python dependency-version: 6.3.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: astral-sh/setup-uv dependency-version: 8.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: codecov/codecov-action dependency-version: 7.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: actions/cache dependency-version: 6.1.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: actions - dependency-name: pnpm/action-setup dependency-version: 6.0.9 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: lewagon/wait-on-check-action dependency-version: 1.8.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: release-drafter/release-drafter dependency-version: 7.4.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: actions - dependency-name: shogo82148/actions-upload-release-asset dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: zizmorcore/zizmor-action dependency-version: 0.5.7 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/codeql-action/upload-sarif dependency-version: 4.36.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/codeql-action/init dependency-version: 4.36.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: github/codeql-action/analyze dependency-version: 4.36.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions - dependency-name: crowdin/github-action dependency-version: 2.16.3 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: actions ... Signed-off-by: dependabot[bot] <support@github.com>
248 lines
8.6 KiB
YAML
248 lines
8.6 KiB
YAML
name: Backend Tests
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- 'translations**'
|
|
pull_request:
|
|
branches-ignore:
|
|
- 'translations**'
|
|
workflow_dispatch:
|
|
concurrency:
|
|
group: backend-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
env:
|
|
DEFAULT_UV_VERSION: "0.11.x"
|
|
NLTK_DATA: "/usr/share/nltk_data"
|
|
permissions: {}
|
|
jobs:
|
|
changes:
|
|
name: Detect Backend Changes
|
|
runs-on: ubuntu-slim
|
|
permissions:
|
|
contents: read
|
|
outputs:
|
|
backend_changed: ${{ steps.force.outputs.run_all == 'true' || steps.filter.outputs.backend == 'true' }}
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
- name: Decide run mode
|
|
id: force
|
|
env:
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
REF_NAME: ${{ github.ref_name }}
|
|
run: |
|
|
if [[ "${EVENT_NAME}" == "workflow_dispatch" ]]; then
|
|
echo "run_all=true" >> "$GITHUB_OUTPUT"
|
|
elif [[ "${EVENT_NAME}" == "push" && ( "${REF_NAME}" == "main" || "${REF_NAME}" == "dev" ) ]]; then
|
|
echo "run_all=true" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "run_all=false" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- name: Set diff range
|
|
id: range
|
|
if: steps.force.outputs.run_all != 'true'
|
|
env:
|
|
BEFORE_SHA: ${{ github.event.before }}
|
|
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
|
|
EVENT_CREATED: ${{ github.event.created }}
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
|
|
SHA: ${{ github.sha }}
|
|
run: |
|
|
if [[ "${EVENT_NAME}" == "pull_request" ]]; then
|
|
echo "base=${PR_BASE_SHA}" >> "$GITHUB_OUTPUT"
|
|
elif [[ "${EVENT_CREATED}" == "true" ]]; then
|
|
echo "base=${DEFAULT_BRANCH}" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "base=${BEFORE_SHA}" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
echo "ref=${SHA}" >> "$GITHUB_OUTPUT"
|
|
- name: Detect changes
|
|
id: filter
|
|
if: steps.force.outputs.run_all != 'true'
|
|
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
|
|
with:
|
|
base: ${{ steps.range.outputs.base }}
|
|
ref: ${{ steps.range.outputs.ref }}
|
|
filters: |
|
|
backend:
|
|
- 'src/**'
|
|
- 'pyproject.toml'
|
|
- 'uv.lock'
|
|
- 'docker/compose/docker-compose.ci-test.yml'
|
|
- '.github/workflows/ci-backend.yml'
|
|
test:
|
|
needs: changes
|
|
if: needs.changes.outputs.backend_changed == 'true'
|
|
name: "Python ${{ matrix.python-version }}"
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: read
|
|
strategy:
|
|
matrix:
|
|
python-version: ['3.11', '3.12', '3.13', '3.14']
|
|
fail-fast: false
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Start containers
|
|
run: |
|
|
docker compose --file docker/compose/docker-compose.ci-test.yml pull --quiet
|
|
docker compose --file docker/compose/docker-compose.ci-test.yml up --detach
|
|
- name: Set up Python
|
|
id: setup-python
|
|
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
with:
|
|
python-version: "${{ matrix.python-version }}"
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
with:
|
|
version: ${{ env.DEFAULT_UV_VERSION }}
|
|
enable-cache: true
|
|
python-version: ${{ steps.setup-python.outputs.python-version }}
|
|
- name: Install system dependencies
|
|
timeout-minutes: 10
|
|
run: |
|
|
sudo apt-get update -qq
|
|
sudo apt-get install -qq --no-install-recommends \
|
|
unpaper tesseract-ocr imagemagick ghostscript poppler-utils
|
|
- name: Configure ImageMagick
|
|
run: |
|
|
sudo cp docker/rootfs/etc/ImageMagick-6/paperless-policy.xml /etc/ImageMagick-6/policy.xml
|
|
- name: Install Python dependencies
|
|
env:
|
|
PYTHON_VERSION: ${{ steps.setup-python.outputs.python-version }}
|
|
run: |
|
|
uv sync \
|
|
--python "${PYTHON_VERSION}" \
|
|
--group testing \
|
|
--frozen
|
|
- name: List installed Python dependencies
|
|
run: |
|
|
uv pip list
|
|
- name: Install NLTK data
|
|
run: |
|
|
uv run python -m nltk.downloader punkt punkt_tab snowball_data stopwords -d "${NLTK_DATA}"
|
|
- name: Run tests
|
|
env:
|
|
NLTK_DATA: ${{ env.NLTK_DATA }}
|
|
PAPERLESS_CI_TEST: 1
|
|
PYTHON_VERSION: ${{ steps.setup-python.outputs.python-version }}
|
|
run: |
|
|
uv run \
|
|
--python "${PYTHON_VERSION}" \
|
|
--dev \
|
|
--frozen \
|
|
pytest
|
|
- name: Upload test results to Codecov
|
|
if: always()
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
flags: backend-python-${{ matrix.python-version }}
|
|
files: junit.xml
|
|
report_type: test_results
|
|
- name: Upload coverage to Codecov
|
|
uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0
|
|
with:
|
|
flags: backend-python-${{ matrix.python-version }}
|
|
files: coverage.xml
|
|
report_type: coverage
|
|
- name: Stop containers
|
|
if: always()
|
|
run: |
|
|
docker compose --file docker/compose/docker-compose.ci-test.yml logs
|
|
docker compose --file docker/compose/docker-compose.ci-test.yml down
|
|
typing:
|
|
needs: changes
|
|
if: needs.changes.outputs.backend_changed == 'true'
|
|
name: Check project typing
|
|
runs-on: ubuntu-24.04
|
|
permissions:
|
|
contents: read
|
|
env:
|
|
DEFAULT_PYTHON: "3.12"
|
|
PAPERLESS_SECRET_KEY: "ci-typing-not-a-real-secret"
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Python
|
|
id: setup-python
|
|
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6.3.0
|
|
with:
|
|
python-version: "${{ env.DEFAULT_PYTHON }}"
|
|
- name: Install uv
|
|
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
with:
|
|
version: ${{ env.DEFAULT_UV_VERSION }}
|
|
enable-cache: true
|
|
python-version: ${{ steps.setup-python.outputs.python-version }}
|
|
- name: Install Python dependencies
|
|
env:
|
|
PYTHON_VERSION: ${{ steps.setup-python.outputs.python-version }}
|
|
run: |
|
|
uv sync \
|
|
--python "${PYTHON_VERSION}" \
|
|
--group testing \
|
|
--group typing \
|
|
--frozen
|
|
- name: List installed Python dependencies
|
|
run: |
|
|
uv pip list
|
|
- name: Check typing (pyrefly)
|
|
continue-on-error: true
|
|
run: |
|
|
uv run pyrefly \
|
|
check \
|
|
src/
|
|
- name: Cache Mypy
|
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
with:
|
|
path: .mypy_cache
|
|
# Keyed by OS, Python version, and dependency hashes
|
|
key: ${{ runner.os }}-mypy-py${{ env.DEFAULT_PYTHON }}-${{ hashFiles('pyproject.toml', 'uv.lock') }}
|
|
restore-keys: |
|
|
${{ runner.os }}-mypy-py${{ env.DEFAULT_PYTHON }}-
|
|
${{ runner.os }}-mypy-
|
|
- name: Check typing (mypy)
|
|
continue-on-error: true
|
|
run: |
|
|
uv run mypy \
|
|
--show-error-codes \
|
|
--warn-unused-configs \
|
|
src/ | uv run mypy-baseline filter
|
|
gate:
|
|
name: Backend CI Gate
|
|
needs: [changes, test, typing]
|
|
if: always()
|
|
runs-on: ubuntu-slim
|
|
steps:
|
|
- name: Check gate
|
|
env:
|
|
BACKEND_CHANGED: ${{ needs.changes.outputs.backend_changed }}
|
|
TEST_RESULT: ${{ needs.test.result }}
|
|
TYPING_RESULT: ${{ needs.typing.result }}
|
|
run: |
|
|
if [[ "${BACKEND_CHANGED}" != "true" ]]; then
|
|
echo "No backend-relevant changes detected."
|
|
exit 0
|
|
fi
|
|
|
|
if [[ "${TEST_RESULT}" != "success" ]]; then
|
|
echo "::error::Backend test job result: ${TEST_RESULT}"
|
|
exit 1
|
|
fi
|
|
|
|
if [[ "${TYPING_RESULT}" != "success" ]]; then
|
|
echo "::error::Backend typing job result: ${TYPING_RESULT}"
|
|
exit 1
|
|
fi
|
|
|
|
echo "Backend checks passed."
|