-
Notifications
You must be signed in to change notification settings - Fork 3
129 lines (108 loc) · 4.44 KB
/
test.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
name: Test
on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '0 5 * * *'
permissions:
contents: read
jobs:
# Run tests, linters, and checkers via nox
test:
runs-on: ${{ matrix.os }}
env:
LEDA_TEST_OUTPUT_DIR: ~/leda_outputs/
PIP_DISABLE_PIP_VERSION_CHECK: '1'
strategy:
fail-fast: false
matrix:
# See https://help.github.com/articles/virtual-environments-for-github-actions
os:
- ubuntu-latest
# TODO: Switch back to `macos-latest` when we fix small issues with macOS 14 ARM
- macos-13
- windows-latest
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13', 'pypy-3.10']
exclude:
# It looks like the issue with with macos-13/python3.8 is that the
# GitHub image for macos-13 switched from gcc 11 to 12, and this makes
# the old matplotlib package fail.
# TODO: Remove when we remove support for python3.8 entirely.
# See:
# - https://github.com/actions/runner-images/issues/10213
# - https://github.com/actions/runner-images/blob/releases/macos-13/20240811/images/macos/macos-13-Readme.md
# - https://github.com/actions/runner-images/discussions/7521
- os: macos-13
python-version: 3.8
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install apt dependencies (ubuntu-latest)
run: |
# See https://github.com/matplotlib/matplotlib/issues/22113
sudo apt install libfreetype-dev
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
- name: Install pip dependencies (ubuntu-latest, py3.8)
run: |
python -m pip install --upgrade "setuptools<74" "virtualenv<=20.26.3" pip wheel
python -m pip install nox
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8' }}
- name: Install pip dependencies
run: |
python -m pip install --upgrade setuptools pip wheel
python -m pip install nox
if: ${{ ! (matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8') }}
# TODO: Run tests on windows/pypy-3.10
- name: Test with nox
run: nox
if: ${{ ! (matrix.os == 'windows-latest' && matrix.python-version == 'pypy-3.10') }}
- name: Integration test with nox
run: nox -t integration_test --python ${{ matrix.python-version }} -- --gen-html-diffs
# Notes:
# - Skip py3.9 and py3.13 because none of the bundles are for it.
# - Skip integration tests on Windows/py3.8 because
# there are no pre-built Windows/py3.8/numpy1.6.6 wheels.
# - TODO: Investigate issues on Windows and pypy.
if: ${{ (matrix.python-version != '3.9') && (matrix.python-version != '3.13') && ! (matrix.os == 'windows-latest' && matrix.python-version == '3.8') && ! startsWith(matrix.python-version, 'pypy-') }}
- name: Upload failed outputs
uses: actions/upload-artifact@v4
with:
name: leda-outputs-${{ matrix.os }}-${{ matrix.python-version }}
path: ~/leda_outputs/
retention-days: 1
if: ${{ failure() }}
# Test building and publishing
# See:
# - https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# - https://packaging.python.org/en/latest/tutorials/packaging-projects/
# - https://www.seanh.cc/2022/05/21/publishing-python-packages-from-github-actions/
publish-test:
runs-on: ubuntu-latest
needs: [test]
strategy:
matrix:
python-version: ['3.8']
steps:
- uses: actions/checkout@v4
with:
# See https://github.com/actions/checkout/issues/261
ref: ${{ github.event.pull_request.head.sha }}
# Grab entire history for setuptools_scm
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade build twine
- name: Create packages
run: python -m build
- name: Run twine check
run: twine check dist/*