-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
206 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,200 @@ | ||
name: zlib-ng+crossbuild+package+release | ||
on: | ||
- workflow_dispatch | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
name: [zlib-ng] | ||
os_id: [debian, ubuntu] | ||
os_version_id: [stretch, buster, bullseye, bionic, focal] | ||
arch: [amd64, armhf, arm64] | ||
zlib_compat: ["", "-D ZLIB_COMPAT=ON"] | ||
include: | ||
- arch: amd64 | ||
CHOST: "x86_64-linux-gnu" | ||
docker_arch: amd64 | ||
docker_platform: linux/amd64 | ||
- arch: armhf | ||
CHOST: "arm-linux-gnueabihf" | ||
docker_arch: arm32v7 | ||
docker_platform: linux/arm/v7 | ||
- arch: arm64 | ||
CHOST: "aarch64-linux-gnu" | ||
docker_arch: arm64v8 | ||
docker_platform: linux/arm64/v8 | ||
- zlib_compat: "" | ||
pretty_name: v2 | ||
- zlib_compat: "-D ZLIB_COMPAT=ON" | ||
pretty_name: v1 | ||
exclude: | ||
- os_id: debian | ||
os_version_id: bionic | ||
- os_id: debian | ||
os_version_id: focal | ||
- os_id: ubuntu | ||
os_version_id: stretch | ||
- os_id: ubuntu | ||
os_version_id: buster | ||
- os_id: ubuntu | ||
os_version_id: bullseye | ||
|
||
name: ${{ matrix.arch }} ${{ matrix.os_id }}:${{ matrix.os_version_id }} ${{ matrix.name }} ${{ matrix.pretty_name }} | ||
env: | ||
CHOST: "${{ matrix.CHOST }}" | ||
CC: "${{ matrix.CHOST }}-gcc" | ||
AR: "${{ matrix.CHOST }}-ar" | ||
CXX: "${{ matrix.CHOST }}-g++" | ||
opt_dir_name: "opt/swizzin_apps" | ||
install_prefix: "/root/build/opt/${{ matrix.name }}" | ||
|
||
prerelease: false | ||
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Host - update | ||
run: sudo apt-get update | ||
|
||
- name: Host - upgrade | ||
run: sudo apt-get -y upgrade | ||
|
||
- name: Host - Install host qemu-static | ||
run: sudo apt-get install -y qemu binfmt-support qemu-user-static | ||
|
||
- name: Host - Docker multiarch bootstrap | ||
run: sudo docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
|
||
- name: Host - Create Docker template env file | ||
run: | | ||
echo "PATH=/${{ env.opt_dir_name }}/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" > env.custom | ||
echo "LD_LIBRARY_PATH=/${{ env.opt_dir_name }}/lib:/usr/lib/${{ env.CHOST }}:/usr/lib:/usr/local/lib" >> env.custom | ||
- name: Host - Create docker multiarch ${{ matrix.arch }} container | ||
run: docker run --name multiarch -it -d --env-file env.custom -w /root -e 'LANG=en_US.UTF-8' -e 'DEBIAN_FRONTEND=noninteractive' -e CHOST=${{ env.CHOST }} -e CC=${{ env.CC }} -e AR=${{ env.AR }} -e CXX=${{ env.CXX }} -v ${{ github.workspace }}:/root ${{ matrix.os_id }}:${{ matrix.os_version_id }} | ||
|
||
- name: Host - Create docker binary_test ${{ matrix.arch }} container | ||
run: docker run --name binary_test -it -d --env-file env.custom -w /root -e 'LANG=en_US.UTF-8' -e 'DEBIAN_FRONTEND=noninteractive' --platform ${{ matrix.docker_platform }} -v ${{ github.workspace }}:/root ${{ matrix.docker_arch }}/${{ matrix.os_id }}:${{ matrix.os_version_id }} | ||
|
||
- name: Docker target - fix Ubuntu sources | ||
if: | | ||
matrix.os_id == 'ubuntu' && matrix.arch != 'amd64' | ||
run: | | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports ${{ matrix.os_version_id }} main restricted universe multiverse" > sources.list' | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports ${{ matrix.os_version_id }}-updates main restricted universe multiverse" >> sources.list' | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=${{ matrix.arch }}] http://ports.ubuntu.com/ubuntu-ports ${{ matrix.os_version_id }}-security main restricted universe multiverse" >> sources.list' | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${{ matrix.os_version_id }} main restricted universe multiverse" >> sources.list' | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${{ matrix.os_version_id }}-updates main restricted universe multiverse" >> sources.list' | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=amd64] http://archive.ubuntu.com/ubuntu/ ${{ matrix.os_version_id }}-backports restricted universe multiverse" >> sources.list' | ||
docker exec --env-file env.custom -w /etc/apt/ multiarch bash -c 'echo "deb [arch=amd64] http://security.ubuntu.com/ubuntu/ ${{ matrix.os_version_id }}-security main restricted universe multiverse" >> sources.list' | ||
- name: Docker target - dpkg configure arch | ||
run: docker exec --env-file env.custom multiarch dpkg --add-architecture ${{ matrix.arch }} | ||
|
||
- name: Docker target - Run apt-get update | ||
run: | | ||
docker exec --env-file env.custom multiarch apt-get update | ||
docker exec --env-file env.custom binary_test apt-get update | ||
- name: Docker target - Run apt-get upgrade | ||
run: | | ||
docker exec --env-file env.custom multiarch apt-get upgrade -y | ||
docker exec --env-file env.custom binary_test apt-get upgrade -y | ||
- name: Docker target - apt-get install the core build dependencies | ||
run: | | ||
docker exec --env-file env.custom multiarch apt-get install -y build-essential curl pkg-config automake libtool git perl python3 python3-dev unzip ccache | ||
docker exec --env-file env.custom binary_test apt-get install -y openssl binutils | ||
- name: Docker target - apt-get install crossbuild-essential | ||
if: matrix.arch != 'amd64' | ||
run: docker exec --env-file env.custom multiarch apt-get install -y crossbuild-essential-${{ matrix.arch }} | ||
|
||
- name: Docker target - apt-get install cross target deps | ||
run: | | ||
docker exec --env-file env.custom multiarch apt-get install -y libssl-dev:${{ matrix.arch }} re2c:${{ matrix.arch }} libstdc++-*-dev:${{ matrix.arch }} | ||
- name: Docker target - bionic - apt-get install gcc-8-base g++-8 | ||
if: matrix.arch == 'amd64' && matrix.os_version_id == 'bionic' | ||
run: docker exec --env-file env.custom multiarch apt-get install -y gcc-8 g++-8 | ||
|
||
- name: Docker target - bionic - apt-get install gcc-8 g++-8 cross | ||
if: matrix.arch != 'amd64' && matrix.os_version_id == 'bionic' | ||
run: docker exec --env-file env.custom multiarch apt-get install -y cpp-8-${{ matrix.CHOST }} g++-8-${{ matrix.CHOST }} gcc-8-${{ matrix.CHOST }} | ||
|
||
- name: Docker target - bionic - reconfigure build vars | ||
if: matrix.os_version_id == 'bionic' | ||
run: | | ||
echo "CC=${{ env.CC }}-8" >> env.custom | ||
echo "AR=${{ env.AR }}-8" >> env.custom | ||
echo "CXX=${{ env.CXX }}-8" >> env.custom | ||
- name: Docker target - cmake download and install | ||
run: | | ||
docker exec --env-file env.custom multiarch curl -sNL "https://github.com/userdocs/cmake_crossbuild/releases/latest/download/${{ matrix.os_id }}-${{ matrix.os_version_id }}-cmake-${{ matrix.arch }}.deb" -o ${{ matrix.os_id }}-${{ matrix.os_version_id }}-cmake-${{ matrix.arch }}.deb | ||
docker exec --env-file env.custom multiarch dpkg -i ${{ matrix.os_id }}-${{ matrix.os_version_id }}-cmake-${{ matrix.arch }}.deb | ||
- name: Docker target - Git clone ${{ matrix.name }} develop | ||
run: docker exec --env-file env.custom -w /root multiarch git clone --single-branch --branch develop --shallow-submodules --recurse-submodules --depth 1 https://github.com/zlib-ng/zlib-ng.git /root/${{ matrix.name }} | ||
|
||
- name: Docker target - Cmake ${{ matrix.name }} | ||
run: | | ||
docker exec --env-file env.custom -w /root/${{ matrix.name }} multiarch cmake -Wno-dev -Wno-deprecated -G Ninja -B build \ | ||
${{ matrix.zlib_compat }} \ | ||
-D CMAKE_VERBOSE_MAKEFILE="ON" \ | ||
-D CMAKE_CXX_STANDARD="17" \ | ||
-D CMAKE_INSTALL_PREFIX="${{ env.install_prefix }}" | ||
- name: Docker target - ${{ matrix.name }} - cmake build | ||
run: docker exec --env-file env.custom -w /root/${{ matrix.name }} multiarch cmake --build build | ||
|
||
- name: Docker target - ${{ matrix.name }} - cmake install | ||
run: docker exec --env-file env.custom -w /root/${{ matrix.name }} multiarch cmake --install build | ||
|
||
- name: Host - Set zlib version to variable | ||
run: | | ||
docker exec --env-file env.custom -w "${{ env.install_prefix }}/lib" binary_test bash -c 'strings libz*.a | grep -Pm1 "^\d+\.\d+\.\d+" > /root/${{ matrix.name }}.version' | ||
zlib_ng_version="$(<${{ matrix.name }}.version)" | ||
echo "zlib_ng_version=${zlib_ng_version%.*}" >> $GITHUB_ENV | ||
- name: Host - Set zlib release version | ||
if: matrix.pretty_name == 'v1' | ||
run: | | ||
echo "prerelease=true" >> $GITHUB_ENV | ||
- name: Docker target - Set deb dependencies for ${{ matrix.name }} | ||
run: echo "deb-deps=openssl" >> $GITHUB_ENV | ||
|
||
- name: Host - Create deb packages | ||
uses: jiro4989/build-deb-action@v2 | ||
with: | ||
package: "${{ matrix.name }}" | ||
package_root: build | ||
maintainer: userdocs | ||
version: "${{ env.zlib_ng_version }}" | ||
depends: "${{ env.deb-deps }}" | ||
arch: "${{ matrix.arch }}" | ||
desc: "${{ matrix.name }}-${{ env.zlib_ng_version }}-${{ matrix.arch }} for ${{ matrix.os_id }}-${{ matrix.os_version_id }}" | ||
|
||
- name: Host - Remove version from release name and use hyphens | ||
run: mv -f "${{ matrix.name }}_${{ env.zlib_ng_version }}_${{ matrix.arch }}.deb" "${{ matrix.os_id }}-${{ matrix.os_version_id }}-${{ matrix.name }}-${{ env.zlib_ng_version }}-${{ matrix.arch }}.deb" | ||
|
||
- name: Host - Upload artifacts | ||
uses: actions/[email protected] | ||
with: | ||
name: "${{ matrix.os_id }}-${{ matrix.os_version_id }}-${{ matrix.name }}-${{ env.zlib_ng_version }}-${{ matrix.arch }}" | ||
path: "${{ matrix.os_id }}-${{ matrix.os_version_id }}-${{ matrix.name }}-${{ env.zlib_ng_version }}-${{ matrix.arch }}.deb" | ||
|
||
- name: Host - "Create release - tag - assets" | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
prerelease: ${{ env.prerelease }} | ||
artifacts: "${{ matrix.os_id }}-${{ matrix.os_version_id }}-${{ matrix.name }}-${{ env.zlib_ng_version }}-${{ matrix.arch }}.deb" | ||
replacesArtifacts: true | ||
tag: "${{ env.zlib_ng_version }}" | ||
name: "${{ matrix.name }} ${{ env.zlib_ng_version }}" | ||
body: "${{ matrix.name }} built from github master on amd64 arm64 armhf for Debian Stretch Buster Bullseye and Ubuntu bionic Focal" | ||
allowUpdates: true | ||
token: "${{ secrets.GITHUB_TOKEN }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# zlib-ng cross builds | ||
|
||
Multiarch cross builds to use with Debian based platforms. | ||
|
||
Deb packages are created and published as releases. | ||
|