-
Notifications
You must be signed in to change notification settings - Fork 19
129 lines (104 loc) · 4.61 KB
/
Copy pathrust.yml
File metadata and controls
129 lines (104 loc) · 4.61 KB
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
name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
rust: [stable, nightly]
os: [ubuntu-24.04, windows-2025, macos-14]
type: [Release, Debug]
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal
rustup component add rustfmt --toolchain ${{ matrix.rust }}
rustup component add clippy --toolchain ${{ matrix.rust }}
- name: Install Rust (Android target)
run: rustup target add x86_64-linux-android --toolchain ${{ matrix.rust }}
if: matrix.os == 'ubuntu-24.04'
- name: Install Dependencies (Linux)
run: sudo apt-get update && sudo apt-get install libpulse-dev pulseaudio libdbus-1-dev
if: matrix.os == 'ubuntu-24.04'
- name: Check format
shell: bash
run: rustup run ${{ matrix.rust }} cargo fmt -- --check
- name: Clippy
shell: bash
run: rustup run ${{ matrix.rust }} cargo clippy -- -D warnings
- name: Build
shell: bash
run: rustup run ${{ matrix.rust }} cargo build --all
- name: Build (Android)
shell: bash
run: rustup run ${{ matrix.rust }} cargo build --target x86_64-linux-android --all
if: matrix.os == 'ubuntu-24.04'
- name: Test
shell: bash
# The promotion tests skip themselves on Linux: rtkit is installed (pulled in by
# pulseaudio) but its polkit policy only serves processes in an active session, which a
# runner job is not. The argument-validation and serialization tests still run, and
# --nocapture makes the skip notices visible in the log.
run: rustup run ${{ matrix.rust }} cargo test --all -- --nocapture
# Test on Linux, as if it didn't have DBUS, to exercise the fallback path.
build-fallback:
runs-on: ubuntu-24.04
strategy:
matrix:
rust: [stable, nightly]
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal
rustup component add rustfmt --toolchain ${{ matrix.rust }}
rustup component add clippy --toolchain ${{ matrix.rust }}
- name: Check format
shell: bash
run: rustup run ${{ matrix.rust }} cargo fmt -- --check
- name: Clippy
shell: bash
run: rustup run ${{ matrix.rust }} cargo clippy --no-default-features -- -D warnings
- name: Build fallback (Linux without dbus)
shell: bash
run: rustup run ${{ matrix.rust }} cargo build --no-default-features
- name: Test fallback (Linux without dbus)
shell: bash
# The native (no-dbus) path really promotes threads, so the tests need permission to request
# real-time scheduling. Raise RLIMIT_RTPRIO for this shell, as an admin would via systemd
# LimitRTPRIO or /etc/security/limits.conf; the unprivileged test process and its children
# inherit it. This mirrors a real deployment rather than running the tests as root.
run: |
sudo prlimit --pid $$ --rtprio=10:10
echo "RLIMIT_RTPRIO soft=$(ulimit -Sr) hard=$(ulimit -Hr)"
rustup run ${{ matrix.rust }} cargo test --no-default-features
# musl defines pthread_t as a pointer instead of an integer, unlike glibc.
build-musl:
runs-on: ubuntu-24.04
strategy:
matrix:
rust: [stable, nightly]
steps:
- uses: actions/checkout@v2
- name: Install Rust (musl target)
run: |
rustup toolchain install ${{ matrix.rust }} --profile minimal
rustup target add x86_64-unknown-linux-musl --toolchain ${{ matrix.rust }}
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install libdbus-1-dev
- name: Build (musl, with dbus)
shell: bash
# The crate is a staticlib/rlib, so this doesn't link, and hence needs no musl libdbus: only
# the headers, which pkg-config finds for the host.
run: PKG_CONFIG_ALLOW_CROSS=1 rustup run ${{ matrix.rust }} cargo build --target x86_64-unknown-linux-musl --features dbus
- name: Build (musl, without dbus)
shell: bash
run: rustup run ${{ matrix.rust }} cargo build --target x86_64-unknown-linux-musl --no-default-features
- name: Test (musl, without dbus)
shell: bash
# Statically linked musl test binaries run fine on the glibc runner. As in the fallback job,
# the native promotion path needs permission to request real-time scheduling.
run: |
sudo prlimit --pid $$ --rtprio=10:10
rustup run ${{ matrix.rust }} cargo test --target x86_64-unknown-linux-musl --no-default-features -- --nocapture