-
Notifications
You must be signed in to change notification settings - Fork 38
199 lines (194 loc) · 6.14 KB
/
ci.yml
File metadata and controls
199 lines (194 loc) · 6.14 KB
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
name: CI
env:
DEBUG: napi:*
APP_NAME: ngrok
MACOSX_DEPLOYMENT_TARGET: '10.13'
on:
push:
branches:
- 'main'
tags-ignore:
- '**'
paths-ignore:
- '**/*.md'
- LICENSE
- '**/*.gitignore'
- .editorconfig
- docs/**
pull_request: null
jobs:
udeps:
name: Udeps
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jrobsonchase/direnv-action@v0.7
- uses: ./.github/workflows/rust-cache
- name: Run Udeps
run: |
cargo udeps --workspace --all-targets --all-features
fmt:
name: Rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jrobsonchase/direnv-action@v0.7
- name: Run Rustfmt
run: |
cargo fmt --all -- --check
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jrobsonchase/direnv-action@v0.7
- uses: ./.github/workflows/rust-cache
- name: Run Clippy
run: |
cargo clippy --all-targets --all-features --workspace
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: jrobsonchase/direnv-action@v0.7
- uses: ./.github/workflows/rust-cache
- name: Run Tests
run: |
NGROK_AUTHTOKEN=${{ secrets.NGROK_AUTHTOKEN }} make mypy
NGROK_AUTHTOKEN=${{ secrets.NGROK_AUTHTOKEN }} make testfast
decide:
name: Decide on Publishing
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Decide
id: decide
run: |
echo "github.ref: ${{ github.ref }}"
echo "github.repository: ${{ github.repository }}"
echo "git log:"
git log -1 --pretty=%B
if [ '${{ github.ref }}' == 'refs/heads/main' ] && [ '${{ github.repository }}' == 'ngrok/ngrok-python' ] && git log -1 --pretty=%B | grep "^Release [0-9]\+\.[0-9]\+\.[0-9]\+$"; then
echo "SHOULD_PUBLISH=true" >> $GITHUB_OUTPUT
else
echo "SHOULD_PUBLISH=false" >> $GITHUB_OUTPUT
fi
cat $GITHUB_OUTPUT
outputs:
publish: ${{ steps.decide.outputs.SHOULD_PUBLISH }}
build:
needs:
- clippy
- decide
- fmt
- test
- udeps
uses: ./.github/workflows/build.yml
secrets: inherit
with:
docker: ${{ matrix.settings.docker }}
host: ${{ matrix.settings.host }}
if: true
publish: ${{ needs.decide.outputs.publish }}
setup: ${{ matrix.settings.setup }}
target: ${{ matrix.settings.target }}
strategy:
fail-fast: false
matrix:
settings:
# MACOS
- host: macos-latest
target: aarch64-apple-darwin
- host: macos-latest
target: universal2-apple-darwin
- host: macos-latest
target: x86_64-apple-darwin
# LINUX
- host: ubuntu-latest
target: aarch64-unknown-linux-gnu
docker: ghcr.io/rust-cross/manylinux2014-cross:aarch64
- host: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
docker: alpine:3.21
- host: ubuntu-latest
target: armv7-unknown-linux-gnueabihf
docker: ghcr.io/rust-cross/manylinux2014-cross:armv7
- host: ubuntu-latest
target: x86_64-unknown-linux-gnu
- host: ubuntu-latest
target: x86_64-unknown-linux-musl
docker: alpine:3.21
# WINDOWS
- host: windows-latest
target: aarch64-pc-windows-msvc
- host: windows-latest
target: i686-pc-windows-msvc
- host: windows-latest
target: x86_64-pc-windows-msvc
build-freebsd:
needs: decide
runs-on: ubuntu-22.04
name: Build FreeBSD
timeout-minutes: 20
continue-on-error: true
steps:
- name: Run lscpu
run: lscpu
- uses: actions/checkout@v4
- name: Build
id: build
uses: vmactions/freebsd-vm@v1
env:
RUSTUP_HOME: /usr/local/rustup
CARGO_HOME: /usr/local/cargo
RUSTUP_IO_THREADS: 1
SHOULD_PUBLISH: ${{ needs.decide.outputs.publish }}
with:
envs: RUSTUP_HOME CARGO_HOME RUSTUP_IO_THREADS SHOULD_PUBLISH
usesh: true
mem: 3000
prepare: |
pkg install -y -f curl libnghttp2 python3 cmake llvm
alias curl="curl --retry 5 --retry-all-errors"
curl https://sh.rustup.rs -sSf --output rustup.sh
sh rustup.sh -y --profile minimal --default-toolchain beta
export PATH="/usr/local/cargo/bin:$PATH"
run: |
export PATH="/usr/local/cargo/bin:$PATH"
python3 -m venv .env
. .env/bin/activate && pip install -r requirements.txt
if [ "${SHOULD_PUBLISH}" == 'true' ]; then
echo "~~~~ maturin just building since pypi doesn't support BSD wheels"
# https://discuss.python.org/t/pypi-org-unsupported-platform-tag-openbsd-7-0-amd64/16302
# . .env/bin/activate && maturin publish --no-sdist -u __token__ -p ${{ secrets.MATURIN_PASSWORD }}
. .env/bin/activate && maturin build
else
echo "~~~~ maturin building"
. .env/bin/activate && maturin build
fi
# make the rsync back faster
rm -rf .env/ target/debug/ target/release/
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: bindings-freebsd
path: target/wheels/*.whl
if-no-files-found: error
tag:
if: ${{ github.ref == 'refs/heads/main' && needs.decide.outputs.publish == true }}
needs:
- decide
- build
runs-on: ubuntu-latest
name: Tag Release
steps:
- uses: actions/checkout@v4
- uses: jrobsonchase/direnv-action@v0.7
- name: Tag
run: |
version="$(extract-crate-version ngrok-python)"
git config user.name "GitHub Action"
git config user.email noreply@ngrok.com
git tag -a -m "Version ${version}" v${version}
git push --tags