-
Notifications
You must be signed in to change notification settings - Fork 985
128 lines (107 loc) · 3.2 KB
/
test-rust.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
name: Test Rust
on:
push:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/**'
- 'ee/**'
- '!ee/tabby-ui/**'
- '.github/workflows/test-rust.yml'
pull_request:
branches: [ "main" ]
paths:
- 'Cargo.toml'
- 'Cargo.lock'
- 'crates/**'
- 'ee/**'
- '!ee/tabby-ui/**'
- '.github/workflows/test-rust.yml'
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
# If this is enabled it will cancel current running and start latest
cancel-in-progress: true
env:
RUST_TOOLCHAIN: 1.76.0
jobs:
tests:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Sccache cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- name: Cargo registry cache
uses: actions/cache@v3
with:
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-${{ github.sha }}
restore-keys: |
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
cargo-${{ runner.os }}-
path: |
~/.cargo/registry
~/.cargo/git
- run: sudo bash ./ci/prepare_build_environment.sh
- name: Run doc tests
run: cargo test --doc
- name: Run unit tests on community build
run: cargo test --bin tabby --no-default-features
- name: Run unit tests
run: cargo test --bin tabby --lib
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
SCCACHE_GHA_ENABLED: true
RUSTC_WRAPPER: sccache
CARGO_INCREMENTAL: 0
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ env.RUST_TOOLCHAIN }}
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Sccache cache
uses: mozilla-actions/[email protected]
with:
version: "v0.4.0"
- name: Cargo registry cache
uses: actions/cache@v3
with:
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-${{ github.sha }}
restore-keys: |
cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.toml') }}-
cargo-${{ runner.os }}-
path: |
~/.cargo/registry
~/.cargo/git
- run: sudo bash ./ci/prepare_build_environment.sh
- name: Generate code coverage
env:
CI_COVERAGE: 1
run: cargo llvm-cov --bin tabby --lib --lcov --output-path lcov.info
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
with:
files: lcov.info
fail_ci_if_error: true