-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (59 loc) · 2.5 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
name: CI
on:
pull_request:
push:
tags:
- 'v*'
branches:
- main
env:
CARGO_TERM_COLOR: always
jobs:
lint:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo clippy --workspace --all-targets --all-features -- --deny warnings --allow unknown_lints
- run: cargo fmt --all --check
test:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo test --workspace --all-targets --all-features
cross-build:
runs-on: ubuntu-24.04
permissions:
contents: write
env:
# see https://woodruffw.github.io/zizmor/audits/#template-injection
REF_NAME: ${{ github.ref_name }}
# renovate: datasource=crate depName=cross versioning=semver
CROSS_VERSION: 0.2.5
TARGET_ARCH: aarch64-unknown-linux-gnu
RUSTFLAGS: "-D warnings"
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: Swatinem/rust-cache@f0deed1e0edfc6a9be95417288c0e1099b1eeec3 # v2.7.7
with:
save-if: ${{ github.ref == 'refs/heads/main' }}
- run: cargo install cross --vers ${CROSS_VERSION}
- run: cross build --release --target=${TARGET_ARCH}
- run: cp target/${TARGET_ARCH}/release/clubfridge-neo clubfridge-neo
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
- run: tar czf clubfridge-neo-${REF_NAME}-${TARGET_ARCH}.tar.gz clubfridge-neo
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
- uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
if: startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/main'
with:
name: clubfridge-neo-${{ env.REF_NAME }}-${{ env.TARGET_ARCH }}.tar.gz
path: clubfridge-neo-${{ env.REF_NAME }}-${{ env.TARGET_ARCH }}.tar.gz
- uses: softprops/action-gh-release@c95fe1489396fe8a9eb87c0abf8aa5b2ef267fda # v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: clubfridge-neo-${{ env.REF_NAME }}-${{ env.TARGET_ARCH }}.tar.gz