Repository navigation
149 lines (140 loc) · 4.14 KB
/
Copy pathpython-package.yml
File metadata and controls
149 lines (140 loc) · 4.14 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
name: Python package
on:
push:
branches: ["main"]
tags: ["v*"]
pull_request:
branches: ["main"]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install system dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y iverilog
- name: Install system dependencies (macOS)
if: runner.os == 'macOS'
run: brew install icarus-verilog
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install . "pytest>=8.2.2,<9" "ruff>=0.6.2,<0.7" "mypy>=1.11.2,<2"
- name: Lint
run: |
ruff check .
ruff format --check .
- name: Type check
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9'
run: mypy
- name: Test
run: pytest
build:
runs-on: ${{ matrix.os }}
needs: test
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
steps:
- uses: actions/checkout@v4
- name: Build wheels
uses: pypa/cibuildwheel@v4.1.0
env:
CIBW_BUILD: "cp39-* cp310-* cp311-* cp312-* cp313-* cp314-*"
CIBW_SKIP: "*-musllinux_*"
CIBW_ARCHS_MACOS: "arm64"
CIBW_TEST_COMMAND: >-
python -c "import wavekit; from wavekit import VcdReader, FstReader"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.os }}
path: wheelhouse/*.whl
build-pyodide:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Build Pyodide wheel
uses: pypa/cibuildwheel@v4.1.0
env:
CIBW_PLATFORM: pyodide
CIBW_BUILD: "cp314-pyodide_wasm32"
CIBW_TEST_COMMAND: >-
python -c "import wavekit; from wavekit import VcdReader, FstReader"
- name: Upload wheel
uses: actions/upload-artifact@v4
with:
name: dist-pyodide
path: wheelhouse/*.whl
sdist:
runs-on: ubuntu-latest
needs: test
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install Poetry
run: |
python -m pip install --upgrade pip
python -m pip install poetry
- name: Build source distribution
run: poetry build --format sdist
- name: Upload source distribution
uses: actions/upload-artifact@v4
with:
name: dist-sdist
path: dist/*.tar.gz
publish:
runs-on: ubuntu-latest
needs: [build, build-pyodide, sdist]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
github-release:
runs-on: ubuntu-latest
needs: publish
if: startsWith(github.ref, 'refs/tags/')
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: Extract changelog
id: changelog
uses: alleyinteractive/action-changelog-extractor@v0.4.0
with:
changelog-path: CHANGELOG.md
version: ${{ github.ref_name }}
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.ref_name }}
body: ${{ fromJson(steps.changelog.outputs.result)[0].contents }}
files: dist/*