-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (92 loc) · 2.7 KB
/
rust.yml
File metadata and controls
111 lines (92 loc) · 2.7 KB
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
name: Rust Projects CI
on:
push:
branches: [ main ]
paths:
- 'asap-query-engine/**'
- 'asap-common/dependencies/rs/**'
- 'asap-common/tests/**'
- 'asap-common/sketch-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/rust.yml'
pull_request:
branches: [ main ]
paths:
- 'asap-query-engine/**'
- 'asap-common/dependencies/rs/**'
- 'asap-common/tests/**'
- 'asap-common/sketch-core/**'
- 'Cargo.toml'
- 'Cargo.lock'
- '.github/workflows/rust.yml'
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
format-and-lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
components: rustfmt, clippy
- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace --all-targets --all-features --locked -- -D warnings
env:
RUSTC_WRAPPER: sccache
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Install protoc
run: |
sudo apt-get update
sudo apt-get install -y protobuf-compiler
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.4
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock', '**/Cargo.toml') }}
- name: Run all workspace tests
run: cargo test --workspace --locked
env:
RUSTC_WRAPPER: sccache
docker:
runs-on: ubuntu-latest
needs: [format-and-lint, test]
steps:
- uses: actions/checkout@v4
# - name: Configure git for private dependencies
# run: git config --global url."https://x-access-token:${{ secrets.PRIVATE_REPO_TOKEN }}@github.com/".insteadOf "https://github.com/"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build Docker image
run: docker build -f asap-query-engine/Dockerfile -t sketchdb-queryengine-rust:latest .