-
Notifications
You must be signed in to change notification settings - Fork 299
115 lines (109 loc) · 3.27 KB
/
pypi-publish.yml
File metadata and controls
115 lines (109 loc) · 3.27 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
# A workflow to publish releases to PyPi and TestPyPi.
name: pypi-publish
on:
release:
types: [published]
workflow_dispatch:
permissions: read-all
jobs:
build:
name: Build
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout Concordia
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
- name: Show Python setup
run: |
python --version
pip list
- name: Build distribution
run: |
python setup.py sdist bdist_wheel
# Workaround old setuptools not normalizing name in sdist.
for OLD in ./dist/gdm-concordia-*; do
NEW="$(echo "$OLD" | sed s/gdm-concordia/gdm_concordia/)"
mv "$OLD" "$NEW"
done
ls dist/*
- name: Save artifact
uses: actions/upload-artifact@330a01c490aca151604b8cf639adc76d48f6c5d4
with:
name: dist
path: ./dist
retention-days: 1
test:
name: Test
needs: build
runs-on: ${{ matrix.os }}
env:
SYSTEM_VERSION_COMPAT: 0 # See https://github.com/actions/setup-python/issues/279.
timeout-minutes: 120
strategy:
fail-fast: ${{ github.event_name == 'release' }}
matrix:
os:
- macos-14
- macos-15
- ubuntu-22.04
- ubuntu-22.04-arm
- ubuntu-24.04
- ubuntu-24.04-arm
python-version:
- '3.12'
- '3.13'
- '3.14'
steps:
- name: Load artifact
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
name: dist
path: ./dist
- name: Set up Python
uses: actions/setup-python@83679a892e2d95755f2dac6acb0bfd1e9ac5d548
with:
python-version: ${{ matrix.python-version }}
- name: Install Python dependencies
run: |
pip install --upgrade pip
pip install --upgrade setuptools
- name: Install source distribution
run: |
pip install dist/*.tar.gz
pip list
pip check
- name: Test source distribution
run: |
pip install pytest-xdist
pytest -n auto --pyargs concordia
publish:
name: Publish
needs: [build, test]
if: always() && needs.build.result == 'success' && needs.test.result != 'failure'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/gdm-concordia
permissions:
id-token: write
timeout-minutes: 10
steps:
- name: Load artifact
uses: actions/download-artifact@018cc2cf5baa6db3ef3c5f8a56943fffe632ef53
with:
name: dist
path: ./dist
- name: Publish to TestPyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
attestations: false
repository-url: https://test.pypi.org/legacy/
verbose: true
- name: Publish to PyPI
if: github.event_name == 'release'
uses: pypa/gh-action-pypi-publish@ed0c53931b1dc9bd32cbe73a98c7f6766f8a527e
with:
attestations: false
verbose: true