-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (54 loc) · 1.62 KB
/
build.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
name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
CARGO_TERM_COLOR: always
jobs:
rustfmt:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@nightly
with:
components: rustfmt
- name: Check formatting
run: cargo fmt --all --check
build:
runs-on: self-hosted
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: "build-cache"
- name: cargo build without flags
run: cargo build
- name: cargo check warnings
run: RUSTFLAGS="-D warnings" cargo check
- name: Run tests
run: |
# Compile tests
echo "Compiling tests..."
cargo test --no-run
# Get binary path
BINARY_PATH=$(cargo test --no-run 2>&1 | grep -oP "target/debug/deps/TeeService-[a-z0-9]+(?!\.d)" | head -n1)
# Debug output
echo "Found binary path: $BINARY_PATH"
# Check if binary was found
if [ -n "$BINARY_PATH" ]; then
echo "Running binary with sudo..."
# Run binary with sudo
sudo ./"$BINARY_PATH"
# else output error
else
echo "Error: Binary not found in cargo output"
exit 1
fi