-
Notifications
You must be signed in to change notification settings - Fork 13
115 lines (95 loc) · 3 KB
/
ci.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
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
112
113
114
115
name: CI
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
CARGO_TERM_COLOR: always
jobs:
test:
name: Test Suite
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
rust: [1.71.0]
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
components: rustfmt, clippy
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- name: Check formatting
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Run tests
run: cargo test --all-features --workspace
build:
name: Build
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
# Linux builds
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: lla-linux-amd64
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: lla-linux-arm64
- os: ubuntu-latest
target: i686-unknown-linux-gnu
artifact_name: lla-linux-i686
# macOS builds
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: lla-macos-amd64
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: lla-macos-arm64
# Windows builds
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: lla-windows-amd64.exe
- os: windows-latest
target: i686-pc-windows-msvc
artifact_name: lla-windows-i686.exe
- os: windows-latest
target: aarch64-pc-windows-msvc
artifact_name: lla-windows-arm64.exe
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: 1.71.0
targets: ${{ matrix.target }}
- name: Install cross-compilation tools
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-i686-linux-gnu
- name: Rust Cache
uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build release
run: cargo build --release --target ${{ matrix.target }}
- name: Prepare binary (Windows)
if: runner.os == 'Windows'
run: |
cp target/${{ matrix.target }}/release/lla.exe ${{ matrix.artifact_name }}
- name: Prepare binary (Unix)
if: runner.os != 'Windows'
run: |
cp target/${{ matrix.target }}/release/lla ${{ matrix.artifact_name }}
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}