Repository navigation
76 lines (62 loc) · 1.86 KB
/
Copy pathrust.yml
File metadata and controls
76 lines (62 loc) · 1.86 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
name: Rust CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
check:
name: Check
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
run: |
rustup toolchain install stable --profile minimal --component rustfmt --component clippy
rustup default stable
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --workspace -- -D warnings
- name: Run tests
run: cargo test --workspace
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 30
needs: check
strategy:
matrix:
include:
- target: x86_64-unknown-linux-gnu
name: linux-x86_64
# RISC-V cross-compilation would need additional setup
# - target: riscv64gc-unknown-linux-musl
# name: riscv64
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
env:
BUILD_TARGET: ${{ matrix.target }}
run: |
rustup toolchain install stable --profile minimal --target "$BUILD_TARGET"
rustup default stable
- name: Build release
run: cargo build --release --target ${{ matrix.target }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: nanokvm-server-${{ matrix.name }}
path: target/${{ matrix.target }}/release/nanokvm-server
docker:
name: Docker Build
runs-on: ubuntu-latest
timeout-minutes: 30
needs: check
steps:
- uses: actions/checkout@v4
- name: Build Docker image
run: docker build --file ./docker/Dockerfile.rust --tag nanokvm-server:latest .