-
Notifications
You must be signed in to change notification settings - Fork 4
123 lines (115 loc) · 3.4 KB
/
python.yaml
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
name: python
on: [push, pull_request, workflow_dispatch]
jobs:
build_wheels:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64
- os: macos-latest
target: x86_64
- os: macos-latest
target: aarch64
steps:
- name: checkout
uses: actions/checkout@v4
with:
submodules: true
- name: symlink gfortran (macOS)
if: (runner.os == 'macOS') && (matrix.target == 'aarch64')
run: |
arch -arm64 /usr/local/bin/brew install gcc@12
ln -s /opt/homebrew/bin/gfortran-12 /usr/local/bin/gfortran
gfortran --version
- name: symlink gfortran (macOS)
if: (runner.os == 'macOS') && (matrix.target == 'x86_64')
run: |
ln -s /usr/local/bin/gfortran-12 /usr/local/bin/gfortran
gfortran --version
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: x64
- name: build wheel
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --release --out dist
manylinux: auto
sccache: true
- name: delocate wheel (macOS)
if: runner.os == 'macOS'
run: |
pip install delocate
delocate-wheel --require-archs ${{ matrix.target }} -v dist/*.whl
- name: install built wheel
if: ${{ matrix.target == 'x86_64' }}
run: |
pip install optik --no-index --find-links dist
python -c "import optik"
- name: upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: 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 --manifest-path crates/optik-py/Cargo.toml
- name: upload sdist
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
prerelease:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-latest
concurrency:
group: push-${{ github.ref_name }}-prerelease
cancel-in-progress: true
needs: [build_wheels, sdist]
steps:
- uses: dev-drprasad/[email protected]
with:
tag_name: prerelease
delete_release: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/download-artifact@v3
with:
name: wheels
path: wheels
- name: GitHub release
uses: ncipollo/[email protected]
with:
prerelease: true
tag: "prerelease"
name: "Development Build"
allowUpdates: true
removeArtifacts: true
replacesArtifacts: true
artifacts: "wheels/*"
public:
name: publish to PyPI
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: [build_wheels, sdist]
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: PyO3/maturin-action@v1
env:
MATURIN_PYPI_TOKEN: ${{ secrets.PYPI_API_TOKEN }}
MATURIN_REPOSITORY: testpypi
with:
command: upload
args: --non-interactive --skip-existing *