-
Notifications
You must be signed in to change notification settings - Fork 826
134 lines (115 loc) · 4.19 KB
/
build.yml
File metadata and controls
134 lines (115 loc) · 4.19 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
130
131
132
133
134
---
# Note, this is used in the badge URL!
name: build
"on":
push:
branches: [dev, master]
paths-ignore:
- "**.md"
- "docs/**"
- "contrib/**"
- "LICENSE"
- "*.sh"
- "**/Dockerfile*"
- "test.sh"
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
paths-ignore:
- "**.md"
- "docs/**"
- "contrib/**"
- "LICENSE"
- "*.sh"
- "**/Dockerfile*"
- "test.sh"
schedule:
# Run CI every week
- cron: "00 01 * * 0"
env:
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
GSTREAMER_WIN_PATH: D:\gstreamer
NOT_WINDOWS_FEATURES: alsa-backend,pulseaudio-backend,jackaudio-backend,rodiojack-backend,with-avahi,with-dns-sd
jobs:
test:
name: cargo +${{ matrix.toolchain }} test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
toolchain:
- "1.85" # MSRV (Minimum supported rust version)
- stable
isPR:
- ${{ github.event_name == 'pull_request' }}
isCIWindows:
- ${{ github.event.pull_request && contains(github.event.pull_request.labels.*.name, format('CI{0} Windows', ':')) }}
exclude:
# excludes windows in a PR by default, unless labeled with 'CI: Windows'
- os: 'windows-latest'
isPR: true
isCIWindows: false
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.toolchain }}
- name: Cache Rust dependencies
uses: Swatinem/rust-cache@v2
- name: Install developer package dependencies (Linux)
if: runner.os == 'Linux'
run: >
sudo apt-get update && sudo apt-get install -y
libpulse-dev portaudio19-dev libasound2-dev libsdl2-dev
gstreamer1.0-dev libgstreamer-plugins-base1.0-dev
libavahi-compat-libdnssd-dev
- name: Install developer package dependencies (Windows)
if: runner.os == 'Windows'
run: choco install pkgconfiglite
- name: Cache gstreamer (Windows)
uses: actions/cache@v4
id: cache-gstreamer
if: runner.os == 'Windows'
with:
path: ${{ env.GSTREAMER_WIN_PATH }}
key: gstreamer-Windows-${{ hashFiles('**/Cargo.lock') }}
- name: Install gstreamer (Windows)
if: ${{ runner.os == 'Windows' && !steps.cache-gstreamer.outputs.cache-hit }}
run: choco install gstreamer-devel
- name: Fetch dependencies
run: cargo fetch --locked
- name: Build workspace with examples
run: cargo build --frozen --workspace --examples
- name: Run tests
run: cargo test --workspace
- name: Install cargo-hack
uses: taiki-e/install-action@cargo-hack
- name: Check binary with any tls option
run: >
cargo hack check -p librespot --each-feature
--exclude-no-default-features --exclude-all-features
--include-features native-tls,rustls-tls-native-roots,rustls-tls-webpki-roots
- name: Check binary features (cross-platform)
env:
PKG_CONFIG_PATH: ${{ env.GSTREAMER_WIN_PATH }}\1.0\msvc_x86_64\lib\pkgconfig
run: >
cargo hack check -p librespot --each-feature
--exclude-no-default-features --exclude-all-features --features native-tls
--exclude-features rustls-tls-native-roots,rustls-tls-webpki-roots,${{ env.NOT_WINDOWS_FEATURES }}
- name: Check binary features (linux)
if: runner.os == 'Linux'
run: >
cargo hack check -p librespot --each-feature
--exclude-no-default-features --exclude-all-features --features native-tls
--include-features ${{ env.NOT_WINDOWS_FEATURES }}
- name: Build binary with default features
run: cargo build --frozen
- name: Upload debug artifacts
uses: actions/upload-artifact@v4
with:
name: librespot-${{ matrix.os }}-${{ matrix.toolchain }}
path: >
target/debug/librespot${{ runner.os == 'Windows' && '.exe' || '' }}
if-no-files-found: error