forked from kmesh-net/orion
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (75 loc) · 2.55 KB
/
ci.yml
File metadata and controls
92 lines (75 loc) · 2.55 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
name: CI — fmt, clippy, build, test
on:
push:
branches: [ main, master ]
pull_request:
branches: [ main, master ]
env:
CARGO_CACHE_PATH: ~/.cargo/registry
CARGO_GIT_PATH: ~/.cargo/git
TARGET_DIR: target
jobs:
# Fast checks that run in parallel (no build artifacts needed)
checks:
name: fmt + clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Initialize git submodules
run: git submodule update --init --recursive
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
${{ env.CARGO_CACHE_PATH }}
${{ env.CARGO_GIT_PATH }}
key: ${{ runner.os }}-cargo-checks-${{ hashFiles('**/Cargo.lock', 'envoy-data-plane-api/build.rs') }}
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
profile: minimal
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy (fail on warnings)
run: cargo clippy --all-targets --all-features
- name: Check copyright headers
run: |
#!/bin/bash
set -e
find . -name "*.rs" -type f -path "./orion*" | while read -r file; do
if ! head -1 "$file" | grep -q "Copyright"; then
echo "Missing copyright header in $file"
exit 1
fi
done
# Build and test that share artifacts
build-and-test:
name: build + test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Initialize git submodules
run: git submodule update --init --recursive
- name: Cache cargo
uses: actions/cache@v4
with:
path: |
${{ env.CARGO_CACHE_PATH }}
${{ env.CARGO_GIT_PATH }}
${{ env.TARGET_DIR }}
key: ${{ runner.os }}-cargo-build-${{ hashFiles('**/Cargo.lock', 'envoy-data-plane-api/build.rs') }}
- name: Install protoc
run: sudo apt-get update && sudo apt-get install -y protobuf-compiler
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
- name: Build (release)
run: cargo build --workspace --release --locked
- name: Run tests
run: cargo test --workspace --release --locked