-
Notifications
You must be signed in to change notification settings - Fork 308
157 lines (151 loc) · 5.32 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
name: Tests master
on:
# This avoids having duplicate builds for a pull request
push:
branches:
- master
- "*-maintenance"
pull_request:
branches:
- master
- "*-maintenance"
jobs:
############################################################################
# Lint jobs
############################################################################
lint:
name: lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "lts/*"
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Install node dependencies
run: make frontend/node_modules
- uses: actions/setup-python@v4
with:
python-version: "3.9"
cache: "pip"
cache-dependency-path: "**/setup.cfg"
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install python dependencies
id: pip
run: |
python -m pip install --upgrade pip
python -m pip install tox pre-commit
python -m pip freeze --local
- name: Run pylint
run: tox -e lint
- name: Run pre-commit
# run pre-commit check even if pylint check fails
if: steps.pip.outcome == 'success'
run: pre-commit run --show-diff-on-failure --color=always --all-files
############################################################################
# Node tests
############################################################################
node:
name: ${{ matrix.os}} node-${{ matrix.node }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
node: ["lts/*"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
include:
- node: "current"
os: "ubuntu-latest"
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "npm"
cache-dependency-path: "**/package-lock.json"
- name: Build frontend
run: make
- name: Typecheck and run frontend tests
run: make test-js
############################################################################
# Python tests
############################################################################
python-tests:
name: ${{ matrix.os }} py${{ matrix.python }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python: ["3.7", "3.8", "3.9", "3.10", "3.11"]
exclude:
- os: "macos-latest"
python: "3.8"
- os: "macos-latest"
python: "3.9"
- os: "macos-latest"
python: "3.10"
- os: "windows-latest"
python: "3.8"
- os: "windows-latest"
python: "3.9"
- os: "windows-latest"
python: "3.10"
include:
- python: "3.6"
os: "ubuntu-20.04"
- python: "3.11"
install-imagemagick: true
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/setup.cfg"
- name: Install macOS system dependencies
if: startsWith(runner.os, 'macos') && matrix.install-imagemagick
run: brew install imagemagick ffmpeg
- name: Install Windows system dependencies
if: startsWith(runner.os, 'windows') && matrix.install-imagemagick
run: |
choco install --no-progress --timeout 600 imagemagick.app ffmpeg
# The imagemagick.app package, for whatever reason, installs
# magick.exe into a directory which is not in the default
# search path. Currently, it seems to get installed in a
# directory named something like:
#
# "C:\Program Files\ImageMagick-7.1.0-Q16-HDRI"
$ImDirs = (
Get-ChildItem $env:ProgramFiles 'ImageMagick*' -Directory
| Select-Object -ExpandProperty FullName
)
if ($ImDirs.Length -eq 0) { Throw "Could not find path to ImageMagick" }
$ImDirs | Out-File $env:GITHUB_PATH utf8 -Append
$ImDirs | % { "::notice title=ImageMagick::ImageMagick installed at $_" }
continue-on-error: true
- name: Workaround for UnicodeDecodeError from tox on Windows
# Refs:
# https://github.com/lektor/lektor/pull/933#issuecomment-923107580
# https://github.com/tox-dev/tox/issues/1550
if: startsWith(runner.os, 'windows')
run: Out-File $env:GITHUB_ENV utf8 -Append -InputObject 'PYTHONIOENCODING=utf-8'
- name: Install python dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions coverage[toml]
- name: Run python tests
run: tox
- name: Generate coverage.xml
shell: bash
run: |
coverage combine --append || true
coverage xml
- name: Publish coverage data to codecov
uses: codecov/codecov-action@v3