-
Notifications
You must be signed in to change notification settings - Fork 2
169 lines (155 loc) · 4.71 KB
/
validation-rust.yaml
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
---
# Main "useful" actions config file
# Cache config comes from https://github.com/actions/cache/blob/main/examples.md#rust---cargo
# actions-rs/toolchain configures rustup
# actions-rs/cargo actually runs cargo
on:
push:
branches:
- main
pull_request:
name: Rust Validation
env:
RUSTDOCFLAGS: -D warnings
RUSTFLAGS: -D warnings -C debuginfo=1
CARGO_REGISTRIES_CRATES_IO_PROTOCOL: sparse
jobs:
check:
name: "Check (cargo clippy)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/[email protected]
with:
components: clippy
- uses: Swatinem/rust-cache@v2
- run: cargo clippy --all-features --all-targets -- -D warnings
- run: cargo clippy --no-default-features --all-targets -- -D warnings
test:
strategy:
fail-fast: true
matrix:
# os: [ubuntu-latest]
include:
- build: linux
os: ubuntu-latest
target: x86_64-unknown-linux-musl
# - build: macos
# os: macos-latest
# target: x86_64-apple-darwin
# extension: ''
- build: windows-msvc
os: windows-latest
target: x86_64-pc-windows-msvc
name: "Test on ${{ matrix.os }} (cargo test)"
runs-on: ${{ matrix.os }}
env:
MYSQLCLIENT_LIB_DIR: C:\mysql\lib
steps:
- uses: actions/checkout@v2
- name: List files
run: |
pwd
ls
- uses: dtolnay/[email protected]
- uses: Swatinem/rust-cache@v2
- run: cargo test
integration:
name: "Integration testing (docker)"
runs-on: ubuntu-latest
needs: [check]
steps:
- uses: actions/checkout@v2
- name: Cache Docker layers
uses: actions/cache@v2
id: cache-docker
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Image
uses: docker/build-push-action@v3
with:
load: true
tags: mdb-example-so:latest
file: Dockerfile
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- # Temp fix
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
- name: Start docker
run: >
docker run --rm -d
-p 12305:3306
-e MARIADB_ROOT_PASSWORD=example
--name mdb-udf-suite-container
mdb-example-so
- uses: dtolnay/rust-toolchain@stable
- name: Run integration testing
# Run only integration tests with `--test '*'`
run: cargo test -p test-integration --test '*' --features backend
- name: Print docker logs
if: always()
run: |
docker logs mdb-udf-suite-container
# If any critical / debug options were printed, error out
docker logs mdb-udf-suite-container 2>&1 | grep -E '\[(Critical|Error)\]' || exit 0 && exit 1;
docker stop mdb-udf-suite-container
miri:
name: Miri
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
with:
components: miri
- uses: Swatinem/rust-cache@v2
- env:
# Can't use chrono for time in isolation
MIRIFLAGS: -Zmiri-disable-isolation
run: cargo miri test
fmt:
name: "Format (cargo fmt)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- uses: actions/setup-python@v3
- name: Validate pre-commit
uses: pre-commit/[email protected]
doc:
name: "Docs (cargo doc)"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dtolnay/rust-toolchain@nightly
- uses: Swatinem/rust-cache@v2
- run: cargo doc
outdated:
name: Outdated
runs-on: ubuntu-latest
if: github.event_name != 'pull_request'
timeout-minutes: 45
steps:
- uses: actions/checkout@v3
- uses: dtolnay/install@cargo-outdated
- run: cargo outdated --workspace --exit-code 1 --ignore lipsum
security_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: rustsec/[email protected]
with:
token: ${{ secrets.GITHUB_TOKEN }}