-
-
Notifications
You must be signed in to change notification settings - Fork 34
158 lines (146 loc) · 5.24 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
name: CI
on:
push:
branches:
- main
tags:
- "*"
pull_request:
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: windows-latest
rust: stable
args: --exclude macos-certificate-truster
- os: macos-latest
rust: stable
args: --exclude windows-redirector
- os: ubuntu-latest
rust: stable
args: --exclude windows-redirector --exclude macos-certificate-truster
- os: windows-latest
rust: 1.65.0 # MSRV
args: --exclude macos-certificate-truster
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Set up Rust toolchain
run: rustup toolchain install ${{ matrix.rust }} --profile minimal
- uses: actions/setup-python@v4
with:
python-version-file: .github/python-version.txt
- if: runner.os == 'Windows'
# workaround for https://github.com/rust-lang/cargo/issues/9096
run: cargo build --package windows-redirector
- if: runner.os == 'macOS'
run: |
cargo build --package macos-certificate-truster
.github/scripts/build-macos-redirector.sh
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
BUILD_PROVISION_PROFILE_EXTENSION_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_EXTENSION_BASE64 }}
- name: Run "cargo check"
# the action-rs/cargo action adds inline annotations for "cargo check" output
uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72
with:
toolchain: ${{ matrix.rust }}
command: check
args: --workspace --verbose ${{ matrix.args }}
- name: Run "cargo test"
# the action-rs/cargo action adds inline annotations for "cargo test" output
uses: actions-rs/cargo@9e120dd99b0fbad1c065f686657e914e76bd7b72
with:
toolchain: ${{ matrix.rust }}
command: test
args: --workspace --verbose ${{ matrix.args }}
build:
strategy:
matrix:
include:
- os: windows-latest
- os: ubuntu-latest
args: --compatibility manylinux2014 --zig --sdist
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
args: --compatibility manylinux2014 --zig --target aarch64-unknown-linux-gnu
- os: macos-latest
- os: macos-latest
target: aarch64-apple-darwin
args: --target universal2-apple-darwin
runs-on: ${{ matrix.os }}
name: build-wheel (${{ matrix.os }}, ${{ matrix.target || 'x64' }})
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- run: rustup toolchain install stable --profile minimal
- run: rustup default stable
- if: matrix.target
run: rustup target add ${{ matrix.target }}
- run: rustup show
- uses: actions/setup-python@v4
with:
python-version-file: .github/python-version.txt
- name: Install maturin[zig] from PyPI
uses: install-pinned/maturin-with-zig@59341946682d2f69df7150f6941f53e026e344fd
- if: runner.os == 'Windows'
# workaround for https://github.com/rust-lang/cargo/issues/9096
run: cargo build --release --package windows-redirector
- if: runner.os == 'macOS'
run: |
cargo build --release --package macos-certificate-truster
.github/scripts/build-macos-redirector.sh
env:
BUILD_CERTIFICATE_BASE64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
P12_PASSWORD: ${{ secrets.P12_PASSWORD }}
BUILD_PROVISION_PROFILE_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_BASE64 }}
BUILD_PROVISION_PROFILE_EXTENSION_BASE64: ${{ secrets.BUILD_PROVISION_PROFILE_EXTENSION_BASE64 }}
- run: maturin build --release ${{ matrix.args }}
working-directory: ./ffi
- uses: actions/upload-artifact@v3
with:
name: wheels
path: target/wheels
deploy:
uses: mhils/workflows/.github/workflows/python-deploy.yml@main
needs: [test, build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
artifact: wheels
# repository: testpypi
# environment: deploy-testpypi
secrets:
password: ${{ secrets.PYPI_TOKEN }}
check:
if: always()
needs:
- test
- build
uses: mhils/workflows/.github/workflows/alls-green.yml@main
with:
jobs: ${{ toJSON(needs) }}