Unify cross-build workflows using a matrix

This commit is contained in:
George Hilliard committed 2020-12-10 12:49:38 -06:00
1 parent afdb0f495c
commit 61e9baab53
2 files changed
+52 -120

No files matched your search

+42 -120
View File
@@ -3,7 +3,7 @@ name: CI
on: [push, pull_request]
jobs:
builds:
native:
name: build
runs-on: ${{ matrix.os }}
strategy:
@@ -55,143 +55,65 @@ jobs:
with:
name: release-${{ matrix.os }}
path: "target/release/neolink*"
armhfbuild:
name: build-armhf
cross:
name: cross
runs-on: ubuntu-latest
container: "node:current-buster-slim"
steps:
- uses: actions/checkout@v2
- name: Install basic tools
run: |
apt-get update
apt-get install --assume-yes --no-install-recommends sudo curl ca-certificates build-essential
- name: Add armhf as a foreign architecture
run: |
sudo dpkg --add-architecture armhf
- name: Install cross compile tools
run: |
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends gcc-arm-linux-gnueabihf
- name: Install armhf gstreamer
run: |
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends \
libgstrtspserver-1.0-dev:armhf \
libgstreamer1.0-dev:armhf \
libgtk2.0-dev:armhf
- name: Install rustup armv7
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
strategy:
fail-fast: false
matrix:
# Everyone has a slightly different screwball naming scheme;
# Rust uses the target triple, GCC generally targets a family
# with a specific prefix, and dpkg's arch does its own thing
include:
- arch: armhf
target: armv7-unknown-linux-gnueabihf
- name: Build armfh
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target=armv7-unknown-linux-gnueabihf
env:
CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABIHF_LINKER: arm-linux-gnueabihf-gcc
CC_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-gcc
CXX_armv7_unknown_linux_gnueabihf: arm-linux-gnueabihf-g++
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig/
PKG_CONFIG_LIBDIR: /usr/lib/arm-linux-gnueabihf/pkgconfig:/usr/share/pkgconfig/
- uses: actions/upload-artifact@v2
with:
name: release-armhf-buster
path: "target/armv7-unknown-linux-gnueabihf/release/neolink*"
arm64build:
name: build-arm64
runs-on: ubuntu-latest
container: "node:current-buster-slim"
steps:
- uses: actions/checkout@v2
- name: Install basic tools
run: |
apt-get update
apt-get install --assume-yes --no-install-recommends sudo curl ca-certificates build-essential
- name: Add arm64 as a foreign architecture
run: |
sudo dpkg --add-architecture arm64
- name: Install cross compile tools
run: |
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends gcc-aarch64-linux-gnu
- name: Install arm64 gstreamer
run: |
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends \
libgstrtspserver-1.0-dev:arm64 \
libgstreamer1.0-dev:arm64 \
libgtk2.0-dev:arm64
- name: Install rustup arm64
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
gcc: arm-linux-gnueabihf
pkgconfig: arm-linux-gnueabihf
- arch: arm64
target: aarch64-unknown-linux-gnu
- name: Build arm64
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target=aarch64-unknown-linux-gnu
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc
CC_aarch64_unknown_linux_gnu: aarch64-linux-gnu-gcc
CXX_aarch64_unknown_linux_gnu: aarch64-linux-gnu-g++
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig/
PKG_CONFIG_LIBDIR: /usr/lib/aarch64-linux-gnu/pkgconfig:/usr/share/pkgconfig/
- uses: actions/upload-artifact@v2
with:
name: release-arm64-buster
path: "target/aarch64-unknown-linux-gnu/release/neolink*"
i386build:
name: build-i386
runs-on: ubuntu-latest
container: "node:current-buster-slim"
gcc: aarch64-linux-gnu
pkgconfig: aarch64-linux-gnu
- arch: i386
target: i686-unknown-linux-gnu
gcc: i686-linux-gnu
# on i686, the pkgconfig path doesn't match the prefix!
pkgconfig: i386-linux-gnu
steps:
- uses: actions/checkout@v2
- name: Install basic tools
run: |
apt-get update
apt-get install --assume-yes --no-install-recommends sudo curl ca-certificates build-essential
- name: Add arm64 as a foreign architecture
apt-get install --assume-yes --no-install-recommends curl ca-certificates
- name: Install ${{ matrix.arch }} cross compiler and gstreamer
id: setup
run: |
sudo dpkg --add-architecture i386
- name: Install cross compile tools
run: |
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends gcc-i686-linux-gnu
- name: Install i386 gstreamer
run: |
sudo apt-get update
sudo apt-get install --assume-yes --no-install-recommends \
libgstrtspserver-1.0-dev:i386 \
libgstreamer1.0-dev:i386 \
libgtk2.0-dev:i386
- name: Install rustup i386
dpkg --add-architecture ${{ matrix.arch }}
apt-get update
apt-get install --assume-yes --no-install-recommends \
build-essential \
gcc-${{ matrix.gcc }} \
libgstrtspserver-1.0-dev:${{ matrix.arch }} \
libgstreamer1.0-dev:${{ matrix.arch }} \
libgtk2.0-dev:${{ matrix.arch }} \
libglib2.0-dev:${{ matrix.arch }}
- name: Install ${{ matrix.arch }} Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
target: i686-unknown-linux-gnu
- name: Build i386
target: ${{ matrix.target }}
profile: minimal
- name: Build
uses: actions-rs/cargo@v1
with:
command: build
args: --release --all-features --target=i686-unknown-linux-gnu
args: --release --all-features --target=${{ matrix.target }}
env:
CARGO_TARGET_I686_UNKNOWN_LINUX_GNU_LINKER: i686-linux-gnu-gcc
CC_i686_unknown_linux_gnu: i686-linux-gnu-gcc
CXX_i686_unknown_linux_gnu: i686-linux-gnu-g++
# Retarget pkg-config as described in https://www.freedesktop.org/wiki/Software/pkg-config/CrossCompileProposal/
PKG_CONFIG_ALLOW_CROSS: 1
PKG_CONFIG_PATH: /usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig/
PKG_CONFIG_LIBDIR: /usr/lib/i386-linux-gnu/pkgconfig:/usr/share/pkgconfig/
PKG_CONFIG_LIBDIR: /usr/lib/${{ matrix.pkgconfig }}/pkgconfig
- uses: actions/upload-artifact@v2
with:
name: release-i386-buster
path: "target/i686-unknown-linux-gnu/release/neolink*"
name: release-${{ matrix.arch }}-buster
path: "target/${{ matrix.target }}/release/neolink*"