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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: CI
on:
push:
branches:
pull_request:
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
jobs:
lint:
name: fmt + clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets -- -D warnings
# Real native builds + a functional smoke-test run of the resulting binary on every
# OS/arch combo GitHub Actions gives us actual hardware or a supported VM for. This is
# not just `cargo check` -- it runs `rcpufetch` for real and asserts it produces output.
native:
name: build + run (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
name: linux-x86_64
- os: macos-latest
name: macos-arm64
- os: macos-13
name: macos-x86_64
- os: windows-latest
name: windows-x86_64
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo build --release --verbose
- run: cargo test --release --verbose
- name: smoke test (fancy)
run: cargo run --release -- --no-logo
- name: smoke test (legacy style, explicit color)
run: cargo run --release -- --no-logo --style legacy
- name: smoke test (--debug exits cleanly)
run: cargo run --release -- --debug
- name: smoke test (--help / --version)
run: |
cargo run --release -- --help
cargo run --release -- --version
# aarch64/ppc64le/riscv64 Linux: cross-compiled AND actually executed under QEMU via
# `cross`, which wires up binfmt_misc + docker reliably on GitHub's ubuntu-latest
# runners (unlike a local podman-machine VM, which does not do this reliably).
cross-linux:
name: cross build + run (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- powerpc64le-unknown-linux-gnu
- riscv64gc-unknown-linux-gnu
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: taiki-e/install-action@cross
- run: cross build --release --target ${{ matrix.target }} --verbose
- name: run under QEMU
run: cross run --release --target ${{ matrix.target }} -- --no-logo --style legacy
# Targets we can only verify compile cleanly (no runnable host/VM in this workflow):
# x86 (32-bit), Windows via GNU toolchain, and BSD architectures other than the ones
# covered by real VMs below.
cross-check-only:
name: cross-compile check (${{ matrix.target }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
target:
- i686-unknown-linux-gnu
- x86_64-unknown-freebsd
- aarch64-unknown-freebsd
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- run: cargo check --target ${{ matrix.target }} --verbose
# Real FreeBSD, in an actual FreeBSD VM (not a Linux container -- BSDs need their own
# kernel, which Docker/Podman containers can't provide since they share the host
# kernel). This is what actually validates src/bsd.rs end-to-end, including the
# upstream gap this port fixes (cpufetch's C version is x86-only on FreeBSD).
freebsd:
name: build + run (FreeBSD VM)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: vmactions/freebsd-vm@v1
with:
usesh: true
prepare: |
pkg install -y curl
curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
run: |
. "$HOME/.cargo/env"
cargo build --release --verbose
./target/release/rcpufetch --no-logo --style legacy
./target/release/rcpufetch --version
# Real OpenBSD, same reasoning as FreeBSD above. rustc has no OpenBSD target shipped
# via rustup, so this installs the OpenBSD package-manager's native rust build inside
# the VM instead of cross-compiling -- the only way to actually validate OpenBSD.
openbsd:
name: build + run (OpenBSD VM)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: vmactions/openbsd-vm@v1
with:
usesh: true
prepare: |
pkg_add rust
run: |
cargo build --release --verbose
./target/release/rcpufetch --no-logo --style legacy
./target/release/rcpufetch --version
# Real Windows container -- not "Windows in Docker" on Linux (WCOW containers require
# a Windows host with matching kernel build; can't run on macOS/Linux podman/docker),
# but the windows-latest runner above already covers a real Windows binary end-to-end.
# This job additionally checks the GNU-toolchain build, which is the one people cross
# compile from Linux/macOS for.
windows-gnu-cross-check:
name: cross-compile check (windows-gnu)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnu
- run: cargo check --target x86_64-pc-windows-gnu --verbose