-
Notifications
You must be signed in to change notification settings - Fork 5
79 lines (65 loc) · 2.4 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
name: ci
on:
pull_request:
push:
branches:
- "main"
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
RUST_BACKTRACE: full
RUSTFLAGS: "-C link-arg=-fuse-ld=lld -D warnings"
GH_USER: ${{ github.repository_owner }}
GH_TOKEN: ${{ secrets.GH_PRIVATE_TOKEN }}
jobs:
check_and_test:
name: "check and test"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Cargo files
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
save-always: true
- name: Prepare build env
run: |
git config --global credential.helper store
git config --global --replace-all url.https://github.com/.insteadOf ssh://[email protected]/
git config --global --add url.https://github.com/.insteadOf [email protected]:
mkdir ~/.cargo && echo "[net]\ngit-fetch-with-cli = true" > ~/.cargo/config.toml
(echo url=https://github.com; echo "username=${GH_USER}"; echo "password=${GH_TOKEN}"; echo ) | git credential approve
sudo apt-get install -y lld librdkafka-dev libsasl2-dev
- name: Install Cargo-sweep
uses: baptiste0928/cargo-install@v2
with:
crate: cargo-sweep
- name: Cache build artifacts
id: cache-build-artifacts
uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4
with:
path: target/
key: ${{ runner.os }}-build-artifacts-${{ hashFiles('**/Cargo.lock') }}
# Clean up build artifacts older than 5 days
- name: Sweep Cargo build artifacts
if: steps.cache-build-artifacts.outputs.cache-hit == 'true'
run: cargo sweep --time 5
- run: cargo fmt --all -- --check
- run: cargo check
- run: cargo clippy -- -D warnings
- name: Unit tests
run: cargo test --lib
- name: Integration tests
run: cargo test --test '*'