-
Notifications
You must be signed in to change notification settings - Fork 1
88 lines (85 loc) · 2.53 KB
/
pipeline.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
name: pyMHF
on:
# Run on all branches except for the gh-pages branch
push:
paths-ignore:
- '*.md'
branches-ignore:
- 'gh-pages'
tags:
- '*'
jobs:
build_test:
name: Build artefacts
runs-on: Windows-latest
strategy:
fail-fast: false
matrix:
py_ver: [{version: '3.9'}] # , {version: '3.10'}, {version: '3.11'}]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.py_ver.version}}
uses: actions/setup-python@v5
with:
python-version: "${{ matrix.py_ver.version}}"
- name: Install dependencies
run: |
python -m pip install --upgrade pip uv
uv sync --frozen --dev
- name: Build Python ${{ matrix.py_ver.version}} wheel
run: uv build
- name: Lint and format code
run: |
uv run ruff check ./pymhf
uv run ruff format --check ./pymhf
uv run python -m twine check ./dist/*
- name: Upload Wheels
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
release:
name: Release pyMHF wheels and source build to PyPI
# Only run this job if the commit was tagged.
if: startsWith(github.ref, 'refs/tags')
needs:
- build_test
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/pyMHF
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download files for release
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
attestations: true
test-release:
name: Release pyMHF wheels and source build to test-PyPI
needs:
- build_test
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/pyMHF
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- name: Download files for release
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
attestations: true