Skip to content

Commit

Permalink
CI: split Linux, Windows, ARM and MacOS builds on push/PR, add Releas…
Browse files Browse the repository at this point in the history
…e workflow
  • Loading branch information
substring committed Dec 21, 2024
1 parent 48b1b1a commit f5a52fc
Show file tree
Hide file tree
Showing 6 changed files with 435 additions and 1 deletion.
62 changes: 62 additions & 0 deletions .github/workflows/ARM.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: ARM

on:
push:
tags-ignore:
- '**'
pull_request:
workflow_dispatch:
#workflow_call:

jobs:
buildAMarm:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ubuntu-latest

strategy:
matrix:
platform:
- { name: armv7, arch: arm32v7, pf: arm/v7, shell: bash, amflags: USE_DRM=1 USE_MMAL=1}
- { name: aarch64, arch: arm64v8, pf: aarch64, shell: bash, amflags: USE_DRM=1}
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }
os: [ buster, bullseye, bookworm ]
exclude:
- config: { name: shared }

steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Build AM+
uses: uraimo/run-on-arch-action@v2
with:
arch: ${{ matrix.platform.name }}
distro: ${{ matrix.os }}
githubToken: ${{ github.token }}
dockerRunArgs: |
--volume "${GITHUB_WORKSPACE}/am:/am"
install: |
apt-get update -y -q
apt-get install -y -q build-essential cmake pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libgbm-dev libdrm-dev libegl1-mesa-dev libcurl4-gnutls-dev libboost-filesystem-dev libboost-system-dev
run: |
make -C am -j$(nproc) VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} ${{matrix.platform.amflags}} ${{matrix.config.amflags}}
- name: Prepare artifacts
run: |
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
find "${GITHUB_WORKSPACE}"/am/obj/sfml/install/lib/ -name "*.dll" -o -name "*.so" -o -name "*.dylib" -exec cp -v {} "${GITHUB_WORKSPACE}"/artifacts/ \;
cp am/attract* "${GITHUB_WORKSPACE}"/artifacts/
cp -R am/config/* "${GITHUB_WORKSPACE}"/artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.platform.name}}-${{matrix.os}}
path: ./artifacts/
73 changes: 73 additions & 0 deletions .github/workflows/Linux-x86_64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Linux x86_64

on:
push:
tags-ignore:
- '**'
pull_request:
workflow_dispatch:
#workflow_call:

jobs:
buildAMx86:
name: ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
platform:
- { name: Linux x64 KMS, targetos: linux-x86, amflags: USE_DRM=1 }
- { name: Linux x64 X11, targetos: linux-x86 }
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }

os: [ ubuntu-24.04, ubuntu-22.04, ubuntu-20.04 ]

exclude:
- platform: { targetos: linux-x86 }
config: { name: shared }

steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am

- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install Linux Dependencies
run: |
sudo apt update
sudo apt install build-essential cmake pkgconf libxrandr-dev libxcursor-dev libudev-dev libopenal-dev libflac-dev libvorbis-dev libgl1-mesa-dev libavformat-dev libfontconfig1-dev libfreetype6-dev libswscale-dev libswresample-dev libarchive-dev libjpeg-dev libglu1-mesa-dev libegl1-mesa-dev libgbm-dev libdrm-dev libcurl4-gnutls-dev libboost-system-dev libboost-filesystem-dev
- name: Build AM+
run: |
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} ${{matrix.platform.amflags}} ${{matrix.config.amflags}} ${{env.cross_toolchain}}
- name: Prepare artifacts
run: |
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
for e in "${GITHUB_WORKSPACE}"/am/*.exe ; do
echo "Gathering dll infos for $e ..."
which mingw-ldd || continue
for dll in $(mingw-ldd "$e" --dll-lookup-dirs /usr/lib/mxe/usr/x86_64-w64-mingw32.shared/bin/ "${GITHUB_WORKSPACE}"/sfml/install/lib/ | grep -v 'not found$' | tr -d ' ' | cut -d '>' -f 2) ; do
cp "$dll" "${GITHUB_WORKSPACE}"/artifacts/
done
done
find "${GITHUB_WORKSPACE}"/am/obj/sfml/install/lib/ -name "*.dll" -o -name "*.so" -o -name "*.dylib" -exec cp -v {} "${GITHUB_WORKSPACE}"/artifacts/ \;
cp am/attract* "${GITHUB_WORKSPACE}"/artifacts/
cp -R am/config/* "${GITHUB_WORKSPACE}"/artifacts/
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{matrix.platform.name}}-${{matrix.config.name}}-${{matrix.os}}
path: ./artifacts/
51 changes: 51 additions & 0 deletions .github/workflows/MacOS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: MacOS

on:
push:
tags-ignore:
- '**'
pull_request:
workflow_dispatch:
workflow_call:

jobs:

buildMacOS:
name: MacOS build
runs-on: macos-latest
steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am
- name: Prepare
id: vars
run: |
which nproc && nbproc=$(nproc) || nbproc=$(getconf _NPROCESSORS_ONLN)
echo "nbproc=${nbproc}" >> $GITHUB_OUTPUT
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
- name: Install MacOS brew
run: |
brew update
brew upgrade
brew install pkgconfig ffmpeg libarchive libvorbis flac jpeg-turbo boost sfml
#~ - name: MacOS switch to GCC
#~ run: |
#~ echo "CC=/usr/local/bin/gcc-10" >> $GITHUB_ENV
#~ echo "CXX=/usr/local/bin/g++-10" >> $GITHUB_ENV
#~ echo "AR=/usr/local/bin/ar-10" >> $GITHUB_ENV
- name: Build AM+
run: |
make -C am -j${{ steps.vars.outputs.nbproc }} VERBOSE=1 FE_VERSION=${{ steps.vars.outputs.fe_version }} prefix=.. USE_SYSTEM_SFML=1 STATIC=0
- name: Prepare artifacts
run: |
git -C am/ fetch --unshallow
mkdir -p "${GITHUB_WORKSPACE}"/artifacts
bash am/util/osx/appbuilder.sh
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: MacOS
path: ./artifacts/
157 changes: 157 additions & 0 deletions .github/workflows/Release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,157 @@
name: Realase

on:
push:
tags:
- '**'

env:
PKG_CONFIG_PATH_x86_64_w64_mingw32_static: /usr/lib/mxe/usr/x86_64-w64-mingw32.static/lib/pkgconfig/

jobs:
PackageAMx86:
name: Package ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
matrix:
platform:
- { name: Linux x64 KMS, targetos: linux-x86, amflags: USE_DRM=1 }
#- { name: Linux x64 X11, targetos: linux-x86 }
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }

os: [ ubuntu-24.04, ubuntu-22.04, ubuntu-20.04 ]

exclude:
- platform: { targetos: linux-x86 }
config: { name: shared }

steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am

- name: Prepare
id: vars
run: |
deb_version="$(head -1 am/debian/changelog | egrep -o "[0-9]+\.[0-9]+\.[0-9]+")"
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
echo "deb_version=${deb_version}" >> $GITHUB_OUTPUT
- name: Package AM+
uses: jtdor/build-deb-action@v1
env:
DEB_BUILD_OPTIONS: noautodbgsym
with:
buildpackage-opts: --build=binary --no-pre-clean --no-sign
source-dir: am

- name: Rename AM+
run: |
find ./ -name '*.deb'
version="$(head -1 am/debian/changelog | egrep -o "[0-9]+\.[0-9]+\.[0-9]+")"
cp "./debian/artifacts/attractplus_${version}_amd64.deb" "attractplus_${version}_${{ matrix.os }}_amd64.deb"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: "./attractplus_${{ steps.vars.outputs.deb_version }}_${{ matrix.os }}_amd64.deb"
name: "attractplus_${{ steps.vars.outputs.deb_version }}_${{ matrix.os }}_amd64.deb"
compression-level: 0

PackageAMarm:
name: Package ${{ matrix.platform.name }} ${{ matrix.config.name }} on ${{ matrix.os }}
runs-on: ubuntu-latest

strategy:
matrix:
platform:
- { name: armv7, arch: armhf }
- { name: aarch64, arch: arm64 }
config:
- { name: shared, amflags: STATIC=0 }
- { name: static, amflags: STATIC=1 }
os: [ buster, bullseye, bookworm ]
exclude:
- config: { name: shared }

steps:
- name: AM+ - Checkout
uses: actions/checkout@v4
with:
path: am

- name: Prepare
id: vars
run: |
deb_version="$(head -1 am/debian/changelog | egrep -o "[0-9]+\.[0-9]+\.[0-9]+")"
fe_version=
[[ ${GITHUB_REF} =~ ^refs/tags/* ]] && fe_version="${GITHUB_REF#refs/*/}"
echo "fe_version=${fe_version}" >> $GITHUB_OUTPUT
echo "deb_version=${deb_version}" >> $GITHUB_OUTPUT
- name: Package AM+
uses: jtdor/build-deb-action@v1
env:
DEB_BUILD_OPTIONS: noautodbgsym
with:
buildpackage-opts: --build=binary --no-sign --no-pre-clean
source-dir: am
host-arch: ${{ matrix.platform.arch }}
docker-image: debian:${{ matrix.os }}-slim

- name: Rename AM+
run: |
find ./ -name '*.deb'
version="$(head -1 am/debian/changelog | egrep -o "[0-9]+\.[0-9]+\.[0-9]+")"
cp "./debian/artifacts/attractplus_${version}_${{ matrix.platform.arch }}.deb" "attractplus_${version}_${{ matrix.os }}_${{ matrix.platform.arch }}.deb"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
path: "./attractplus_${{ steps.vars.outputs.deb_version }}_${{ matrix.os }}_${{ matrix.platform.arch }}.deb"
name: "attractplus_${{ steps.vars.outputs.deb_version }}_${{ matrix.os }}_${{ matrix.platform.arch }}.deb"
compression-level: 0

Windows:
uses: ./.github/workflows/Windows.yml

MacOS:
uses: ./.github/workflows/MacOS.yml

Release:
name: Release to Github
needs: [PackageAMx86, PackageAMarm, Windows, MacOS]
runs-on: ubuntu-latest

steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts

- name: Prepare artifacts
id: prepare_artifacts
run: |
tag="${GITHUB_REF#refs/*/}"
echo "current_tag=${tag}" >> $GITHUB_OUTPUT
mkdir -p "${GITHUB_WORKSPACE}"/artifacts_for_release
ls -l "${GITHUB_WORKSPACE}"/artifacts/
cp -v "${GITHUB_WORKSPACE}"/artifacts/*.deb "${GITHUB_WORKSPACE}"/artifacts_for_release
7z a "attractplus-${GITHUB_REF#refs/*/}-Windows.7z" ./artifacts/Windows/*
7z a "attractplus-${GITHUB_REF#refs/*/}-MacOS.7z" ./artifacts/MacOS/*
- name: Create Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: Attract Mode Plus ${{ steps.prepare_artifacts.outputs.current_tag }}
draft: true
prerelease: false
files: artifacts_for_release/attractplus-*.7z
Loading

0 comments on commit f5a52fc

Please sign in to comment.