-
Notifications
You must be signed in to change notification settings - Fork 9
123 lines (119 loc) · 4.18 KB
/
build.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
name: Build neoscore
on:
push:
branches: [ main ]
pull_request:
jobs:
build:
defaults:
run:
shell: bash
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: ${{ matrix.platform }}
timeout-minutes: 30
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.7'
#----------------------------------------------
# ----- install & configure poetry -----
#----------------------------------------------
- name: Install Poetry
uses: snok/install-poetry@v1
with:
# Poetry seems to have dropped official support for Python 3.7
# but we need it for PyQt build artifacts. Pin poetry version.
# See https://github.com/snok/install-poetry/issues/131
# and https://github.com/python-poetry/poetry/pull/7674
version: 1.5.1
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
#----------------------------------------------
# load cached venv if cache exists
#----------------------------------------------
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
#----------------------------------------------
# install dependencies if cache does not exist
#----------------------------------------------
- name: Install python dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --no-interaction --no-root
#----------------------------------------------
# install non-python dependencies, specific to OS
#----------------------------------------------
- name: Install non-python dependencies
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
sudo apt install graphviz
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install graphviz
elif [ "$RUNNER_OS" == "Windows" ]; then
choco install graphviz --no-progress
else
echo "$RUNNER_OS not supported"
exit 1
fi
shell: bash
#----------------------------------------------
# install root project
#----------------------------------------------
- name: Install neoscore
run: poetry install --no-interaction
#----------------------------------------------
# run test suite
#----------------------------------------------
- name: Run tests
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
source .venv/Scripts/activate
else
source .venv/bin/activate
fi
pytest -n auto
shell: bash
env:
NEOSCORE_HEADLESS: True
- name: Check formatting conforms to Black
uses: psf/[email protected]
if: matrix.platform == 'ubuntu-latest'
- name: Check import sorting with isort
if: matrix.platform == 'ubuntu-latest'
run: |
source .venv/bin/activate
pip install isort
isort .
- name: Check for unused imports with unimport
if: matrix.platform == 'ubuntu-latest'
run: |
source .venv/bin/activate
pip install unimport
unimport --check --exclude "neoscore/common.py|.venv"
- name: Build docs site
working-directory: doc
env:
NEOSCORE_HEADLESS: True
SPHINXOPTS: -T # Log traceback on sphinx errors
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
source ../.venv/Scripts/activate
./make.bat html
else
source ../.venv/bin/activate
make html
fi
shell: bash