-
Notifications
You must be signed in to change notification settings - Fork 6
186 lines (140 loc) · 4.84 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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: CI
# Enable Buildkit and let compose use it to speed up image building
env:
DOCKER_BUILDKIT: 1
COMPOSE_DOCKER_CLI_BUILD: 1
on:
pull_request:
branches: ["master", "main"]
paths-ignore: ["docs/**"]
push:
branches: ["master", "main"]
paths-ignore: ["docs/**"]
merge_group:
jobs:
build-scss:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up node
uses: actions/[email protected]
- name: Install node dependencies
run: npm ci
- name: Build scss
run: npm run build
js-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up node
uses: actions/[email protected]
- name: Install node dependencies
run: npm ci
- name: Run tests
run: npm test
linter:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.12"
cache: pip
cache-dependency-path: |
requirements/base.txt
requirements/local.txt
- name: Run pre-commit
uses: pre-commit/[email protected]
env:
SKIP: no-commit-to-branch,stylelint
# With no caching at all the entire ci process takes 4m 30s to complete!
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Copy .env.example file
uses: canastro/copy-file-action@master
with:
source: ".env.example"
target: ".env"
- name: Create docker network as used in dev
run: docker network create caselaw
- name: Build the Stack
run: docker compose build postgres django
- name: Run DB Migrations
run: docker compose run --rm django python manage.py migrate --settings=config.settings.test
- name: Run Django Tests with coverage
run: docker compose run django coverage run -m pytest -vvvv -rsa -m "not local"
- name: Generate coverage XML
run: docker compose run django coverage xml
- name: Run mypy
run: docker compose run django mypy ds_judgements_public_ui judgments
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
- name: Upload coverage to CodeClimate
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{secrets.CC_TEST_REPORTER_ID}}
- name: Tear down the Stack
run: docker compose down
e2e-tests:
runs-on: ubuntu-latest
steps:
- name: Checkout Code Repository
uses: actions/checkout@v4
- name: Copy .env.example file
uses: canastro/copy-file-action@master
with:
source: ".env.example"
target: ".env"
- name: Create docker network as used in dev
run: docker network create caselaw
- name: Build the Stack
run: docker compose build postgres django
- name: Checkout Marklogic repo
uses: actions/checkout@v4
with:
repository: "nationalarchives/ds-caselaw-marklogic"
path: "./marklogic"
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Install requests
run: "pip install requests"
- name: Run marklogic docker container
run: docker compose up -d --wait
working-directory: "./marklogic"
- name: Deploy marklogic configuration
run: gradle mlDeploy
working-directory: "./marklogic"
- name: Populate marklogic DB with test data
run: python ./development_scripts/populate_from_caselaw.py
working-directory: "./marklogic"
- name: Publish imported documents
run: gradle publishAllDocuments
working-directory: "./marklogic"
- name: Run DB Migrations
run: docker compose run --rm django python manage.py migrate --settings=config.settings.test
- name: Setup django server for e2e tests
run: docker compose up -d
- name: Install NPM deps
run: npm install
- name: Build the JS and SASS
run: npm run build
- name: Kick off the django server itself
run: docker compose exec -d django python manage.py runserver 0.0.0.0:3000
- name: Build playwright runner container
run: docker compose build e2e_tests
- name: Run playwright e2e tests
run: docker compose run e2e_tests pytest --base-url http://django:3000
- name: Tear down marklogic
run: docker compose down
working-directory: "./marklogic"
- name: Tear down the Stack
run: docker compose down