Skip to content

Commit d08e676

Browse files
committed
Fix CI build failure by adding ALSA dependency and testing feature paths
Previous: The GitHub Actions workflow was building with default features including CPAL, which requires ALSA development headers on Linux. The ubuntu-latest runner lacked libasound2-dev, causing CI builds to fail. Additionally, the production FreeBSD target uses a different build path without CPAL, which wasn't being tested in CI. Changed: Updated .github/workflows/rust.yml to install libasound2-dev before the build step in the existing build job. Added a new build-no-default-features job that tests the no-default-features build path used in FreeBSD production. Both paths are now exercised on every PR. See: changelog/20260503-ci-alsa-dep.md
1 parent d70366a commit d08e676

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

.github/workflows/rust.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,20 @@ jobs:
1616

1717
steps:
1818
- uses: actions/checkout@v4
19+
- name: Install ALSA development headers
20+
run: sudo apt-get update && sudo apt-get install -y libasound2-dev
1921
- name: Build
2022
run: cargo build --verbose
2123
- name: Run tests
2224
run: cargo test --verbose
25+
26+
build-no-default-features:
27+
28+
runs-on: ubuntu-latest
29+
30+
steps:
31+
- uses: actions/checkout@v4
32+
- name: Build (no default features)
33+
run: cargo build --no-default-features --verbose
34+
- name: Run tests (no default features)
35+
run: cargo test --no-default-features --verbose

changelog/20260503-ci-alsa-dep.md

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
---
2+
title: CI build fails: missing ALSA dependency for CPAL
3+
date: 2026-05-03
4+
---
5+
6+
# CI build failure: missing ALSA dev headers
7+
8+
## Task Specification
9+
10+
User reports that the GitHub Actions CI build fails because the runner
11+
doesn't have the ALSA development headers installed. The recent
12+
addition of CPAL (default feature) requires `libasound2-dev` on Linux
13+
to compile.
14+
15+
## Context
16+
17+
- CI workflow: `.github/workflows/rust.yml` runs on `ubuntu-latest`
18+
- Cargo.toml: `cpal = { version = "0.16", optional = true }` is a default feature
19+
- CPAL on Linux links against ALSA, which requires the `libasound2-dev`
20+
package at build time.
21+
- The project's primary target is FreeBSD; Linux CI is just a sanity
22+
check, but we still want it to pass.
23+
24+
## Options Considered
25+
26+
1. Install `libasound2-dev` in the CI workflow before `cargo build`.
27+
2. Disable the `cpal` default feature in CI via `--no-default-features`.
28+
3. Both: install the dep AND add a `--no-default-features` job to keep
29+
that build path tested too.
30+
31+
## Decision
32+
33+
User selected option 3: install ALSA for the main job AND add a second
34+
job that builds with `--no-default-features`.
35+
36+
Rationale: CPAL is the default feature for Linux developers, but the
37+
production target is FreeBSD which uses the no-CPAL build path. Both
38+
paths should be exercised on every PR. Keeping the existing job named
39+
`build` preserves any branch-protection check that pins to the job
40+
name; the new job is `build-no-default-features`.
41+
42+
## Files Modified
43+
44+
- `.github/workflows/rust.yml`: added `libasound2-dev` install step to
45+
the existing `build` job; added a new `build-no-default-features`
46+
job that runs `cargo build` and `cargo test` with
47+
`--no-default-features` (no ALSA needed).
48+
49+
## Current Status
50+
51+
Done. Awaiting user to commit and push to verify CI passes.
52+

0 commit comments

Comments
 (0)