-
Notifications
You must be signed in to change notification settings - Fork 2
153 lines (127 loc) · 4.16 KB
/
ci.yml
File metadata and controls
153 lines (127 loc) · 4.16 KB
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
name: CI
on:
push:
pull_request:
jobs:
ci:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
python-version: [ "3.12", "3.13" ]
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
- name: Setup Python
id: setup-python
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: "1.8.3"
virtualenvs-create: true
virtualenvs-in-project: true
- name: Clean up PATH on Windows
if: runner.os == 'Windows'
shell: pwsh
run: |
$clean = ($env:PATH -split ';' | Where-Object {
$_ -notlike '*Git\usr\bin*' -and
$_ -notlike '*Strawberry*'
}) -join ';'
echo "PATH=$clean" >> $env:GITHUB_ENV
- name: Set up MSVC dev cmd
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
toolset: '14.29'
arch: x64
- name: Remove Git link.exe from PATH
if: runner.os == 'Windows'
shell: pwsh
run: |
$gitLink = "C:\Program Files\Git\usr\bin\link.exe"
if (Test-Path $gitLink) {
Rename-Item $gitLink "link_gnu_backup.exe"
Write-Host "Renamed Git link.exe -> link_gnu_backup.exe"
} else {
Write-Host "Git link.exe not found, nothing to do"
}
- name: Cache pip wheels
uses: actions/cache@v5
with:
path: |
~/.cache/pip
~/Library/Caches/pip
~\AppData\Local\pip\Cache
key: pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
restore-keys: |
pip-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-
pip-${{ runner.os }}-
- name: Install dependencies (with dev)
run: poetry install --with dev --no-interaction
- name: Pre-commit (all files)
run: poetry run pre-commit run --all-files
- name: Pytest
run: poetry run pytest --cov
- name: Coverage XML (artifact)
run: poetry run coverage xml -o coverage.xml
- name: Upload coverage.xml
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.os }}-py${{ matrix.python-version }}
path: coverage.xml
package:
name: Package build and install smoke
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: "3.12"
- name: Install build tooling
run: python -m pip install --upgrade pip build twine
- name: Build sdist and wheel
run: python -m build
- name: Check distribution metadata
run: python -m twine check dist/*
- name: Install wheel in a clean virtual environment
run: |
python -m venv .install-smoke
.install-smoke/bin/python -m pip install --upgrade pip
.install-smoke/bin/python -m pip install dist/*.whl
.install-smoke/bin/python -c "from pysatl_core.sampling.unuran.bindings import _unuran_cffi; assert _unuran_cffi is not None; print(_unuran_cffi.lib.unur_get_errno())"
wheels:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ macos-latest, windows-latest ]
steps:
- name: Checkout
uses: actions/checkout@v6
with:
submodules: recursive
persist-credentials: false
- name: Build wheels
uses: pypa/cibuildwheel@v3.4.1
- name: Upload wheels
uses: actions/upload-artifact@v7
with:
name: wheels-${{ matrix.os }}
path: wheelhouse/*.whl