Skip to content

vscode: click to definition between urls #735

vscode: click to definition between urls

vscode: click to definition between urls #735

Workflow file for this run

name: API
on:
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref || github.run_id }}
cancel-in-progress: true
jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
paths_result: ${{ steps.skip_check.outputs.paths_result }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@c449d86cf33a2a6c7a4193264cc2578e2c3266d4 # pin@v4
with:
paths: '["backend/**", ".github/workflows/**"]'
test:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- name: Install dependencies
working-directory: "./backend"
run: poetry install
- name: Run tests
working-directory: "backend"
run: ./s/test --junitxml=~/test-results/backend_tests.xml
- name: Store test results
uses: actions/upload-artifact@v3
with:
name: test-results
path: ~/test-results
format:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- name: Install dependencies
working-directory: "./backend"
run: poetry install
- name: Check formatting with Ruff
working-directory: "backend"
run: ./s/fmt
ruff:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- name: Install dependencies
working-directory: "./backend"
run: poetry install
- name: Lint with Ruff
working-directory: "backend"
run: ./s/ruff
typecheck:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- name: Install dependencies
working-directory: "./backend"
run: poetry install
- name: Typecheck with mypy
working-directory: "backend"
run: ./s/typecheck
check_missing_migrations:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- name: Install dependencies
working-directory: "./backend"
run: poetry install
- name: Check for missing migrations
working-directory: "backend"
run: ./s/check_migrations
lint_migrations:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
# Provide the password for postgres
env:
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v3
with:
fetch-depth: "0"
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- name: Install dependencies
working-directory: "./backend"
run: poetry install
- name: Run squawk
# change this to use https://github.com/marketplace/actions/squawk-action
working-directory: "backend"
run: ./s/squawk.py
- uses: sbdchd/squawk-action@v1
with:
pattern: "backend/recipeyak/migrations/*.sql"
version: "latest"
check_missing_api_schema_changes:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version-file: "backend/package.json"
cache-dependency-path: "backend/pnpm-lock.yaml"
cache: "pnpm"
- name: Install python dependencies
working-directory: "./backend"
run: poetry install
- name: Install js dependencies
working-directory: "backend"
run: pnpm install
- name: Check for missing api schema changes
working-directory: "backend"
run: ./s/check_missing_api_schema_changes
lint_api_schema:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version-file: "backend/package.json"
cache-dependency-path: "backend/pnpm-lock.yaml"
cache: "pnpm"
- name: Install js dependencies
working-directory: "backend"
run: pnpm install
- name: Lint API Schema
working-directory: "backend"
run: ./s/lint_api_schema
check_missing_codegen_changes:
needs: pre_job
if: needs.pre_job.outputs.should_skip != 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install poetry
run: |
pipx install poetry==1.7.1
poetry config virtualenvs.in-project true
- uses: actions/setup-python@v4
with:
python-version-file: "./backend/.python-version"
cache: poetry
cache-dependency-path: "./backend/poetry.lock"
- uses: pnpm/action-setup@v2
with:
version: 8
- uses: actions/setup-node@v3
with:
node-version-file: "backend/package.json"
cache-dependency-path: "backend/pnpm-lock.yaml"
cache: "pnpm"
- name: Install python dependencies
working-directory: "backend"
run: poetry install
- name: Install js dependencies
working-directory: "backend"
run: pnpm install
- name: Check for missing codegen changes
working-directory: "backend"
run: ./s/check_missing_codegen_changes