Skip to content

✨(tooling) require PR fields workflow: handle edits on project items #348

✨(tooling) require PR fields workflow: handle edits on project items

✨(tooling) require PR fields workflow: handle edits on project items #348

Workflow file for this run

name: OCR
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
types: [opened, synchronize, reopened, edited]
permissions:
contents: read
jobs:
check-changes:
runs-on: ubuntu-latest
outputs:
relevant: ${{ steps.filter.outputs.relevant }}
steps:
- uses: actions/checkout@v6
- uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d
id: filter
with:
filters: |
relevant:
- "src/ocr/**"
- ".github/workflows/ocr.yml"
- ".github/actions/**"
build-ocr:
needs: check-changes
if: github.event_name == 'push' || needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-uv-python
with:
service-path: src/ocr
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y poppler-utils tesseract-ocr tesseract-ocr-fra
lint-ocr:
needs: [check-changes, build-ocr]
if: github.event_name == 'push' || needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/ocr
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-uv-python
with:
service-path: src/ocr
- name: Lint with Ruff
run: uv run ruff check .
- name: Lint format with Ruff
run: uv run ruff format --check .
- name: Lint with MyPy
run: uv run mypy .
test-ocr:
needs: [check-changes, build-ocr]
if: github.event_name == 'push' || needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./src/ocr
env:
API_KEY: test-api-key-for-development
steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/setup-uv-python
with:
service-path: src/ocr
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y poppler-utils tesseract-ocr tesseract-ocr-fra
- name: Test with pytest
run: uv run pytest .
deploy-ocr:
needs: [check-changes, lint-ocr, test-ocr]
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && needs.check-changes.outputs.relevant == 'true'
runs-on: ubuntu-latest
environment: production
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: ./.github/actions/scalingo-deploy
with:
branch: main-ocr