-
Notifications
You must be signed in to change notification settings - Fork 465
129 lines (127 loc) · 4.35 KB
/
cd.yml
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: Continuous Deployment
on:
push:
branches:
- master
tags:
- 'v*.*.*'
jobs:
build:
name: Building ${{matrix.os}}-${{ matrix.arch }} (${{ matrix.artifact_type }})
runs-on: ${{ matrix.runs_on }}
strategy:
matrix:
os: [macos, linux]
arch: [x86_64, aarch64, armv7]
rust: [stable]
artifact_type: ['slim', 'default', 'full'] # The build strategy will build all types for each OS specified
include:
# Runner configuration
- os: macos
arch: x86_64
runs_on: macos-13
- os: macos
arch: aarch64
runs_on: macos-latest
- os: linux
runs_on: ubuntu-latest
# DBus configuration
- artifact_type: slim
dbus: ''
- artifact_type: default
dbus: dbus_mpris
- artifact_type: full
dbus: dbus_mpris
# Cross Compilation Targets
- os: linux
arch: aarch64
target: aarch64-unknown-linux-gnu
- os: linux
arch: armv7
target: armv7-unknown-linux-gnueabihf
# Audio backend configuration: Linux
- os: linux
artifact_type: slim
audio_backends: alsa_backend
- os: linux
artifact_type: default
audio_backends: alsa_backend,pulseaudio_backend,rodio_backend
- os: linux
artifact_type: full
audio_backends: alsa_backend,pulseaudio_backend,rodio_backend,rodiojack_backend
# Audio backend configuration: macOS
- os: macos
audio_backends: portaudio_backend,rodio_backend
exclude:
- os: macos
artifact_type: 'full'
- os: macos
arch: armv7
steps:
- name: Checking out sources
uses: actions/checkout@v4
- name: Installing needed macOS dependencies
if: matrix.os == 'macos'
run: brew install dbus portaudio
- name: Installing needed Ubuntu dependencies
if: startsWith(matrix.runs_on, 'ubuntu') && matrix.target == ''
run: |
sudo apt-get update
# alsa_backend,rodio_backend and base deps
sudo apt-get install -y libasound2-dev libssl-dev
# potentially install bindgen dependencies
sudo apt-get install -y libclang-dev cmake
# dbus_mpris
sudo apt-get install -y libdbus-1-dev
# pulseaudio_backend
sudo apt-get install -y libpulse-dev
# portaudio_backend
sudo apt-get install -y portaudio19-dev
- name: Determine cargo args
run: |
features="--no-default-features --features ${{ matrix.dbus }},${{ matrix.audio_backends }}"
echo CARGO_ARGS="--locked --release $features" | tee -a "$GITHUB_ENV"
- name: Build (using cargo)
if: matrix.target == ''
run: |
cargo +${{ matrix.rust }} build $CARGO_ARGS
- name: Build (using cross)
if: matrix.target != ''
uses: houseabsolute/actions-rust-cross@v1
with:
cross-version: 49338b1 # currently needed (check again if cross version > 0.2.5)
command: build
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
args: $CARGO_ARGS
- name: Uploading artifacts
uses: actions/upload-artifact@v4
with:
name: spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }}
path: target/${{ matrix.target }}/release/spotifyd
release: # only runs when a version tag is pushed
if: startsWith(github.ref, 'refs/tags/v')
needs: build
runs-on: ubuntu-latest
steps:
- name: Downloading artifacts # download all binaries
uses: actions/download-artifact@v4
- name: Packaging final binary
shell: bash
run: |
for artifact_dir in ./*/
do
pushd $artifact_dir
artifact_name=$(basename $artifact_dir)
tar czvf $artifact_name.tar.gz spotifyd
shasum -a 512 $artifact_name.tar.gz > $artifact_name.sha512
popd
done
- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
files: |
**/*.tar.gz
**/*.sha512
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}