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
# Build and test on the three platforms phosphor claims to run on.
#
# There was no CI at all, which is why a Windows build had never been
# attempted and why `HOME` — a variable Windows does not set — had been the
# only way to find the presets directory for as long as there had been one.
# The point of this file is that the question gets answered on every push
# instead of by inspection.
#
# Only first-party actions are used, so there is nothing here to audit but
# the shell commands, and no secrets: everything runs against the checkout.
name: CI
on:
push:
branches:
pull_request:
workflow_dispatch:
# bash on all three runners rather than PowerShell on Windows: one spelling of
# every step, and `-e` so a failure part way through a multi-line block stops
# the job. PowerShell only propagates the *last* native command's exit code.
defaults:
run:
shell: bash
env:
CARGO_TERM_COLOR: always
# A backtrace is the difference between "a test failed on Windows" and
# knowing why, and nobody watching this has a Windows machine to reproduce
# it on.
RUST_BACKTRACE: 1
jobs:
test:
name: test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
# One platform failing should not hide the other two — the whole reason
# for this file is finding out which platforms are broken.
fail-fast: false
matrix:
os:
steps:
- uses: actions/checkout@v4
# cpal and midir both reach ALSA on Linux, and both link against it at
# build time through pkg-config. macOS (CoreAudio/CoreMIDI) and Windows
# (WASAPI/WinMM) need nothing installed.
#
# The rest are for eframe/egui, which phosphor-gui pulls in. That crate
# is a stub, but it still has to compile.
- name: Install Linux audio and windowing headers
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
pkg-config \
libasound2-dev \
libudev-dev \
libxkbcommon-dev \
libwayland-dev \
libgl1-mesa-dev
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --component clippy
rustup default stable
rustc --version
cargo --version
- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ${{ runner.os }}-cargo-
- name: Check
run: cargo check --workspace --all-targets
# No audio device on a runner, and nothing here opens one: every test
# builds its app with audio and MIDI disabled.
- name: Test
run: cargo test --workspace
clippy:
name: clippy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Linux audio and windowing headers
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends \
pkg-config \
libasound2-dev \
libudev-dev \
libxkbcommon-dev \
libwayland-dev \
libgl1-mesa-dev
- name: Install Rust
run: |
rustup toolchain install stable --profile minimal --component clippy
rustup default stable
- name: Cache cargo registry and build
uses: actions/cache@v4
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
target
key: ubuntu-clippy-${{ hashFiles('**/Cargo.lock') }}
restore-keys: ubuntu-clippy-
# Not `-D warnings` yet: the workspace carries about forty existing
# lints, and turning them into errors now would mean this job is red
# from its first run and nobody reads it again. It reports, and the day
# the count reaches zero the flag goes on and this becomes a gate.
- name: Clippy
run: cargo clippy --workspace --all-targets