-
Notifications
You must be signed in to change notification settings - Fork 1
65 lines (62 loc) · 1.74 KB
/
build-test.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
---
name: Build and Test
on:
push:
branches: [main]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build-rust:
name: Build Rust binary
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Formatting
run: cargo fmt -- --check
- name: Clippy
run: cargo clippy --release
- name: Compile
run: cargo build --release
- name: Run tests
run: cargo test --release
build-arch-package:
name: Build ArchLinux Package
runs-on: ubuntu-latest
container:
image: archlinux:base-devel
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
path: repo
- name: Install dependencies
# Because we can't run makepkg as root, we also can't install
# packages using `makepkg`'s `-s` flag :(
run: pacman -Syu --noconfirm cargo git
- name: Create build directory
# http://allanmcrae.com/2015/01/replacing-makepkg-asroot/
run: |
useradd -m -d /home/build builder
cp repo/PKGBUILD /home/build/PKGBUILD
- name: Build package
run: sudo -u builder -- makepkg
working-directory: /home/build
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: package
path: "/home/build/*.pkg.tar.zst"