-
Notifications
You must be signed in to change notification settings - Fork 2
112 lines (108 loc) · 3.5 KB
/
Python.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
name: Build Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
build:
name: Build ${{ matrix.target }}
continue-on-error: ${{ matrix.experimental == 1 }}
strategy:
fail-fast: false
matrix:
include:
- runs-on: macos-13
target: x86_64-apple-darwin
- runs-on: macos-13
target: aarch64-apple-darwin
- runs-on: windows-latest
target: x86_64-pc-windows-msvc
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-gnu
- runs-on: ubuntu-latest
target: x86_64-unknown-linux-musl
- runs-on: ubuntu-latest
target: aarch64-unknown-linux-musl
runs-on: ${{ matrix.runs-on }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.9
architecture: x64
- name: Build wheels
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --profile release-lto --out dist -m Cargo.toml
manylinux: auto
- name: Build wheels (musl)
if: contains(matrix.target, 'musl')
uses: PyO3/maturin-action@v1
with:
target: ${{ matrix.target }}
args: --profile release-lto --out dist -m Cargo.toml
manylinux: musllinux_1_2
- name: Install built wheel
if: "startsWith(matrix.target, 'x86_64')"
run: |
pip install gvmkit-build --no-index --find-links dist --force-reinstall
- name: Upload wheels
uses: actions/upload-artifact@v3
with:
name: wheels
path: dist
- name: "Archive binary"
if: "matrix.runs-on == 'ubuntu-latest'"
run: |
ARCHIVE_FILE=gvmkit-build-${{ matrix.target }}.tar.gz
tar czvf $ARCHIVE_FILE -C target/${{ matrix.target }}/release-lto gvmkit-build
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
- name: "Archive binary"
if: "matrix.runs-on == 'macos-13'"
run: |
ARCHIVE_FILE=gvmkit-build-${{ matrix.target }}.tar.gz
gtar --format=pax -czvf $ARCHIVE_FILE -C target/${{ matrix.target }}/release-lto gvmkit-build
shasum -a 256 $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
- name: "Archive binary"
shell: bash
if: "matrix.runs-on == 'windows-latest'"
run: |
ARCHIVE_FILE=gvmkit-build-${{ matrix.target }}.zip
7z a $ARCHIVE_FILE ./target/${{ matrix.target }}/release-lto/gvmkit-build.exe
sha256sum $ARCHIVE_FILE > $ARCHIVE_FILE.sha256
- name: "Upload binary"
uses: actions/upload-artifact@v3
with:
name: binaries
path: |
*.tar.gz
*.zip
*.sha256
release:
name: Release
runs-on: ubuntu-latest
if: "startsWith(github.ref, 'refs/tags/')"
needs: build
steps:
- uses: actions/download-artifact@v3
with:
name: wheels
- uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Publish to PyPI
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
pip install --upgrade twine
twine upload --skip-existing *
- uses: actions/download-artifact@v3
with:
name: binaries
path: binaries
- name: Release
uses: softprops/action-gh-release@v1
with:
files: binaries/*