-
Notifications
You must be signed in to change notification settings - Fork 59
221 lines (212 loc) · 8.01 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
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
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
name: CI
on:
push:
branches: [master]
pull_request:
branches: [master]
schedule:
- cron: '00 13 */4 * *'
env:
RUST_BACKTRACE: 1
RUSTUP_MAX_RETRIES: 10
CARGO_NET_RETRY: 10
SCCACHE_VER: "v0.7.7"
SCCACHE_REGION: "auto"
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- name: i686-pc-windows-msvc (stable)
os: windows-2019
rust: stable
target: i686-pc-windows-msvc
platform: x86
- name: x86_64-pc-windows-msvc (stable)
os: windows-2019
rust: stable
target: x86_64-pc-windows-msvc
platform: x64
- name: x86_64-pc-windows-msvc (beta)
os: windows-2019
rust: beta
target: x86_64-pc-windows-msvc
platform: x64
- name: x86_64-unknown-linux-gnu (stable)
os: ubuntu-20.04
rust: stable
target: x86_64-unknown-linux-gnu
- name: x86_64-unknown-linux-gnu (beta)
os: ubuntu-20.04
rust: beta
target: x86_64-unknown-linux-gnu
- name: x86_64-apple-darwin (stable)
os: macos-13
rust: stable
target: x86_64-apple-darwin
- name: x86_64-apple-darwin (beta)
os: macos-13
rust: beta
target: x86_64-apple-darwin
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
# We need to disable the existing toolchain to avoid updating rust-docs
# which takes a long time. The fastest way to do this is to rename the
# existing folder, as deleting it takes about as much time as not doing
# anything and just updating rust-docs.
- name: Rename existing rust toolchain (Windows)
if: matrix.os == 'windows-2019'
run: Rename-Item C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc C:\Users\runneradmin\.rustup\toolchains\stable-x86_64-pc-windows-msvc.old
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
target: ${{ matrix.target }}
override: true
components: rustfmt
default: true
- uses: actions/setup-python@v5
with:
python-version: '3.7.8'
architecture: ${{ matrix.platform || 'x64' }}
- uses: jwlawson/actions-setup-cmake@v1.4
if: matrix.os != 'windows-2019'
with:
cmake-version: '3.9.6'
github-api-token: ${{ secrets.GITHUB_TOKEN }}
# visual studio 16 2019 not supported until cmake 3.14
- uses: jwlawson/actions-setup-cmake@v1.4
if: matrix.os == 'windows-2019'
with:
cmake-version: '3.14.7'
github-api-token: ${{ secrets.GITHUB_TOKEN }}
- name: Choose boost version (not ubuntu)
if: matrix.os != 'ubuntu-20.04'
run: |
echo 'BOOST_VER=1.66.0' >> $GITHUB_ENV
shell: bash
# gcc (ubuntu) + boost has problem with may be uninitialized field in optional
# https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80635
# use the lastest boost to work around this bug
- name: Choose boost version (ubuntu)
if: matrix.os == 'ubuntu-20.04'
run: |
echo 'BOOST_VER=1.73.0' >> $GITHUB_ENV
shell: bash
- name: Install boost
run: |
set -e
export BOOST_VER_NAME=`echo $BOOST_VER | sed 's/\./_/g'`
export TAR="boost_$BOOST_VER_NAME.tar.gz"
curl -L -o $TAR https://boostorg.jfrog.io/artifactory/main/release/$BOOST_VER/source/$TAR
tar --exclude more --exclude tools --exclude doc --exclude html --exclude test -xzvf $TAR
echo "BOOST_ROOT=$PWD/boost_$BOOST_VER_NAME" >> $GITHUB_ENV
shell: bash
- name: Install valgrind for linux
if: matrix.os == 'ubuntu-20.04'
run: sudo apt-get -y update && sudo apt-get install -y valgrind
- name: Install llvm tools on Windows
if: matrix.os == 'windows-2019'
run: |
set -e
curl https://releases.llvm.org/5.0.2/LLVM-5.0.2-win64.exe -o llvm-installer.exe
7z x llvm-installer.exe -oc:\\llvm-binary
echo "LIBCLANG_PATH=C:\\llvm-binary\\bin" >> $GITHUB_ENV
echo "c:\\llvm-binary\\bin" >> $GITHUB_PATH
shell: bash
- name: install sccache (macos)
if: matrix.os == 'macos-13'
run: |
set -e
brew install sccache
echo "SCCACHE_BUCKET=flapigenamd64macos" >> $GITHUB_ENV
shell: bash
- name: install sccache (windows 64bit)
if: matrix.os == 'windows-2019'
run: |
set -e
curl -L https://github.com/mozilla/sccache/releases/download/$SCCACHE_VER/sccache-$SCCACHE_VER-x86_64-pc-windows-msvc.tar.gz -o sccache.tar.gz
7z x sccache.tar.gz
7z x sccache.tar
echo "`pwd`/sccache-$SCCACHE_VER-x86_64-pc-windows-msvc" >> $GITHUB_PATH
echo "SCCACHE_BUCKET=flapigenamd64win" >> $GITHUB_ENV
shell: bash
- name: install sccache (linux)
if: matrix.os == 'ubuntu-20.04'
run: |
set -e
curl -L https://github.com/mozilla/sccache/releases/download/$SCCACHE_VER/sccache-$SCCACHE_VER-x86_64-unknown-linux-musl.tar.gz -o sccache.tar.gz
tar -xzvf sccache.tar.gz
chmod 755 "./sccache-$SCCACHE_VER-x86_64-unknown-linux-musl/sccache"
echo "`pwd`/sccache-$SCCACHE_VER-x86_64-unknown-linux-musl" >> $GITHUB_PATH
echo "SCCACHE_BUCKET=flapigenamd64ubuntu" >> $GITHUB_ENV
shell: bash
- name: Setup platform variable (for windows build)
run: |
echo "platform=$platform" >> $GITHUB_ENV
shell: bash
env:
platform: ${{ matrix.platform }}
- name: install JDK for 32bit
if: matrix.target == 'i686-pc-windows-msvc'
uses: actions/setup-java@v1
with:
java-version: '8'
java-package: jdk
architecture: x86
- name: Check versions
run: |
set -e
rustc --print cfg
clang --version
rustc --version
cargo --version
cmake --version
javac -version
python --version
sccache --version
echo "end of versions checking"
shell: bash
- name: Run tests
run: |
set -e
cd $GITHUB_WORKSPACE
cp workspace.Cargo.toml Cargo.toml
python -c "fin = open('Cargo.toml', 'r'); res = fin.read().replace('debug = true', '').replace('incremental = true', ''); fin.close(); fout = open('Cargo.toml', 'w'); fout.write(res + '\n'); fout.close();"
test -z "$SCCACHE_ENDPOINT" || export RUSTC_WRAPPER=`which sccache`
echo "SCCACHE_BUCKET: $SCCACHE_BUCKET"
test -z "$SCCACHE_ENDPOINT" || sccache --start-server
python ci_build_and_test.py --skip-android-tests
test -z "$SCCACHE_ENDPOINT" || sccache -s
shell: bash
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S_AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S_AWS_SECRET_ACCESS_KEY }}
SCCACHE_ENDPOINT: ${{ secrets.S_SCCACHE_ENDPOINT }}
CARGO_BUILD_TARGET: ${{ matrix.target }}
doc_tests:
name: Docs (Detect cases where documentation links don't resolve and such)
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
profile: minimal
# Docs.rs uses nightly, which allows for easier syntax for linking to functions.
toolchain: nightly
override: true
- name: cargo rustdoc
run: |
set -e
rustc --version
cargo --version
cd $GITHUB_WORKSPACE/macroslib
# Need to use `cargo rustdoc` to actually get it to respect -D
# warnings... Note: this also requires nightly.
cargo rustdoc -- -D warnings
echo "doc testing done"