-
-
Notifications
You must be signed in to change notification settings - Fork 11
390 lines (351 loc) · 13.8 KB
/
testing_changes.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
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
# Based on:
# - https://github.com/actions-rs/example/blob/master/.github/workflows/quickstart.yml
#
# Using:
# - https://github.com/actions-rs/toolchain -> https://github.com/marketplace/actions/rust-toolchain
# - https://github.com/actions-rs/cargo -> https://github.com/marketplace/actions/rust-cargo
#
# TODO:
# - Run tests in arm little-endian architecture (travis-ci?)
# - Test cross compilation to many arch (E.g ripgrep)
# - cargo tarpaulin does not work on windows
# - cargo tarpaulin does not work on macos
# - cargo test fails with linking on macos
on:
push:
paths-ignore:
- ".github/workflows/**"
pull_request:
types: [opened, reopened, synchronize, ready_for_review, labeled]
name: testing_changes
jobs:
run-guard:
# other jobs depend on this one using 'needs: run-guard' to avoid running when it is skipped.
# it succeeds if any of the following conditions are met:
# - it is not a pr-labeling event AND the pr is not labeled 'prevent-ci' AND it is not a draft pr
# - it is not a pr-labeling event AND the pr is labeled 'force-ci'
# - it is a pr-labeling event AND the label being added is 'force-ci'
#
# on success it dumps the action's 'github' context
runs-on: ubuntu-latest
name: "run-guard"
if: |
(
(github.event.action != 'labeled')
&& !contains( github.event.pull_request.labels.*.name, 'prevent-ci')
&& !github.event.pull_request.draft
)
|| ( (github.event.action != 'labeled') && contains( github.event.pull_request.labels.*.name, 'force-ci' ) )
|| (github.event.label.name == 'force-ci')
steps:
- name: continue
run: echo not skipping CI. continuing now...
linting:
name: linting
runs-on: ubuntu-latest
needs: run-guard
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
default: true
override: true
components: rustfmt, clippy
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: check
args: --verbose
- name: Run cargo clippy
uses: actions-rs/clippy-check@v1
continue-on-error: true # show all errors
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- name: Run cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
testing:
name: testing
needs: linting
strategy:
fail-fast: false
matrix:
os: ["ubuntu-20.04", "windows-latest", "macos-latest"]
firebird: [v3, v2, v4, v5]
build: [linking, dynamic_loading, pure_rust]
exclude:
- os: "windows-latest"
firebird: v2
- os: "windows-latest"
firebird: v3
- os: "windows-latest"
firebird: v4
- os: "macos-latest"
firebird: v2
- os: "macos-latest"
firebird: v4
- os: "macos-latest"
firebird: v5
- os: "ubuntu-20.04"
firebird: v5
- os: "macos-latest"
build: dynamic_loading
include:
- os: "ubuntu-20.04"
plataform: linux
- os: "windows-latest"
plataform: windows
- os: "macos-latest"
plataform: macos
- firebird: v2
image: "2.5-ss"
- firebird: v3
image: "3.0"
- firebird: v4
image: "4.0"
- firebird: v5
image: "5.0"
- build: linking
features: linking
features_diesel: linking
- build: dynamic_loading
features: dynamic_loading
features_diesel: dynamic_loading
- build: pure_rust
features: pure_rust
features_diesel: pure_rust
runs-on: "${{ matrix.os }}"
steps:
- name: Setup FirebirdSQL ${{ matrix.firebird }} with image ${{ matrix.image }} on docker
if: matrix.plataform == 'linux'
uses: juarezr/[email protected]
with:
version: "${{ matrix.image }}"
firebird_database: "test.fdb"
firebird_user: "test_user"
firebird_password: "test_password"
isc_password: "masterkey"
- name: Setup FirebirdSQL ${{ matrix.firebird }} on Windows
if: matrix.plataform == 'windows'
run: |
choco install firebird -params '/SuperClassic'
- name: Setup FirebirdSQL ${{ matrix.firebird }} on MacOSX
if: matrix.plataform == 'macos'
shell: bash
run: |
wget https://github.com/FirebirdSQL/firebird/releases/download/R3_0_6/Firebird-3.0.6-33328-x86_64.pkg -O /tmp/firebird.pkg
sudo installer -verbose -pkg /tmp/firebird.pkg -target /
sudo mkdir -p /usr/local/lib
sudo ln -s /Library/Frameworks/Firebird.framework/Versions/A/Libraries/libfbclient.dylib /usr/local/lib/libfbclient.dylib
- name: Locating fbclient.lib Dir on Windows
if: matrix.plataform == 'windows'
shell: powershell
run: |
function Search-Common-Folders() {
param (
[string]$FileName
)
$WinSysDir = [Environment]::SystemDirectory
$CommonDirs = @(
"C:\Program Files\Firebird",
"C:\Firebird",
"${WinSysDir}"
)
Foreach ($folder in $CommonDirs) {
echo "# Finding relevant files in FirebirdSQL install:"
$found = Get-ChildItem -File -Recurse -Path $folder -Include $FileName -ea 0
Foreach ($source in $found) {
echo " - $source"
}
}
}
Search-Common-Folders -FileName "fbclient.dll"
Search-Common-Folders -FileName "fbclient.lib"
Search-Common-Folders -FileName "fbclient_ms.lib"
Search-Common-Folders -FileName "isql.exe"
- name: Checkout sources
uses: actions/checkout@v2
- name: Create a alias to test.fdb on fb v2
if: matrix.firebird == 'v2'
run: |
docker exec firebirdsql /bin/bash '/usr/local/firebird/bin/createAliasDB.sh' 'test.fdb' '/firebird/data/test.fdb'
docker container restart firebirdsql
echo '# Restarted container firebirdsql'
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
default: true
- name: Install cli and development library on Linux
if: matrix.plataform == 'linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends firebird3.0-utils firebird-dev
- name: Create database test.fdb in fb ${{ matrix.firebird }} on Windows
if: matrix.plataform == 'windows'
run: |
echo "CREATE DATABASE 'localhost:test.fdb';" | & "C:\Program Files\Firebird\Firebird_5_0\isql.exe" -bail -quiet -z -user SYSDBA -password masterkey
- name: Create database test.fdb in fb ${{ matrix.firebird }} on MacOSX
if: matrix.plataform == 'macos'
run: |
echo "CREATE DATABASE 'localhost:test.fdb';" | /Library/Frameworks/Firebird.framework/Resources/bin/isql -bail -quiet -z -user SYSDBA -password masterkey
- name: Testing Connection and Query on Linux
if: matrix.firebird != 'v4' && matrix.plataform == 'linux'
run: |
SQL1='select RDB$CHARACTER_SET_NAME as charset_sysdba from rdb$database;'
echo $SQL1 | isql-fb -bail -quiet -z -user SYSDBA -password masterkey 'localhost:/firebird/data/test.fdb'
- name: Testing Connection for User test_user on fb v3
if: matrix.firebird == 'v3' && matrix.plataform == 'linux'
run: |
SQL2='select RDB$CHARACTER_SET_NAME as charset_user from rdb$database;'
echo $SQL2 | isql-fb -bail -quiet -z -user test_user -password test_password 'localhost:test.fdb'
- name: Run cargo build
uses: actions-rs/cargo@v1
with:
command: build
args: -v --no-default-features --features '${{ matrix.features }}'
# Searching for fbclient.lib in rsfbclient-native/build.rs
- name: Run cargo test on rsfbclient
uses: actions-rs/cargo@v1
if: matrix.plataform != 'macos' || matrix.build != 'linking'
with:
command: test
args: --no-default-features --features '${{ matrix.features }}' -- --test-threads 1
- name: Run cargo test on rsfbclient-rust
uses: actions-rs/cargo@v1
if: matrix.plataform != 'macos' || matrix.build != 'linking'
with:
command: test
args: -p rsfbclient-rust
- name: Run cargo test on rsfbclient-diesel
uses: actions-rs/cargo@v1
if: matrix.plataform != 'macos' || matrix.build != 'linking'
with:
command: test
args: --manifest-path rsfbclient-diesel/Cargo.toml --no-default-features --features '${{ matrix.features_diesel }}' -- --test-threads 1
- name: Run cargo-tarpaulin on rsfbclient
uses: actions-rs/[email protected]
if: matrix.plataform == 'linux'
# TODO: #[error]The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 101: error: no such subcommand: `tarpaulin`
with:
version: "0.22.0"
run-types: "AllTargets"
out-type: "Lcov"
args: -v --line --count --branch --no-default-features --features '${{ matrix.features }}' -- --test-threads 1
- name: Coveralls Parallel on rsfbclient
uses: coverallsapp/github-action@master
if: matrix.plataform == 'linux'
env:
COVERALLS_FLAG_NAME: run-${{ matrix.firebird }}-${{ matrix.build }}-rsfbclient
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./lcov.info"
parallel: true
# flag-name: run-${{ matrix.firebird }}-${{ matrix.build }}
- name: Run cargo-tarpaulin on rsfbclient-rust
uses: actions-rs/[email protected]
if: matrix.plataform == 'linux'
# TODO: #[error]The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 101: error: no such subcommand: `tarpaulin`
with:
version: "0.22.0"
run-types: "AllTargets"
out-type: "Lcov"
args: -v --line --count --branch -p rsfbclient-rust
- name: Coveralls Parallel on rsfbclient-rust
uses: coverallsapp/github-action@master
if: matrix.plataform == 'linux'
env:
COVERALLS_FLAG_NAME: run-${{ matrix.firebird }}-${{ matrix.build }}-rsfbclient-rust
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./lcov.info"
parallel: true
# flag-name: run-${{ matrix.firebird }}-${{ matrix.build }}
- name: Run cargo-tarpaulin on rsfbclient-diesel
uses: actions-rs/[email protected]
if: matrix.plataform == 'linux'
# TODO: #[error]The process 'C:\Rust\.cargo\bin\cargo.exe' failed with exit code 101: error: no such subcommand: `tarpaulin`
with:
version: "0.22.0"
run-types: "AllTargets"
out-type: "Lcov"
args: -v --line --count --branch --manifest-path rsfbclient-diesel/Cargo.toml --no-default-features --features '${{ matrix.features_diesel }}' -- --test-threads 1
- name: Coveralls Parallel on rsfbclient-diesel
uses: coverallsapp/github-action@master
if: matrix.plataform == 'linux'
env:
COVERALLS_FLAG_NAME: run-${{ matrix.firebird }}-${{ matrix.build }}-rsfbclient-diesel
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: "./lcov.info"
parallel: true
# flag-name: run-${{ matrix.firebird }}-${{ matrix.build }}
- name: Cleanup docker and coverage
if: matrix.plataform == 'linux'
run: |
docker rm --volumes --force firebirdsql
rm -f ./lcov.info
coverage:
name: coverage
needs: testing
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
embedded:
name: embedded
needs: linting
runs-on: ubuntu-latest
strategy:
matrix:
build: [linking, dynamic_loading]
include:
- build: linking
features: linking embedded_tests
- build: dynamic_loading
features: dynamic_loading embedded_tests
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: stable
default: true
- name: Setup FirebirdSQL 3.0 for embedded tests
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends firebird3.0-utils firebird-dev firebird3.0-server-core
- name: Create database for embedded tests
run: |
echo 'create database "/tmp/embedded_tests.fdb";' | isql-fb -bail -quiet -user SYSDBA
- name: Run cargo embedded tests
uses: actions-rs/cargo@v1
with:
command: test
args: --no-default-features --features '${{ matrix.features }}' -- --test-threads 1
security:
name: security
if: github.ref != 'refs/heads/master'
needs: linting
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@v2
- name: Run security audit
uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
# end of file