-
Notifications
You must be signed in to change notification settings - Fork 20
160 lines (123 loc) · 3.95 KB
/
main.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: Main Workflow
on:
push:
branches:
- main
pull_request:
env:
CARGO_TERM_COLOR: always
SURREALDB_VERSION: v1.4.0
jobs:
ci:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install 1.77.0 toolchain
uses: dtolnay/rust-toolchain@1.77.0
with:
components: clippy, rustfmt
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Download SurrealDB
run: curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --version $SURREALDB_VERSION
- name: Run SurrealDB root
run: surreal start --user root --pass root memory &
- name: Run SurrealDB admin
run: surreal start --user admin --pass admin --bind 0.0.0.0:8001 memory &
- name: Run check
run: cargo check --all
- name: Run tests
run: cargo test
- name: Run format
run: |
cargo check --all
cargo fix
- name: Run lint
run: cargo clippy -- -Dwarnings
coverage:
needs: ci
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install 1.77.0 toolchain
uses: dtolnay/rust-toolchain@1.77.0
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Download SurrealDB
run: curl --proto '=https' --tlsv1.2 -sSf https://install.surrealdb.com | sh -s -- --version $SURREALDB_VERSION
- name: Run SurrealDB root
run: surreal start --user root --pass root memory &
- name: Run SurrealDB admin
run: surreal start --user admin --pass admin --bind 0.0.0.0:8001 memory &
- name: Run cargo-tarpaulin
uses: actions-rs/tarpaulin@v0.1
with:
version: "0.22.0"
args: "--engine llvm --target-dir target/tarpaulin --skip-clean"
- name: Upload to codecov.io
uses: codecov/codecov-action@v3
- name: Archive code coverage results
uses: actions/upload-artifact@v1
with:
name: code-coverage-report
path: cobertura.xml
docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install 1.77.0 toolchain
uses: dtolnay/rust-toolchain@1.77.0
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Build documentation
run: cargo doc
cargo-deny:
name: cargo-deny
runs-on: ubuntu-latest
strategy:
matrix:
checks:
- advisories
- bans licenses sources
# Prevent sudden announcement of a new advisory from failing ci:
continue-on-error: ${{ matrix.checks == 'advisories' }}
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
command: check ${{ matrix.checks }}
release:
name: release ${{ matrix.target }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-pc-windows-gnu
archive: zip
- target: x86_64-unknown-linux-musl
archive: tar.gz tar.xz tar.zst
- target: wasm32-wasi
archive: zip
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install 1.77.0 toolchain
uses: dtolnay/rust-toolchain@1.77.0
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Compile and release
uses: rust-build/rust-build.action@v1.4.5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RUSTFLAGS: "--cfg surrealdb_unstable"
RUSTDOCFLAGS: "--cfg surrealdb_unstable"
with:
RUSTTARGET: ${{ matrix.target }}
ARCHIVE_TYPES: ${{ matrix.archive }}
EXTRA_FILES: "readme.md LICENSE"
TOOLCHAIN_VERSION: stable