some more CI changes #3
Workflow file for this run
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 | |
on: [push] | |
jobs: | |
python-tests: | |
runs-on: ubuntu-latest | |
services: | |
# Label used to access the service container | |
db: | |
# Docker Hub image | |
image: postgres:16 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres # pragma: allowlist secret | |
POSTGRES_DB: postgres | |
ports: | |
- 5432:5432 | |
redis: | |
image: redis:5.0.14 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: update apt | |
run: sudo apt-get update -y | |
- name: Apt install | |
run: cat Aptfile | sudo xargs apt-get install | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
version: 1.5.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: "3.12.1" | |
cache: "poetry" | |
- name: Validate lockfile | |
run: poetry lock --check | |
- name: Install dependencies | |
run: poetry install --no-interaction | |
- name: Lint | |
run: poetry run ruff --extend-ignore=D1 $(git ls-files '*.py') | |
- name: Tests | |
run: | | |
export MEDIA_ROOT="$(mktemp -d)" | |
./scripts/test/python_tests.sh | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5432/postgres # pragma: allowlist secret | |
CELERY_TASK_ALWAYS_EAGER: "True" | |
CELERY_BROKER_URL: redis://localhost:6379/4 | |
CELERY_RESULT_BACKEND: redis://localhost:6379/4 | |
MITOL_UE_COOKIE_NAME: "mitolue" | |
MITOL_UE_COOKIE_DOMAIN: "odl.local" | |
MITOL_UE_BASE_URL: "http://localhost:8073" | |
MITOL_UE_HOSTNAME: "ue.odl.local" | |
MITOL_UE_JWT_SECRET: "" | |
MITOL_UE_USE_S3: "False" | |
MITOL_UE_DB_DISABLE_SSL: "True" | |
- name: Upload coverage to CodeCov | |
uses: codecov/[email protected] | |
with: | |
file: ./coverage.xml | |
openapi-generated-client-check: | |
# This job checks that the output of openapi-generator-typescript-axios that | |
# is checked into version control is up-to-date. | |
env: | |
OPENAPI_SCHEMA: ./openapi.yaml | |
GENERATOR_IGNORE_FILE: ./frontends/api/.openapi-generator-ignore | |
GENERATOR_OUTPUT_DIR_CI: ./frontends/api/tmp/generated | |
GENERATOR_OUTPUT_DIR_VC: ./frontends/api/src/generated | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Generate Fresh API Client | |
uses: openapi-generators/openapitools-generator-action@v1 | |
with: | |
generator: typescript-axios | |
openapi-file: ./openapi.yaml | |
generator-tag: v6.6.0 | |
command-args: | | |
--output $GENERATOR_OUTPUT_DIR_CI \ | |
--ignore-file-override $GENERATOR_IGNORE_FILE \ | |
-c scripts/openapi-configs/typescript-axios.yaml | |
- name: Check VC client is up-to-date | |
run: | | |
diff $GENERATOR_OUTPUT_DIR_CI $GENERATOR_OUTPUT_DIR_VC \ | |
|| { echo "OpenAPI spec is out of date. Please regenerate via ./scripts/generate_openapi.sh"; exit 1; } |