-
Notifications
You must be signed in to change notification settings - Fork 339
160 lines (136 loc) · 4.26 KB
/
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
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
name: Rust
on:
push:
branches: [ "main" ]
pull_request:
merge_group:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
PROTOC_VERSION: 3.23.4
# FIXME: There are some warnings depending on certain feature flags that
# we need to fix before we can enable this.
# RUSTFLAGS: "-D warnings"
jobs:
checks:
runs-on: ubuntu-latest
name: Run Checks
env:
RUSTFLAGS: -D warnings
steps:
- uses: hecrj/setup-rust-action@v1
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Cargo fmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
- name: Cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets --all-features
- name: Test openssl
shell: bash {0}
run: cargo tree -p libsql-server -i openssl; [ $? = 101 ]
# Disabled because we vendor rusqlite which does not use
# clippy so it warns.
# - name: Clippy
# uses: actions-rs/clippy-check@v1
# with:
# token: ${{ secrets.GITHUB_TOKEN }}
# args: --all-targets --all-features -- -D warnings
features:
name: Check features and unused dependencies
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dtolnay/rust-toolchain@nightly
- uses: taiki-e/install-action@cargo-hack
- uses: taiki-e/install-action@cargo-udeps
- uses: Swatinem/rust-cache@v2
- run: cargo +nightly hack udeps -p libsql --each-feature
test:
runs-on: ubuntu-latest
name: Run Tests
env:
RUSTFLAGS: -D warnings
steps:
- uses: hecrj/setup-rust-action@v1
# needed because we run out of disk space during tests
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: true
- name: Install deps
run: sudo apt update && sudo apt install -y libclang-dev
- name: Install protoc
uses: taiki-e/install-action@v2
with:
tool: protoc@${{ env.PROTOC_VERSION }}
- uses: taiki-e/install-action@v2
with:
tool: nextest
- uses: actions/checkout@v3
- name: Set up cargo cache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Run tests
run: cargo nextest run
# test-rust-wasm:
# runs-on: ubuntu-latest
# name: Run Rust Wasm Tests
# env:
# RUSTFLAGS: -D warnings
# steps:
# - uses: hecrj/setup-rust-action@v1
# with:
# targets: [wasm32-unknown-unknown]
# # needed because we run out of disk space during tests
# - name: Free Disk Space (Ubuntu)
# uses: jlumbroso/free-disk-space@main
# with:
# # this might remove tools that are actually needed,
# # when set to "true" but frees about 6 GB
# tool-cache: true
# - uses: actions/checkout@v3
# - name: Set up cargo cache
# uses: actions/cache@v3
# continue-on-error: false
# with:
# path: |
# ~/.cargo/bin/
# ~/.cargo/registry/index/
# ~/.cargo/registry/cache/
# ~/.cargo/git/db/
# target/
# key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
# restore-keys: ${{ runner.os }}-cargo-
# - name: Run check
# run: cargo check --verbose -p libsql --target wasm32-unknown-unknown --no-default-features --features cloudflare