-
Notifications
You must be signed in to change notification settings - Fork 120
164 lines (152 loc) · 4.53 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
name: CI
on:
push:
branches:
- main
pull_request:
schedule:
- cron: "17 3 * * 0"
defaults:
run:
# required by https://github.com/snok/install-poetry#windows
shell: bash
concurrency:
group: ${{ github.head_ref || github.ref_name }}
cancel-in-progress: true
jobs:
lint:
name: Lint and typecheck Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Poetry
uses: snok/[email protected]
with:
version: "1.8.2"
virtualenvs-create: true
#- name: Cache python dependencies
# uses: actions/cache@v2
# id: cache
# with:
# path: ~/.cache/pypoetry
# key: poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
# restore-keys: |
# poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
- name: Install Dependencies
run: poetry install
# if: steps.cache.outputs.cache-hit != 'true'
- name: "Ruff"
run: |
poetry run ruff check
- uses: crate-ci/typos@master
- name: "Set up local settings"
run: cp local_settings_example.py local_settings.py
- name: "Mypy"
run: poetry run ./.ci/run-mypy.sh
- name: "Safety"
run: poetry run ./.ci/run-safety.sh
- name: "Sphinx"
run: |
(cd doc; poetry run make html SPHINXOPTS="-W --keep-going -n")
frontend:
name: Lint JS/build frontend (Node ${{ matrix.node-version }})
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ['16', '18', '20']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install
run: npm install
- name: ESLint
run: npx eslint frontend/js/*.js
- name: Rollup build
run: npm run build
pytest:
name: Python ${{ matrix.python-version }} - ${{ matrix.suite }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.x']
suite: ['base', 'postgres', 'expensive']
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: relatepgpass
POSTGRES_DB: test_relate
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/[email protected]
with:
version: "1.8.2"
virtualenvs-create: true
#- name: Cache python dependencies
# uses: actions/cache@v2
# id: cache
# with:
# path: ~/.cache/pypoetry
# key: poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
# restore-keys: |
# poetry-${{ hashFiles('**/poetry.lock') }}-${{ matrix.python-version }}
- name: Install Dependencies
run: poetry install
# if: steps.cache.outputs.cache-hit != 'true'
- name: Install OS dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
sudo apt-get install gettext
- name: Run test suite
env:
RL_CI_TEST: ${{ matrix.suite }}
run: |
bash ./.ci/run-tests-for-ci.sh
- name: Test command line tool
if: matrix.suite == 'base'
run: |
git clone https://github.com/inducer/relate-sample
cd relate-sample
poetry run relate validate .
poetry run relate test-code questions/autograded-python-example.yml
poetry run relate expand-yaml flows/quiz-test.yml > /dev/null
pytest-windows:
name: Python - Windows
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- name: Install Poetry
uses: snok/[email protected]
with:
version: "1.8.2"
virtualenvs-create: true
- name: Configure Poetry
run: |
poetry config virtualenvs.in-project true
- name: Install Dependencies
run: |
poetry install
- name: Run test suite
run: |
bash ./.ci/run-tests-for-ci.sh
# vim: sw=2