blob: a0834cb2514d4b571a94f39d64dff09570bdaf04 (
plain)
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
|
# Define the sequence of steps for the CI pipeline
steps:
# Step 1: Run tests and checks (formatting, clippy, build, test)
test-and-check:
image: ubuntu:latest
commands:
# Install dependencies
- apt-get update && apt-get install -y curl git
# Install Rust toolchain
- curl https://sh.rustup.rs -sSf | sh -s -- -y
# Source the cargo environment to make rustup/cargo available
- source "$HOME/.cargo/env"
# Run formatting check
- cargo fmt --all -- --check
# Run clippy linter with warnings as errors
- cargo clippy --jobs 2 -- -D warnings
# Build the project in release mode
- cargo build --verbose --release --jobs 2
# Run tests
- cargo test --verbose --jobs 2
when:
branch: main
event: [ push, pull_request ]
# Step 2: Build for x86_64 architecture
build-x86_64:
image: ubuntu:latest
commands:
# Install dependencies
- apt-get update && apt-get install -y curl git
# Install Rust toolchain
- curl https://sh.rustup.rs -sSf | sh -s -- -y
# Source the cargo environment
- source "$HOME/.cargo/env"
# Add the x86_64 target
- rustup target add x86_64-unknown-linux-gnu
# Build for x86_64 target
- cargo build --target x86_64-unknown-linux-gnu --release --verbose --jobs 2
when:
branch: main
event: [ push, pull_request ]
# Step 3: Build for aarch64 architecture
# build-aarch64:
# image: ubuntu:latest
# commands:
# # Install dependencies including aarch64 cross-compiler
# - apt-get update && apt-get install -y curl git gcc-aarch64-linux-gnu
# # Install Rust toolchain
# - curl https://sh.rustup.rs -sSf | sh -s -- -y
# # Source the cargo environment
# - source "$HOME/.cargo/env"
# # Add the aarch64 target
# - rustup target add aarch64-unknown-linux-gnu
# # Configure the linker for aarch64 target in Cargo config
# - echo '[target.aarch64-unknown-linux-gnu]' >> "$HOME/.cargo/config.toml"
# - echo 'linker = "aarch64-linux-gnu-gcc"' >> "$HOME/.cargo/config.toml"
# # Build for aarch64 target
# - cargo build --target aarch64-unknown-linux-gnu --release --verbose --jobs 2
# when:
# branch: main
# event: [ push, pull_request ]
|