@@ -2,170 +2,126 @@ name: Continuous Deployment
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - master
5
7
tags :
6
8
- ' v*.*.*'
7
9
8
10
jobs :
9
- publish :
10
- name : Publishing ${{ matrix.build_target }}- ${{ matrix.artifact_type }}
11
- runs-on : ${{ matrix.os }}
11
+ build :
12
+ name : Building ${{matrix.os}}-${{ matrix.arch }} ( ${{ matrix.artifact_type }})
13
+ runs-on : ${{ matrix.runs_on }}
12
14
strategy :
13
15
matrix :
14
- build_target : [macos, linux, linux-armhf, linux-armv6]
16
+ os : [macos, linux]
17
+ arch : [x86_64, aarch64, armv7]
15
18
rust : [stable]
16
19
artifact_type : ['slim', 'default', 'full'] # The build strategy will build all types for each OS specified
17
20
include :
18
- - artifact_type : ' slim' # Slim version has no features enabled by default.
19
- feature : ' '
20
- - artifact_type : ' default'
21
- feature : ' dbus_mpris' # Default version has all extra features enabled
22
- - artifact_type : ' full'
23
- feature : ' dbus_mpris' # Full version has all extra features and audio backends enabled
24
- - build_target : macos
25
- os : macos-latest
26
- artifact_prefix : macos
27
- target : x86_64-apple-darwin
28
- - build_target : linux
29
- os : ubuntu-latest
30
- artifact_prefix : linux
31
- target : x86_64-unknown-linux-gnu
32
- - build_target : linux-armhf
33
- os : ubuntu-18.04
34
- artifact_prefix : linux-armhf
35
- target : arm-unknown-linux-gnueabihf
36
- - build_target : linux-armv6
37
- os : ubuntu-18.04
38
- artifact_prefix : linux-armv6
39
- target : arm-unknown-linux-gnueabihf
40
- - build_target : macos
21
+ # Runner configuration
22
+ - os : macos
23
+ arch : x86_64
24
+ runs_on : macos-13
25
+ - os : macos
26
+ arch : aarch64
27
+ runs_on : macos-latest
28
+ - os : linux
29
+ runs_on : ubuntu-latest
30
+ # DBus configuration
31
+ - artifact_type : slim
32
+ dbus : ' '
33
+ - artifact_type : default
34
+ dbus : dbus_mpris
35
+ - artifact_type : full
36
+ dbus : dbus_mpris
37
+ # Cross Compilation Targets
38
+ - os : linux
39
+ arch : aarch64
40
+ target : aarch64-unknown-linux-gnu
41
+ - os : linux
42
+ arch : armv7
43
+ target : armv7-unknown-linux-gnueabihf
44
+ # Audio backend configuration: Linux
45
+ - os : linux
41
46
artifact_type : slim
42
- audio_backend : portaudio_backend
43
- - build_target : linux
44
- artifact_type : slim
45
- audio_backend : pulseaudio_backend
46
- - build_target : linux-armhf
47
- artifact_type : slim
48
- audio_backend : alsa_backend
49
- - build_target : linux-armv6
50
- artifact_type : slim
51
- audio_backend : alsa_backend
52
- - build_target : macos
53
- artifact_type : default
54
- audio_backend : portaudio_backend
55
- - build_target : linux
56
- artifact_type : default
57
- audio_backend : pulseaudio_backend
58
- - build_target : linux-armhf
47
+ audio_backends : alsa_backend
48
+ - os : linux
59
49
artifact_type : default
60
- audio_backend : alsa_backend
61
- - build_target : linux
50
+ audio_backends : alsa_backend,pulseaudio_backend,rodio_backend
51
+ - os : linux
62
52
artifact_type : full
63
- audio_backend : pulseaudio_backend,alsa_backend,rodio_backend
64
- - build_target : macos
65
- artifact_type : full
66
- audio_backend : portaudio_backend,rodio_backend
67
- - build_target : linux-armhf
68
- artifact_type : full
69
- audio_backend : alsa_backend
53
+ audio_backends : alsa_backend,pulseaudio_backend,rodio_backend,rodiojack_backend
54
+ # Audio backend configuration: macOS
55
+ - os : macos
56
+ audio_backends : portaudio_backend,rodio_backend
70
57
exclude :
71
- - build_target : linux-armv6
72
- artifact_type : ' default' # Raspberry Pi toolchain is too old for dbus/systemd
73
- - build_target : linux-armv6
74
- artifact_type : ' full' # Raspberry Pi toolchain is too old for dbus/systemd
75
-
58
+ - os : macos
59
+ artifact_type : ' full'
60
+ - os : macos
61
+ arch : armv7
76
62
steps :
77
- - name : Installing Rust toolchain
78
- uses : actions-rs/toolchain@v1
79
- with :
80
- toolchain : ${{ matrix.rust }}
81
- target : ${{ matrix.target }}
82
- override : true
63
+ - name : Checking out sources
64
+ uses : actions/checkout@v4
83
65
- name : Installing needed macOS dependencies
84
- if : matrix.os == 'macos-latest '
85
- run : brew install awk dbus pkg-config portaudio
66
+ if : matrix.os == 'macos'
67
+ run : brew install dbus portaudio
86
68
- name : Installing needed Ubuntu dependencies
87
- if : matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-18.04 '
69
+ if : startsWith( matrix.runs_on, 'ubuntu') && matrix.target == ''
88
70
run : |
89
71
sudo apt-get update
90
- sudo apt-get install -y -qq libasound2-dev libssl-dev libpulse-dev libdbus-1-dev
91
- - name : Installing needed Ubuntu armhf dependencies
92
- if : matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armhf'
72
+ # alsa_backend,rodio_backend and base deps
73
+ sudo apt-get install -y libasound2-dev libssl-dev libclang-dev clang
74
+ # dbus_mpris
75
+ sudo apt-get install -y libdbus-1-dev
76
+ # pulseaudio_backend
77
+ sudo apt-get install -y libpulse-dev
78
+ # portaudio_backend
79
+ sudo apt-get install -y portaudio19-dev
80
+ - name : Determine cargo args
93
81
run : |
94
- sudo mkdir -p /build/sysroot
95
- echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | sudo tee -a /etc/apt/sources.list
96
- sudo apt-get update
97
- sudo apt-get install -y -qq gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross
98
- sudo apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf
99
- sudo dpkg -x libasound2_*.deb /build/sysroot/
100
- sudo dpkg -x libssl-dev*.deb /build/sysroot/
101
- sudo dpkg -x libssl1.1*.deb /build/sysroot/
102
- sudo dpkg -x libasound2-dev*.deb /build/sysroot/
103
- echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
104
- echo "TEST=abc" >> $GITHUB_ENV
105
- echo "RUSTFLAGS=-C linker=arm-linux-gnueabihf-gcc -L/usr/arm-linux-gnueabihf/lib -L/build/sysroot/usr/lib/arm-linux-gnueabihf -L/build/sysroot/lib/arm-linux-gnueabihf" >> $GITHUB_ENV
106
- echo "C_INCLUDE_PATH=/build/sysroot/usr/include" >> $GITHUB_ENV
107
- echo "OPENSSL_LIB_DIR=/build/sysroot/usr/lib/arm-linux-gnueabihf" >> $GITHUB_ENV
108
- echo "OPENSSL_INCLUDE_DIR=/build/sysroot/usr/include/arm-linux-gnueabihf" >> $GITHUB_ENV
109
- - name : Installing needed Ubuntu armv6 dependencies
110
- if : matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armv6'
111
- run : |
112
- sudo mkdir -p /build/sysroot
113
- echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | sudo tee -a /etc/apt/sources.list
114
- sudo apt-get update
115
- sudo apt-get install -y -qq git
116
- sudo git -C /build clone --depth=1 https://github.com/raspberrypi/tools.git
117
- sudo apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf
118
- sudo dpkg -x libasound2_*.deb /build/sysroot/
119
- sudo dpkg -x libssl-dev*.deb /build/sysroot/
120
- sudo dpkg -x libssl1.1*.deb /build/sysroot/
121
- sudo dpkg -x libasound2-dev*.deb /build/sysroot/
122
- echo "/build/tools/arm-bcm2708/arm-linux-gnueabihf/bin" >> $GITHUB_PATH
123
- echo "PKG_CONFIG_ALLOW_CROSS=1" >> $GITHUB_ENV
124
- echo "TEST=abcd" >> $GITHUB_ENV
125
- echo "RUSTFLAGS=-C linker=/build/tools/arm-bcm2708/arm-linux-gnueabihf/bin/arm-linux-gnueabihf-gcc -L/build/tools/arm-bcm2708/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot/lib -L/build/tools/arm-bcm2708/arm-linux-gnueabihf/arm-linux-gnueabihf/sysroot/usr/lib -L/build/sysroot/usr/lib/arm-linux-gnueabihf -L/build/sysroot/lib/arm-linux-gnueabihf" >> $GITHUB_ENV
126
- echo "C_INCLUDE_PATH=/build/sysroot/usr/include" >> $GITHUB_ENV
127
- echo "OPENSSL_LIB_DIR=/build/sysroot/usr/lib/arm-linux-gnueabihf" >> $GITHUB_ENV
128
- echo "OPENSSL_INCLUDE_DIR=/build/sysroot/usr/include/arm-linux-gnueabihf" >> $GITHUB_ENV
129
- - name : Installing needed Ubuntu armhf dependencies (full)
130
- if : matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armhf' && matrix.artifact_type != 'slim'
82
+ features="--no-default-features --features ${{ matrix.dbus }},${{ matrix.audio_backends }}"
83
+ echo CARGO_ARGS="--locked --release $features" | tee -a "$GITHUB_ENV"
84
+ - name : Build (using cargo)
85
+ if : matrix.target == ''
131
86
run : |
132
- # Make dbus-rs cross-compile, see https://github.com/diwic/dbus-rs/issues/184#issuecomment-520228758
133
- sudo apt-get download libdbus-1-dev:armhf libdbus-1-3:armhf libsystemd0:armhf libgcrypt20:armhf liblzma5:armhf liblz4-1:armhf libgpg-error0:armhf
134
- sudo dpkg -x libdbus-1-3*.deb /build/sysroot/
135
- sudo dpkg -x libdbus-1-dev*.deb /build/sysroot/
136
- sudo dpkg -x libsystemd0*.deb /build/sysroot/
137
- sudo dpkg -x libgcrypt20_*.deb /build/sysroot/
138
- sudo dpkg -x liblzma5_*.deb /build/sysroot/
139
- sudo dpkg -x liblz4-1_*.deb /build/sysroot/
140
- sudo dpkg -x libgpg-error0_*.deb /build/sysroot/
141
- sudo cp -r /build/sysroot/lib/* /build/sysroot/usr/lib/
142
- sudo ln -frs /build/sysroot/lib/arm-linux-gnueabihf/libdbus-1.so.3 /build/sysroot/lib/arm-linux-gnueabihf/libdbus-1.so
143
- sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libgcrypt.so.20 /build/sysroot/lib/arm-linux-gnueabihf/libgcrypt.so
144
- sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libgpg-error.so.0 /build/sysroot/lib/arm-linux-gnueabihf/libgpg-error.so
145
- sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/liblzma.so.5 /build/sysroot/lib/arm-linux-gnueabihf/liblzma.so
146
- sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libsystemd.so.0 /build/sysroot/lib/arm-linux-gnueabihf/libsystemd.so
147
- sudo ln -rs /build/sysroot/usr/lib/arm-linux-gnueabihf/liblz4.so.1 /build/sysroot/usr/lib/arm-linux-gnueabihf/liblz4.so
148
- sudo mkdir -p /.cargo
149
- echo -e '[target.arm-unknown-linux-gnueabihf.dbus]\nrustc-link-lib = ["dbus-1", "gcrypt", "gpg-error", "lz4", "lzma", "systemd"]' | sudo tee -a /.cargo/config
150
- - name : Checking out sources
151
- uses : actions/checkout@v1
152
- - name : Running cargo build
153
- uses : actions-rs/cargo@v1
87
+ cargo +${{ matrix.rust }} build $CARGO_ARGS
88
+ - name : Build (using cross)
89
+ if : matrix.target != ''
90
+ uses : houseabsolute/actions-rust-cross@v1
154
91
with :
92
+ cross-version : 49338b1 # currently needed (check again if cross version > 0.2.5)
155
93
command : build
156
94
toolchain : ${{ matrix.rust }}
157
- args : --locked --release --target ${{ matrix.target }} --no-default-features --features "${{ matrix.feature }},${{ matrix.audio_backend }}"
95
+ target : ${{ matrix.target }}
96
+ args : $CARGO_ARGS
97
+ - name : Uploading artifacts
98
+ uses : actions/upload-artifact@v4
99
+ with :
100
+ name : spotifyd-${{ matrix.os }}-${{ matrix.arch }}-${{ matrix.artifact_type }}
101
+ path : target/${{ matrix.target }}/release/spotifyd
102
+ release : # only runs when a version tag is pushed
103
+ if : startsWith(github.ref, 'refs/tags/v')
104
+ needs : build
105
+ runs-on : ubuntu-latest
106
+ steps :
107
+ - name : Downloading artifacts # download all binaries
108
+ uses : actions/download-artifact@v4
158
109
- name : Packaging final binary
159
110
shell : bash
160
111
run : |
161
- cd target/${{ matrix.target }}/release
162
- tar czvf spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.tar.gz spotifyd
163
- shasum -a 512 spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.tar.gz > spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.sha512
112
+ for artifact_dir in ./*/
113
+ do
114
+ pushd $artifact_dir
115
+ artifact_name=$(basename $artifact_dir)
116
+ tar czvf $artifact_name.tar.gz spotifyd
117
+ shasum -a 512 $artifact_name.tar.gz > $artifact_name.sha512
118
+ popd
119
+ done
164
120
- name : Releasing assets
165
121
uses : softprops/action-gh-release@v1
166
122
with :
167
123
files : |
168
- target/${{ matrix.target }}/release/spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }} .tar.gz
169
- target/${{ matrix.target }}/release/spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }} .sha512
124
+ **/* .tar.gz
125
+ **/* .sha512
170
126
env :
171
127
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments