-
Notifications
You must be signed in to change notification settings - Fork 47
139 lines (116 loc) · 3.52 KB
/
publish_to_test_pypi.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
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
name: Publish to PyPI
on:
release:
types: [published]
env:
BUILD_FOLDER: build
jobs:
build:
strategy:
matrix:
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/ezc3d
- os: macos-latest
label: osx-64
prefix: /Users/runner/miniconda3/envs/ezc3d
- os: windows-latest
label: win-64
prefix: C:\Miniconda3\envs\ezc3d
name: ${{ matrix.label }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Get number of CPU cores
uses: SimenB/github-actions-cpu-cores@v1
id: cpu-cores
- name: Setup environment
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
use-mamba: true
activate-environment: ezc3d
environment-file: environment.yml
- name: Print mamba info
run: |
mamba info
mamba list
- name: Install dependencies
run: |
mamba install cmake git pkgconfig swig numpy pip scikit-build -cconda-forge
mamba list
pip install build
- name: Install cibuildwheel on Linux
run: python -m pip install cibuildwheel==2.21.3
if: matrix.label == 'linux-64'
- name: Build wheels on Linux
uses: pypa/cibuildwheel@v2.21.3
with:
config-file: "pyproject.toml"
env:
CIBW_SKIP: "pp*-manylinux_i686"
CIBW_BEFORE_BUILD: >-
rm -rf _skbuild
if: matrix.label == 'linux-64'
- name: Store the wheels on Linux
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-${{ matrix.label }}
path: ./wheelhouse/*.whl
if-no-files-found: error
if: matrix.label == 'linux-64'
- name: Build wheels on Mac or Windows
run: python -m build --sdist --wheel
if: matrix.label != 'linux-64'
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions-${{ matrix.label }}
path: dist/
if: matrix.label != 'linux-64'
publish-to-pypi:
name: Publish to PyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/ezc3d
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
pattern: python-package-distributions-*
path: dist/
merge-multiple: true
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
publish-to-testpypi:
name: Publish to TestPyPI
needs:
- build
runs-on: ubuntu-latest
environment:
name: testpypi
url: https://test.pypi.org/p/ezc3d
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
pattern: python-package-distributions-*
path: dist/
merge-multiple: true
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/