-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (115 loc) · 4.48 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
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@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: update apt
run: sudo apt-get update -y
- name: Apt install
run: cat Aptfile | sudo xargs apt-get install -y
- name: Install poetry
uses: snok/install-poetry@76e04a911780d5b312d89783f7b1cd627778900a # v1
with:
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
- uses: actions/setup-python@f677139bbe7f9c59b41e40162b753c062f5d49a3 # v5
with:
python-version: "3.12.1"
cache: "poetry"
- uses: actions/setup-node@v4
with:
node-version: "22"
- name: Validate lockfile
run: poetry lock --check
- name: Install Python dependencies
run: poetry install --no-interaction
- name: Install Node dependencies
run: npm install
- name: Lint
run: poetry run ruff check --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/codecov-action@b9fd7d16f6d7d1b5d2bec1a2887e65ceed900238 # v4.6.0
with:
file: ./coverage.xml
openapi-generated-client-check-v0:
# 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/specs/v0.yaml
GENERATOR_IGNORE_FILE: ./frontends/api/.openapi-generator-ignore
GENERATOR_OUTPUT_DIR_CI: ./frontends/api/tmp/generated/v0
GENERATOR_OUTPUT_DIR_VC: ./frontends/api/src/generated/v0
COREPACK_ENABLE_DOWNLOAD_PROMPT: 0
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af # v4
with:
node-version: "^20"
cache: "npm"
cache-dependency-path: "package-lock.json"
- name: Install dependencies
run: npm i
- name: Generate Fresh API Client
uses: openapi-generators/openapitools-generator-action@v1
with:
generator: typescript-axios
openapi-file: $OPENAPI_SCHEMA
generator-tag: v7.2.0
command-args: |
--output $GENERATOR_OUTPUT_DIR_CI \
--ignore-file-override $GENERATOR_IGNORE_FILE \
-c scripts/openapi-configs/typescript-axios-v0.yaml
- name: Format freshly generated client
run: npx prettier $GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write
# Kept getting tripped up on npmignore and the git push script, neither
# of which are really important, so just check the generated TypeScript
# files instead.
- name: Check VC client is up-to-date
run: |
mkdir $GENERATOR_OUTPUT_DIR_VC/ts
mkdir $GENERATOR_OUTPUT_DIR_CI/ts
cp $GENERATOR_OUTPUT_DIR_VC/*.ts $GENERATOR_OUTPUT_DIR_VC/ts
cp $GENERATOR_OUTPUT_DIR_CI/*.ts $GENERATOR_OUTPUT_DIR_CI/ts
diff $GENERATOR_OUTPUT_DIR_CI/ts $GENERATOR_OUTPUT_DIR_VC/ts \
|| { echo "OpenAPI spec is out of date. Please regenerate via ./scripts/generate_openapi.sh"; exit 1; }