-
-
Notifications
You must be signed in to change notification settings - Fork 7
195 lines (192 loc) · 7.4 KB
/
build.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
name: Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
features:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
feature:
- server
- client
- embedded
- cli
- server,serde
- client,serde
- tor
- tor,cli
- tor,embedded
- tor,server
steps:
- uses: actions/checkout@v2
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Feature ${{ matrix.feature }}
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --features=${{ matrix.feature }}
- name: Defaults + ${{ matrix.feature }}
uses: actions-rs/cargo@v1
with:
command: check
args: --features=${{ matrix.feature }}
platforms:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-12, windows-2019, windows-2022 ]
steps:
- uses: actions/checkout@v2
- name: Install rust stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Build with no features
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features
- name: Build with defaults
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features
toolchains:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
toolchain: [ nightly, beta, stable, 1.59.0 ]
steps:
- uses: actions/checkout@v2
- name: Install rust ${{ matrix.toolchain }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.toolchain }}
override: true
- name: All features
uses: actions-rs/cargo@v1
with:
command: check
args: --workspace --all-targets --all-features
dependency:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install latest stable
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Create dependency
run: |
cargo new dep_test
cp contrib/depCargo.toml dep_test/Cargo.toml
cd dep_test
- name: Build dependency
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose
- name: Clean up
run: |
cd ..
rm -rf dep_test
android:
runs-on: ubuntu-latest
env:
NDK_VERSION: 20.1.5948944
ANDROID_CLI_ZIP: commandlinetools-linux-6858069_latest.zip
ANDROID_CLI_SHA256: 87f6dcf41d4e642e37ba03cb2e387a542aa0bd73cb689a9e7152aad40a6e7a08
steps:
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: set environment variables
run: |
ANDROID_SDK_ROOT="$GITHUB_WORKSPACE/sdk"
NDK_HOME="$ANDROID_SDK_ROOT/ndk/$NDK_VERSION"
echo "ANDROID_SDK_ROOT=$ANDROID_SDK_ROOT" >> $GITHUB_ENV
echo "NDK_HOME=$NDK_HOME" >> $GITHUB_ENV
echo "PATH=$PATH:$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_ENV
- name: Install NDK
run: |
wget -nv https://dl.google.com/android/repository/$ANDROID_CLI_ZIP
echo "$ANDROID_CLI_SHA256 $ANDROID_CLI_ZIP" > SHA256SUMS
sha256sum -c SHA256SUMS
unzip $ANDROID_CLI_ZIP
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools && mv cmdline-tools $ANDROID_SDK_ROOT/cmdline-tools/3.0
yes 2>/dev/null | $ANDROID_SDK_ROOT/cmdline-tools/3.0/bin/sdkmanager --sdk_root=$ANDROID_SDK_ROOT \
"build-tools;29.0.3" "platforms;android-29" "ndk;$NDK_VERSION" |grep -v '\[='; true
- name: Add rust targets
run: |
rustup target add aarch64-linux-android x86_64-linux-android armv7-linux-androideabi i686-linux-android
- name: Build for aarch64-linux-android
run: |
export CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER="$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang"
export CC="aarch64-linux-android21-clang"
export CFLAGS="--sysroot=$NDK_HOME/sysroot -I$NDK_HOME/sysroot/usr/include -I$NDK_HOME/sysroot/usr/include/aarch64-linux-android"
export CXX="aarch64-linux-android21-clang++"
export CXXFLAGS="$CFLAGS -nostdlib++ -I$NDK_HOME/sources/cxx-stl/llvm-libc++/include"
export LDFLAGS="--sysroot=$NDK_HOME/platforms/android-21/arch-arm64"
cargo check --all-features --target=aarch64-linux-android
- name: Build for x86_64-linux-android
run: |
export CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER="$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/x86_64-linux-android26-clang"
export CC="x86_64-linux-android21-clang"
export CFLAGS="--sysroot=$NDK_HOME/sysroot -I$NDK_HOME/sysroot/usr/include -I$NDK_HOME/sysroot/usr/include/x86_64-linux-android"
export CXX="x86_64-linux-android21-clang++"
export CXXFLAGS="$CFLAGS -nostdlib++ -I$NDK_HOME/sources/cxx-stl/llvm-libc++/include"
export LDFLAGS="--sysroot=$NDK_HOME/platforms/android-21/arch-x86_64"
cargo check --all-features --target=x86_64-linux-android
- name: Build for armv7-linux-androideabi
run: |
export CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER="$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/armv7a-linux-androideabi26-clang"
export CC="armv7a-linux-androideabi21-clang"
export CFLAGS="--sysroot=$NDK_HOME/sysroot -I$NDK_HOME/sysroot/usr/include -I$NDK_HOME/sysroot/usr/include/arm-linux-androideabi"
export CXX="armv7a-linux-androideabi21-clang++"
export CXXFLAGS="$CFLAGS -nostdlib++ -I$NDK_HOME/sources/cxx-stl/llvm-libc++/include"
export LDFLAGS="--sysroot=$NDK_HOME/platforms/android-21/arch-arm -L$NDK_HOME/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a"
cargo check --all-features --target=armv7-linux-androideabi
- name: Build for i686-linux-android
run: |
export CARGO_TARGET_I686_LINUX_ANDROID_LINKER="$NDK_HOME/toolchains/llvm/prebuilt/linux-x86_64/bin/i686-linux-android26-clang"
export CC="i686-linux-android21-clang"
export CFLAGS="--sysroot=$NDK_HOME/sysroot -I$NDK_HOME/sysroot/usr/include -I$NDK_HOME/sysroot/usr/include/i686-linux-android"
export CXX="i686-linux-android21-clang++"
export CXXFLAGS="$CFLAGS -nostdlib++ -I$NDK_HOME/sources/cxx-stl/llvm-libc++/include"
export LDFLAGS="--sysroot=$NDK_HOME/platforms/android-21/arch-x86"
cargo check --all-features --target=i686-linux-android
ios:
runs-on: macos-latest
steps:
- uses: actions/checkout@v2
- name: Install rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
- name: Dependencies and targets
run: |
rustup target add aarch64-apple-ios x86_64-apple-ios
cargo install cargo-lipo
- name: build
uses: actions-rs/cargo@v1
with:
command: lipo
args: --all-features --verbose