-
Notifications
You must be signed in to change notification settings - Fork 13
201 lines (197 loc) · 6.5 KB
/
CI.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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# This file is autogenerated by maturin v0.14.17
# To update, run
#
# maturin generate-ci github
#
name: CI
on:
push:
branches:
- main
tags:
- '*'
jobs:
build:
name: "Build on ${{ matrix.platform.name }} with Python ${{ matrix.python.version }}"
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
python: [
# {
# name: "cp37-cp37m",
# version: "3.7"
# },
# {
# name: "cp38-cp38",
# version: "3.8"
# },
# {
# name: "cp39-cp39",
# version: "3.9"
# },
{
name: "cp310-cp310",
version: "3.10"
},
]
rust: [stable]
platform: [
{
os: "ubuntu-20.04",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
name: "Ubuntu 20.04"
},
{
os: "ubuntu-latest",
python-architecture: "x64",
rust-target: "x86_64-unknown-linux-gnu",
name: "Ubuntu Latest"
},
{
os: "macos-13",
python-architecture: "x64",
rust-target: "aarch64-apple-darwin",
name: "macOS arm64"
},
{
os: "macos-13",
python-architecture: "x64",
rust-target: "x86_64-apple-darwin",
name: "macOS x64"
},
# {
# os: "windows-latest",
# python-architecture: "x86",
# rust-target: "i686-pc-windows-msvc",
# name: "Windows x86"
# },
{
os: "windows-latest",
python-architecture: "x64",
rust-target: "x86_64-pc-windows-msvc",
name: "Windows x64"
},
]
fail-fast: false
env:
CARGO_BUILD_TARGET: ${{ matrix.platform.rust-target }}
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-${{ matrix.platform.python-architecture }}-cargo-${{ matrix.rust }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ runner.os }}-${{ matrix.platform.python-architecture }}-cargo-${{ matrix.rust }}-
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python.version }}
architecture: ${{ matrix.platform.python-architecture }}
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.platform.rust-target }}
default: true
profile: minimal
override: true
- name: Install CLang
uses: KyleMayes/install-llvm-action@v1
with:
version: "15.0"
directory: ${{ runner.temp }}/llvm
- name: Set LIBCLANG_PATH
run: echo "LIBCLANG_PATH=$((gcm clang).source -replace "clang.exe")" >> ${GITHUB_ENV}
if: runner.os == 'Windows'
- name: Install dependencies
run: pip install maturin pygithub
- name: Build package Linux
env:
PY_VERSION: ${{ matrix.python.name }}
run: cd oxen && maturin build --out dist --release --interpreter ${PY_LOCATION}/bin/python
if: runner.os == 'Linux'
- name: Build package macOS x86
env:
PY_LOCATION: ${{ env.pythonLocation }}
CXXFLAGS: "-fno-aligned-allocation"
CPLUS_INCLUDE_PATH: ${{ runner.temp }}/llvm/include/c++/v1/
run: cd oxen && maturin build --out dist --release --interpreter ${PY_LOCATION}/bin/python
if: matrix.platform.rust-target == 'x86_64-apple-darwin'
- name: Build package macOS arm64
env:
PY_LOCATION: ${{ env.pythonLocation }}
run: cd oxen && maturin build --out dist --release --interpreter ${PY_LOCATION}/bin/python
if: matrix.platform.rust-target == 'aarch64-apple-darwin'
- name: Build package Windows
env:
PY_LOCATION: ${{ env.pythonLocation }}
run: cd oxen && maturin build --out dist --release --interpreter ${env:PY_LOCATION}\python.exe
if: runner.os == 'Windows'
- name: Build Ubuntu 20.04
env:
PY_LOCATION: ${{ env.pythonLocation }}
# This one does not have --sdist because we do it in Ubuntu Latest
run: cd oxen && maturin build --release --out dist --interpreter ${PY_LOCATION}/bin/python
if: matrix.platform.name == 'Ubuntu 20.04'
- name: Build linux package sdist
env:
PY_LOCATION: ${{ env.pythonLocation }}
# This packages up the source with --sdist
run: cd oxen && maturin build --release --out dist --sdist --interpreter ${PY_LOCATION}/bin/python
if: matrix.platform.name == 'Ubuntu Latest'
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: oxen/dist
# sdist:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Build sdist
# uses: PyO3/maturin-action@v1
# with:
# command: sdist
# args: --out dist
# working-directory: oxen
# - name: Upload sdist
# uses: actions/upload-artifact@v3
# with:
# name: wheels
# path: dist
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build]
steps:
- name: Set env
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/v}" >> $GITHUB_ENV
- uses: actions/download-artifact@v3
id: download
with:
name: wheels
- name: Publish to PyPI
uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
with:
command: upload
args: --skip-existing *
- name: List downloaded wheels
run: echo ${{steps.download.outputs.download-path}} && ls -R ${{steps.download.outputs.download-path}}
- name: Create tarball with wheels
run: tar -czvf wheels.tar.gz ${{steps.download.outputs.download-path}}
- name: Upload wheels to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: wheels.tar.gz
asset_name: wheels.tar.gz
tag: ${{ github.ref }}
release_name: "🐍 Release ${{ github.ref }}"