CI #64
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:12.22 | |
# Set health checks to wait until postgres has started | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
env: | |
PGPORT: 5433 | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: postgres # pragma: allowlist secret | |
POSTGRES_DB: postgres | |
ports: | |
- 5433:5433 | |
redis: | |
image: redis:7.4.1 | |
ports: | |
- 6379:6379 | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- 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@76e04a911780d5b312d89783f7b1cd627778900a # v1 | |
with: | |
version: 1.7.1 | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5 | |
with: | |
python-version: "3.12.6" | |
cache: "poetry" | |
- name: Validate lockfile | |
run: poetry check --lock | |
- name: Install dependencies | |
run: poetry install --no-interaction | |
- name: Tests | |
run: | | |
poetry run ./manage.py collectstatic --noinput --clear | |
export MEDIA_ROOT="$(mktemp -d)" | |
./scripts/test/python_tests.sh | |
env: | |
DATABASE_URL: postgres://postgres:postgres@localhost:5433/postgres # pragma: allowlist secret | |
MITOL_SECURE_SSL_REDIRECT: "False" | |
MITOL_DB_DISABLE_SSL: "True" | |
MITOL_FEATURES_DEFAULT: "True" | |
CELERY_TASK_ALWAYS_EAGER: "True" | |
CELERY_BROKER_URL: redis://localhost:6379/4 | |
CELERY_RESULT_BACKEND: redis://localhost:6379/4 | |
MITOL_APP_BASE_URL: http://localhost:8002/ | |
MAILGUN_KEY: fake_mailgun_key | |
MAILGUN_SENDER_DOMAIN: other.fake.site | |
MITOL_COOKIE_DOMAIN: localhost | |
MITOL_COOKIE_NAME: cookie_monster | |
- name: Upload coverage to CodeCov | |
uses: codecov/codecov-action@1e68e06f1dbfde0e4cefc87efeba9e4643565303 # v5.1.2 | |
with: | |
file: ./coverage.xml | |
javascript-tests: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./frontend-demo | |
steps: | |
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4 | |
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4 | |
with: | |
node-version: "^22" | |
cache: yarn | |
cache-dependency-path: frontend-demo/yarn.lock | |
- name: Install dependencies | |
run: yarn install --immutable | |
- name: Format | |
run: yarn run fmt-check | |
- name: Lints | |
run: yarn run lint-check | |
# do build before typecheck. See https://github.com/vercel/next.js/issues/53959#issuecomment-1735563224 | |
- name: Build | |
run: yarn build | |
env: | |
NODE_ENV: production | |
NEXT_PUBLIC_MITOL_API_BASE_URL: "http://ai.test.local:8003" | |
- name: Typecheck | |
run: yarn typecheck | |
- name: Tests | |
run: yarn test | |
env: | |
CODECOV: true | |
NODE_ENV: test |