Files
yabridge/.github/workflows/build.yml
T
Robbert van der Helm dcc8f285a8 Fix the automatic builds on GitHub Actions
Squash of the following commits:

WIP: Build workflow on all branches

WIP: Reduce noise from wget

WIP: Don't use bash-style redirects

WIP: Use variables for Boost url and checksum

WIP: Manually set a Wine prefix

The user that's executing the job does not own the home directory for
some reason.

WIP: Fix typos in workflow

WIP: Don't use bash-style brace expansion

This is run under dash.

WIP: Fix archive name for Ubuntu 20.04 build

WIP: Fetch tags for git-describe

WIP: Fetch all git history for git-describe

WIP :Rename the workflow

Since this is what will appear on the status badge.
2020-05-06 17:43:45 +02:00

234 lines
8.3 KiB
YAML

name: Automated builds
on:
push:
# TODO: Uncomment these before squashing and merging
# branches:
# - master
pull_request:
# branches:
# - master
release:
types: [created]
env:
BOOST_URL: https://dl.bintray.com/boostorg/release/1.72.0/source/boost_1_72_0.tar.gz
BOOST_CHECKSUM: c66e88d5786f2ca4dbebb14e06b566fb642a1a6947ad8cc9091f9f445134143f boost_1_72_0.tar.gz
BOOST_VERSION: 1_72_0
jobs:
build-bionic:
name: Build on Ubuntu 18.04
runs-on: ubuntu-latest
# This container contains everything needed to build yabridge except for
# Boost since that's not easily available and it the parts we need are
# quick to compile anyway
container: robbert/docker-yabridge:bionic
outputs:
artifact-name: ${{ env.ARCHIVE_NAME }}
# GitHub actions does not allow you to share steps between jobs and their
# yaml parser does not support anchors, so we'll have to duplicate all of
# these steps
# https://github.community/t5/GitHub-Actions/reusing-sharing-inheriting-steps-between-jobs-declarations/td-p/37849
steps:
- uses: actions/checkout@v2
# Needed for git-describe to do anything useful
- name: Fetch all git history
run: git fetch --prune --tags --unshallow
- name: Determine build archive name
run: |
export ARCHIVE_NAME=yabridge-$(git describe --always)-ubuntu-18.04.tar.gz
echo ::set-env "name=ARCHIVE_NAME::$ARCHIVE_NAME"
- name: Compile Boost
run: |
set -e
cd /tmp
wget --quiet --max-redirect 3 "$BOOST_URL"
echo "$BOOST_CHECKSUM" | sha256sum -c
tar -xf "boost_${BOOST_VERSION}.tar.gz"
rm "boost_${BOOST_VERSION}.tar.gz"
cd boost_${BOOST_VERSION}
./bootstrap.sh --with-toolset=gcc --with-icu --with-python=
# 32-bit build
./b2 \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
toolset=gcc \
address-model=32 \
cflags="${CPPFLAGS} ${CFLAGS} -m32 -fPIC -O3" \
cxxflags="${CPPFLAGS} ${CXXFLAGS} -m32 -std=c++14 -fPIC -O3" \
linkflags="${LDFLAGS} -m32" \
--with-filesystem \
--libdir=/usr/local/lib/i386-linux-gnu \
-j $(nproc) \
\
install
# 64-bit build
./b2 \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
toolset=gcc \
address-model=64 \
cflags="${CPPFLAGS} ${CFLAGS} -fPIC -O3" \
cxxflags="${CPPFLAGS} ${CXXFLAGS} -std=c++14 -fPIC -O3" \
--with-filesystem \
-j $(nproc) \
\
install
- name: Build the binaries
run: |
# Wine won't create a Wine prefix in ~/.wine because /github/home is
# not owned by the user that's executing this job
mkdir -p /tmp/prefix
export WINEPREFIX=/tmp/prefix
meson setup --buildtype=release --cross-file cross-wine.conf -Duse-bitbridge=true build
ninja -C build
- name: Create an archive for the binaries
run: |
set -e
mkdir yabridge
# This is ran under dash which does not support brace expansion
cp build/libyabridge.so build/yabridge-host.exe build/yabridge-host.exe.so build/yabridge-host-32.exe build/yabridge-host-32.exe.so yabridge
cp README.md yabridge
tar -caf "$ARCHIVE_NAME" yabridge
rm -rf yabridge
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ARCHIVE_NAME }}
path: ${{ env.ARCHIVE_NAME }}
build-focal:
name: Build on Ubuntu 20.04
runs-on: ubuntu-latest
# This container contains everything needed to build yabridge except for
# Boost since that's not easily available and it the parts we need are
# quick to compile anyway
container: robbert/docker-yabridge:focal
outputs:
artifact-name: ${{ env.ARCHIVE_NAME }}
steps:
- uses: actions/checkout@v2
# Needed for git-describe to do anything useful
- name: Fetch all git history
run: git fetch --prune --tags --unshallow
- name: Determine build archive name
run: |
export ARCHIVE_NAME=yabridge-$(git describe --always).tar.gz
echo ::set-env "name=ARCHIVE_NAME::$ARCHIVE_NAME"
# TODO: Maybe we should move this to the Docker image. Compiling and
# copying took only a few seconds on my machine, but the disk IO
# is killing GitHub Actions.
- name: Compile Boost
run: |
set -e
cd /tmp
wget --quiet --max-redirect 3 "$BOOST_URL"
echo "$BOOST_CHECKSUM" | sha256sum -c
tar -xf "boost_${BOOST_VERSION}.tar.gz"
rm "boost_${BOOST_VERSION}.tar.gz"
cd boost_${BOOST_VERSION}
./bootstrap.sh --with-toolset=gcc --with-icu --with-python=
# 32-bit build
./b2 \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
toolset=gcc \
address-model=32 \
cflags="${CPPFLAGS} ${CFLAGS} -m32 -fPIC -O3" \
cxxflags="${CPPFLAGS} ${CXXFLAGS} -m32 -std=c++14 -fPIC -O3" \
linkflags="${LDFLAGS} -m32" \
--with-filesystem \
--libdir=/usr/local/lib/i386-linux-gnu \
-j $(nproc) \
\
install
# 64-bit build
./b2 \
variant=release \
debug-symbols=off \
threading=multi \
runtime-link=shared \
link=shared,static \
toolset=gcc \
address-model=64 \
cflags="${CPPFLAGS} ${CFLAGS} -fPIC -O3" \
cxxflags="${CPPFLAGS} ${CXXFLAGS} -std=c++14 -fPIC -O3" \
--with-filesystem \
-j $(nproc) \
\
install
- name: Build the binaries
run: |
# Wine won't create a Wine prefix in ~/.wine because /github/home is
# not owned by the user that's executing this job
mkdir -p /tmp/prefix
export WINEPREFIX=/tmp/prefix
meson setup --buildtype=release --cross-file cross-wine.conf -Duse-bitbridge=true build
ninja -C build
- name: Create an archive for the binaries
run: |
set -e
mkdir yabridge
# This is ran under dash which does not support brace expansion
cp build/libyabridge.so build/yabridge-host.exe build/yabridge-host.exe.so build/yabridge-host-32.exe build/yabridge-host-32.exe.so yabridge
cp README.md yabridge
tar -caf "$ARCHIVE_NAME" yabridge
rm -rf yabridge
- uses: actions/upload-artifact@v2
with:
name: ${{ env.ARCHIVE_NAME }}
path: ${{ env.ARCHIVE_NAME }}
upload-releases:
name: Upload the created artifacts to the releases page
runs-on: ubuntu-latest
needs: [build-bionic, build-focal]
if: ${{ github.event_name == 'release' }}
steps:
# They don't allow you to specify multiple file names for these actions
- uses: actions/download-artifact@v2
with:
name: ${{ needs.build-bionic.outputs.artifact-name }}
- uses: actions/download-artifact@v2
with:
name: ${{ needs.build-focal.outputs.artifact-name }}
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ needs.build-bionic.outputs.artifact-name }}
asset_name: $${{ needs.build-bionic.outputs.artifact-name }}
asset_content_type: application/x-compressed-tar
- uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ needs.build-focal.outputs.artifact-name }}
asset_name: $${{ needs.build-focal.outputs.artifact-name }}
asset_content_type: application/x-compressed-tar