-
Notifications
You must be signed in to change notification settings - Fork 0
119 lines (98 loc) · 2.83 KB
/
Copy pathbuild.yml
File metadata and controls
119 lines (98 loc) · 2.83 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
name: Build Python package
on:
push:
branches: [main, master]
tags: ["v*"]
pull_request:
workflow_dispatch:
permissions:
contents: read
jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: x64
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
python -m pip install -e .[dev]
- name: Run tests
run: python -m pytest
build:
name: Build wheel and sdist
runs-on: windows-latest
needs: test
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: x64
- name: Install build backend
run: |
python -m pip install --upgrade pip
python -m pip install build
- name: Build native backend DLL
shell: pwsh
run: |
powershell -ExecutionPolicy Bypass -File .\scripts\build.ps1 -OutputDir .\src\pktmon_interface
- name: Build package distributions
run: python -m build
- name: Smoke test built wheel
shell: pwsh
run: |
$wheel = Get-ChildItem .\dist -Filter *.whl | Select-Object -First 1
python -m pip install --force-reinstall $wheel.FullName
pktmon-interface --help
- name: Upload package artifacts
uses: actions/upload-artifact@v4
with:
name: pktmon-interface-dist
path: dist/*
github-release:
name: Attach distributions to GitHub release
runs-on: windows-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: write
steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: pktmon-interface-dist
path: dist
- name: Upload release artifacts
uses: softprops/action-gh-release@v2
with:
files: dist/*
publish-pypi:
name: Publish distributions to PyPI
runs-on: ubuntu-latest
needs: build
if: startsWith(github.ref, 'refs/tags/v')
permissions:
contents: read
steps:
- name: Download package artifacts
uses: actions/download-artifact@v4
with:
name: pktmon-interface-dist
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}