Skip to content

chore(actions): bump the github-actions group across 1 directory with… #257

chore(actions): bump the github-actions group across 1 directory with…

chore(actions): bump the github-actions group across 1 directory with… #257

Workflow file for this run

name: CI
on:
pull_request:
push:
branches: [main]
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
pull-requests: read
jobs:
changes:
runs-on: ubuntu-latest
outputs:
petdata: ${{ steps.filter.outputs.petdata }}
retriever: ${{ steps.filter.outputs.retriever }}
stacker: ${{ steps.filter.outputs.stacker }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
filters: |
petdata:
- 'services/petdata/**'
- 'packages/**'
- '.github/workflows/ci.yml'
retriever:
- 'services/retriever/**'
- 'packages/**'
- '.github/workflows/ci.yml'
stacker:
- 'apps/stacker/**'
- 'services/retriever/openapi.json'
- 'services/petdata/openapi.json'
- '.github/workflows/ci.yml'
petdata:
needs: changes
if: ${{ needs.changes.outputs.petdata == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: services/petdata
env:
TEST_DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5434/petdata_test
PETDATA_DATABASE_URL: postgresql+asyncpg://postgres:postgres@localhost:5434/petdata_test
services:
postgres:
image: pgvector/pgvector:pg17
env:
POSTGRES_DB: petdata_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5434:5432
options: >-
--health-cmd "pg_isready -U postgres -d petdata_test"
--health-interval 3s
--health-timeout 3s
--health-retries 10
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: services/petdata/uv.lock
- run: uv sync --extra dev
- run: uv run ruff format --check src/ tests/
- run: uv run ruff check src/ tests/
- run: uv run mypy src/
- run: uvx bandit -r src/ -q
- run: uv run alembic upgrade head
# Default addopts run unit-only (-m "not integration"); CI has the Postgres
# service, so run the full suite. fail_under=85 (pyproject) gates coverage.
- run: uv run pytest -m "integration or not integration" --cov=src --cov-report=term-missing
retriever:
needs: changes
if: ${{ needs.changes.outputs.retriever == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: services/retriever
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
enable-cache: true
cache-dependency-glob: services/retriever/uv.lock
- run: uv sync
- run: uv run ruff check src/ tests/
- run: uv run ruff format --check src/ tests/
- run: uv run python -m mypy src/ --strict
- run: uv run python -m pytest tests/ --ignore=tests/integration
stacker:
needs: changes
if: ${{ needs.changes.outputs.stacker == 'true' }}
runs-on: ubuntu-latest
defaults:
run:
working-directory: apps/stacker
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 22
cache: npm
cache-dependency-path: apps/stacker/package-lock.json
- run: cp .env.example .env
- run: npm ci
- run: npm run gen:types
- run: git diff --exit-code -- src/lib/modules/retriever/api/types.generated.ts src/lib/modules/petdata/api/types.generated.ts
- run: npm run check
- run: npm run build
container-build:
needs: changes
if: ${{ needs.changes.outputs.petdata == 'true' || needs.changes.outputs.retriever == 'true' }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
service: [petdata, retriever]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: docker/setup-buildx-action@37fe631027851001ddb9b187196cc803df7f5f0e # v4.3.0
# Build the service container image from the repo-root context (matches each
# service's wrangler `image_build_context: "../.."`). No push, no Cloudflare
# secrets, so it also runs on fork PRs. Catches Dockerfile and dependency-
# resolution breaks (a packages/* floor a service's wheels cannot satisfy)
# that previously only surfaced at deploy time.
- name: Build ${{ matrix.service }} image (no push)
if: ${{ needs.changes.outputs[matrix.service] == 'true' }}
uses: docker/build-push-action@53b7df96c91f9c12dcc8a07bcb9ccacbed38856a # v7.3.0
with:
context: .
file: services/${{ matrix.service }}/Dockerfile
push: false
cache-from: type=gha,scope=${{ matrix.service }}
cache-to: type=gha,mode=max,scope=${{ matrix.service }}
ci-success:
needs: [changes, petdata, retriever, stacker, container-build]
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Verify no job failed
run: |
results='${{ needs.petdata.result }} ${{ needs.retriever.result }} ${{ needs.stacker.result }} ${{ needs.container-build.result }}'
echo "job results: $results"
for r in $results; do
if [ "$r" = "failure" ] || [ "$r" = "cancelled" ]; then
echo "A required CI job did not pass."
exit 1
fi
done
echo "All triggered CI jobs passed."