Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add CD support for armv6 and armv7 #479

Merged
merged 4 commits into from
Jan 24, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
80 changes: 73 additions & 7 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
build_target: [macos, macos-rodio, linux]
build_target: [macos, macos-rodio, linux, linux-armhf, linux-armv6]
rust: [stable]
artifact_type: ['slim', 'full'] # The build strategy will build both types for each OS specified
include:
Expand All @@ -34,22 +34,92 @@ jobs:
artifact_prefix: linux
audio_backend: alsa
target: x86_64-unknown-linux-gnu
- build_target: linux-armhf
os: ubuntu-18.04
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since "bionic" is needed when adding the Ubuntu Ports source later, this must be hard-coded to ubuntu-18.04.

artifact_prefix: linux-armhf
audio_backend: alsa
target: arm-unknown-linux-gnueabihf
- build_target: linux-armv6
os: ubuntu-18.04
artifact_prefix: linux-armv6
audio_backend: alsa
target: arm-unknown-linux-gnueabihf
exclude:
- build_target: linux-armv6
artifact_type: 'full' # Raspberry Pi toolchain is too old for dbus/systemd

steps:
- name: Installing Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
target: ${{ matrix.target }}
override: true
- name: Installing needed macOS dependencies
if: matrix.os == 'macos-latest'
run: brew install awk dbus pkg-config portaudio
- name: Installing needed Ubuntu dependencies
if: matrix.os == 'ubuntu-latest'
if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-18.04'
run: |
sudo apt-get update
sudo apt-get install -y -qq libasound2-dev libssl-dev libpulse-dev libdbus-1-dev

- name: Installing needed Ubuntu armhf dependencies
if: matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armhf'
run: |
sudo mkdir -p /build/sysroot
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y -qq gcc-arm-linux-gnueabihf libc6-armhf-cross libc6-dev-armhf-cross
sudo apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf
sudo dpkg -x libasound2_*.deb /build/sysroot/
sudo dpkg -x libssl-dev*.deb /build/sysroot/
sudo dpkg -x libssl1.1*.deb /build/sysroot/
sudo dpkg -x libasound2-dev*.deb /build/sysroot/
echo "::set-env name=PKG_CONFIG_ALLOW_CROSS::1"
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"
echo "::set-env name=C_INCLUDE_PATH::/build/sysroot/usr/include"
echo "::set-env name=OPENSSL_LIB_DIR::/build/sysroot/usr/lib/arm-linux-gnueabihf"
echo "::set-env name=OPENSSL_INCLUDE_DIR::/build/sysroot/usr/include/arm-linux-gnueabihf"
- name: Installing needed Ubuntu armv6 dependencies
if: matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armv6'
run: |
sudo mkdir -p /build/sysroot
echo "deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ bionic main" | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install -y -qq git
sudo git -C /build clone --depth=1 https://github.com/raspberrypi/tools.git
sudo apt-get download libasound2:armhf libasound2-dev:armhf libssl-dev:armhf libssl1.1:armhf
sudo dpkg -x libasound2_*.deb /build/sysroot/
sudo dpkg -x libssl-dev*.deb /build/sysroot/
sudo dpkg -x libssl1.1*.deb /build/sysroot/
sudo dpkg -x libasound2-dev*.deb /build/sysroot/
echo "::add-path::/build/tools/arm-bcm2708/arm-linux-gnueabihf/bin"
echo "::set-env name=PKG_CONFIG_ALLOW_CROSS::1"
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"
echo "::set-env name=C_INCLUDE_PATH::/build/sysroot/usr/include"
echo "::set-env name=OPENSSL_LIB_DIR::/build/sysroot/usr/lib/arm-linux-gnueabihf"
echo "::set-env name=OPENSSL_INCLUDE_DIR::/build/sysroot/usr/include/arm-linux-gnueabihf"
- name: Installing needed Ubuntu armhf dependencies (full)
if: matrix.os == 'ubuntu-18.04' && matrix.build_target == 'linux-armhf' && matrix.artifact_type == 'full'
run: |
# Make dbus-rs cross-compile, see https://github.com/diwic/dbus-rs/issues/184#issuecomment-520228758
sudo apt-get download libdbus-1-dev:armhf libdbus-1-3:armhf libsystemd0:armhf libgcrypt20:armhf liblzma5:armhf liblz4-1:armhf libgpg-error0:armhf
sudo dpkg -x libdbus-1-3*.deb /build/sysroot/
sudo dpkg -x libdbus-1-dev*.deb /build/sysroot/
sudo dpkg -x libsystemd0*.deb /build/sysroot/
sudo dpkg -x libgcrypt20_*.deb /build/sysroot/
sudo dpkg -x liblzma5_*.deb /build/sysroot/
sudo dpkg -x liblz4-1_*.deb /build/sysroot/
sudo dpkg -x libgpg-error0_*.deb /build/sysroot/
sudo cp -r /build/sysroot/lib/* /build/sysroot/usr/lib/
sudo ln -frs /build/sysroot/lib/arm-linux-gnueabihf/libdbus-1.so.3 /build/sysroot/lib/arm-linux-gnueabihf/libdbus-1.so
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libgcrypt.so.20 /build/sysroot/lib/arm-linux-gnueabihf/libgcrypt.so
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libgpg-error.so.0 /build/sysroot/lib/arm-linux-gnueabihf/libgpg-error.so
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/liblzma.so.5 /build/sysroot/lib/arm-linux-gnueabihf/liblzma.so
sudo ln -rs /build/sysroot/lib/arm-linux-gnueabihf/libsystemd.so.0 /build/sysroot/lib/arm-linux-gnueabihf/libsystemd.so
sudo ln -rs /build/sysroot/usr/lib/arm-linux-gnueabihf/liblz4.so.1 /build/sysroot/usr/lib/arm-linux-gnueabihf/liblz4.so
sudo mkdir -p /.cargo
echo -e '[target.arm-unknown-linux-gnueabihf.dbus]\nrustc-link-lib = ["dbus-1", "gcrypt", "gpg-error", "lz4", "lzma", "systemd"]' | sudo tee -a /.cargo/config
- name: Checking out sources
uses: actions/checkout@v1
- name: Running cargo build
Expand All @@ -58,16 +128,12 @@ jobs:
command: build
toolchain: ${{ matrix.rust }}
args: --locked --release --target ${{ matrix.target }} --no-default-features --features "${{ matrix.feature }},${{ matrix.audio_backend }}_backend"

- name: Packaging final binary
shell: bash
run: |
cd target/${{ matrix.target }}/release

strip spotifyd
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strip will not recognise cross-compiled binaries, so we cannot always use it (and just assume that Rust creates good-enough ones).

tar czvf spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.tar.gz spotifyd
shasum -a 512 spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.tar.gz > spotifyd-${{ matrix.artifact_prefix }}-${{ matrix.artifact_type }}.sha512

- name: Releasing assets
uses: softprops/action-gh-release@v1
with:
Expand Down