-
-
Notifications
You must be signed in to change notification settings - Fork 1
153 lines (147 loc) · 4.09 KB
/
deploy.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: Deploy
on:
workflow_run:
workflows: [ "Tests" ]
branches: [ "master" ]
types: [ "completed" ]
release:
types: [ "published" ]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
DO_NOT_TRACK: 1
PIP_DISABLE_PIP_VERSION_CHECK: 1
# Heavily inspired by https://github.com/pydantic/pydantic-core/blob/main/.github/workflows/ci.yml
jobs:
build-sdist:
name: build sdist
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: PyO3/maturin-action@v1
with:
command: sdist
args: --out dist
rust-toolchain: stable
- name: List files
run: find dist/ -type f -print0 -quit | xargs -0 tar ztf
- uses: actions/upload-artifact@v4
with:
name: package_sdist
path: dist
build:
if: ${{ github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success' }}
strategy:
fail-fast: false
matrix:
os: [ "linux", "macos", "windows" ]
target: [ "x86_64", "aarch64" ]
manylinux: [ "auto" ]
include:
# manylinux
- os: linux
manylinux: auto
target: i686
- os: linux
manylinux: auto
target: aarch64
- os: linux
manylinux: auto
target: x86_64
# musllinux
- os: linux
manylinux: musllinux_1_1
target: x86_64
- os: linux
manylinux: musllinux_1_1
target: aarch64
# macos
- os: macos
target: x86_64
- os: macos
target: aarch64
# windows
- os: windows
target: x86_64
interpreter: 3.8 3.9 3.10 3.11 3.12
- os: windows
target: i686
python-architecture: x86
interpreter: 3.8 3.9 3.10 3.11 3.12
exclude:
- os: windows
target: aarch64
runs-on: ${{ (matrix.os == 'linux' && 'ubuntu') || matrix.os }}-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
architecture: ${{ matrix.python-architecture || 'x64' }}
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
pip install twine
- name: Build
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
manylinux: ${{ matrix.manylinux }}
args: --release --out dist --interpreter ${{ matrix.interpreter || '3.8 3.9 3.10 3.11 3.12 pypy3.9 pypy3.10' }}
rust-toolchain: stable
docker-options: -e CI
- name: List wheels
run: ${{ (matrix.os == 'windows' && 'dir') || 'ls -lh' }} dist/
- name: Check with Twine
run: twine check --strict dist/*
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: package_${{ matrix.os }}_${{ matrix.target }}_${{ matrix.interpreter || 'all' }}_${{ matrix.manylinux }}
path: dist
pypi:
if: github.event_name == 'release'
environment:
name: pypi
url: https://pypi.org/p/evalica
permissions:
id-token: write
runs-on: ubuntu-latest
needs:
- build-sdist
- build
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
pattern: package_*
merge-multiple: true
path: dist
- run: ls -lh dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
testpypi:
environment:
name: testpypi
url: https://test.pypi.org/p/evalica
permissions:
id-token: write
runs-on: ubuntu-latest
needs:
- build-sdist
- build
steps:
- name: Download packages
uses: actions/download-artifact@v4
with:
pattern: package_*
merge-multiple: true
path: dist
- run: ls -lh dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
skip-existing: true