Skip to content

Commit 295ad9c

Browse files
nicokaiserSven Lechner
authored andcommitted
add CD support for armv6 and armv7 (#479)
This PR allows us to move away from Travis and have our CD pipeline available through GitHub. The additions include support for a `full` and `slim` version on the armv7 architecture as well as a `slim` version for the armv6 architecture. A `full` version is missing due to cross-compilation toolchain limitations.
1 parent 9444205 commit 295ad9c

File tree

1 file changed

+73
-7
lines changed

1 file changed

+73
-7
lines changed

.github/workflows/cd.yml

Lines changed: 73 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
runs-on: ${{ matrix.os }}
1212
strategy:
1313
matrix:
14-
build_target: [macos, macos-rodio, linux]
14+
build_target: [macos, macos-rodio, linux, linux-armhf, linux-armv6]
1515
rust: [stable]
1616
artifact_type: ['slim', 'full'] # The build strategy will build both types for each OS specified
1717
include:
@@ -34,22 +34,92 @@ jobs:
3434
artifact_prefix: linux
3535
audio_backend: alsa
3636
target: x86_64-unknown-linux-gnu
37+
- build_target: linux-armhf
38+
os: ubuntu-18.04
39+
artifact_prefix: linux-armhf
40+
audio_backend: alsa
41+
target: arm-unknown-linux-gnueabihf
42+
- build_target: linux-armv6
43+
os: ubuntu-18.04
44+
artifact_prefix: linux-armv6
45+
audio_backend: alsa
46+
target: arm-unknown-linux-gnueabihf
47+
exclude:
48+
- build_target: linux-armv6
49+
artifact_type: 'full' # Raspberry Pi toolchain is too old for dbus/systemd
3750

3851
steps:
3952
- name: Installing Rust toolchain
4053
uses: actions-rs/toolchain@v1
4154
with:
4255
toolchain: ${{ matrix.rust }}
56+
target: ${{ matrix.target }}
4357
override: true
4458
- name: Installing needed macOS dependencies
4559
if: matrix.os == 'macos-latest'
4660
run: brew install awk dbus pkg-config portaudio
4761
- name: Installing needed Ubuntu dependencies
48-
if: matrix.os == 'ubuntu-latest'
62+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-18.04'
4963
run: |
5064
sudo apt-get update
5165
sudo apt-get install -y -qq libasound2-dev libssl-dev libpulse-dev libdbus-1-dev
52-
66+
- name: Installing needed Ubuntu armhf dependencies
67+
if: matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armhf'
68+
run: |
69+
sudo mkdir -p /build/sysroot
70+
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | sudo tee -a /etc/apt/sources.list
71+
sudo apt-get update
72+
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross
73+
sudo apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf
74+
sudo dpkg -x libasound2_*.deb /build/sysroot/
75+
sudo dpkg -x libssl-dev*.deb /build/sysroot/
76+
sudo dpkg -x libssl1.1*.deb /build/sysroot/
77+
sudo dpkg -x libasound2-dev*.deb /build/sysroot/
78+
echo "::set-env name=PKG_CONFIG_ALLOW_CROSS::1"
79+
echo "::set-env name=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"
80+
echo "::set-env name=C_INCLUDE_PATH::/build/sysroot/usr/include"
81+
echo "::set-env name=OPENSSL_LIB_DIR::/build/sysroot/usr/lib/arm-linux-gnueabihf"
82+
echo "::set-env name=OPENSSL_INCLUDE_DIR::/build/sysroot/usr/include/arm-linux-gnueabihf"
83+
- name: Installing needed Ubuntu armv6 dependencies
84+
if: matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armv6'
85+
run: |
86+
sudo mkdir -p /build/sysroot
87+
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | sudo tee -a /etc/apt/sources.list
88+
sudo apt-get update
89+
sudo apt-get install -y -qq git
90+
sudo git -C /build clone --depth=1 https://github.com/raspberrypi/tools.git
91+
sudo apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf
92+
sudo dpkg -x libasound2_*.deb /build/sysroot/
93+
sudo dpkg -x libssl-dev*.deb /build/sysroot/
94+
sudo dpkg -x libssl1.1*.deb /build/sysroot/
95+
sudo dpkg -x libasound2-dev*.deb /build/sysroot/
96+
echo "::add-path::/build/tools/arm-bcm2708/arm-linux-gnueabihf/bin"
97+
echo "::set-env name=PKG_CONFIG_ALLOW_CROSS::1"
98+
echo "::set-env name=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"
99+
echo "::set-env name=C_INCLUDE_PATH::/build/sysroot/usr/include"
100+
echo "::set-env name=OPENSSL_LIB_DIR::/build/sysroot/usr/lib/arm-linux-gnueabihf"
101+
echo "::set-env name=OPENSSL_INCLUDE_DIR::/build/sysroot/usr/include/arm-linux-gnueabihf"
102+
- name: Installing needed Ubuntu armhf dependencies (full)
103+
if: matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armhf' && matrix.artifact_type == 'full'
104+
run: |
105+
# Make dbus-rs cross-compile, see https://github.com/diwic/dbus-rs/issues/184#issuecomment-520228758
106+
sudo apt-get download libdbus-1-dev:armhf libdbus-1-3:armhf libsystemd0:armhf libgcrypt20:armhf liblzma5:armhf liblz4-1:armhf libgpg-error0:armhf
107+
sudo dpkg -x libdbus-1-3*.deb /build/sysroot/
108+
sudo dpkg -x libdbus-1-dev*.deb /build/sysroot/
109+
sudo dpkg -x libsystemd0*.deb /build/sysroot/
110+
sudo dpkg -x libgcrypt20_*.deb /build/sysroot/
111+
sudo dpkg -x liblzma5_*.deb /build/sysroot/
112+
sudo dpkg -x liblz4-1_*.deb /build/sysroot/
113+
sudo dpkg -x libgpg-error0_*.deb /build/sysroot/
114+
sudo cp -r /build/sysroot/lib/* /build/sysroot/usr/lib/
115+
sudo ln -frs /build/sysroot/lib/arm-linux-gnueabihf/libdbus-1.so.3 /build/sysroot/lib/arm-linux-gnueabihf/libdbus-1.so
116+
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libgcrypt.so.20 /build/sysroot/lib/arm-linux-gnueabihf/libgcrypt.so
117+
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libgpg-error.so.0 /build/sysroot/lib/arm-linux-gnueabihf/libgpg-error.so
118+
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/liblzma.so.5 /build/sysroot/lib/arm-linux-gnueabihf/liblzma.so
119+
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libsystemd.so.0 /build/sysroot/lib/arm-linux-gnueabihf/libsystemd.so
120+
sudo ln -rs /build/sysroot/usr/lib/arm-linux-gnueabihf/liblz4.so.1 /build/sysroot/usr/lib/arm-linux-gnueabihf/liblz4.so
121+
sudo mkdir -p /.cargo
122+
echo -e '[target.arm-unknown-linux-gnueabihf.dbus]\nrustc-link-lib = ["dbus-1", "gcrypt", "gpg-error", "lz4", "lzma", "systemd"]' | sudo tee -a /.cargo/config
53123
- name: Checking out sources
54124
uses: actions/checkout@v1
55125
- name: Running cargo build
@@ -58,16 +128,12 @@ jobs:
58128
command: build
59129
toolchain: ${{ matrix.rust }}
60130
args: --locked --release --target ${{ matrix.target }} --no-default-features --features "${{ matrix.feature }},${{ matrix.audio_backend }}_backend"
61-
62131
- name: Packaging final binary
63132
shell: bash
64133
run: |
65134
cd target/${{ matrix.target }}/release
66-
67-
strip spotifyd
68135
tar czvf spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.tar.gz spotifyd
69136
shasum -a 512 spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.tar.gz > spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.sha512
70-
71137
- name: Releasing assets
72138
uses: softprops/action-gh-release@v1
73139
with:

0 commit comments

Comments
 (0)