mirror of
https://github.com/xemu-project/xemu.git
synced 2024-06-02 20:18:25 -04:00
351 lines
12 KiB
YAML
351 lines
12 KiB
YAML
name: Build
|
|
|
|
on: [push, pull_request]
|
|
|
|
jobs:
|
|
Init:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Create Build Tag
|
|
run: |
|
|
export BUILD_TAG=build-$(date -u +'%Y%m%d%H%M')
|
|
echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_ENV
|
|
echo -n $BUILD_TAG > tag
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: tag
|
|
path: tag
|
|
|
|
UbuntuWinCross:
|
|
name: Build for Windows (${{ matrix.configuration }}) on Ubuntu
|
|
runs-on: ubuntu-latest
|
|
needs: Init
|
|
strategy:
|
|
matrix:
|
|
configuration: ["Debug", "Release"]
|
|
include:
|
|
- configuration: Debug
|
|
build_param: --debug
|
|
artifact_name: xemu-win-debug
|
|
artifact_filename: xemu-win-debug.zip
|
|
- configuration: Release
|
|
build_param:
|
|
artifact_name: xemu-win-release
|
|
artifact_filename: xemu-win-release.zip
|
|
env:
|
|
DOCKER_IMAGE_NAME: mborgerson/xemu-ubuntu-win64-cross:latest
|
|
steps:
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Initialize Compiler Cache
|
|
id: cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/xemu-ccache
|
|
key: cache-wincross-${{ runner.os }}-${{ matrix.configuration }}-${{ github.sha }}
|
|
restore-keys: cache-wincross-${{ runner.os }}-${{ matrix.configuration }}-
|
|
- name: Pull Docker Image
|
|
run: docker pull $DOCKER_IMAGE_NAME
|
|
- name: Compile
|
|
run: |
|
|
mkdir -p /tmp/xemu-ccache
|
|
docker run --rm \
|
|
-v $PWD:/xemu -w /xemu \
|
|
-v /tmp/xemu-ccache:/tmp/xemu-ccache \
|
|
-e CCACHE_DIR=/tmp/xemu-ccache \
|
|
-e CCACHE_MAXSIZE=512M \
|
|
-u $(id -u):$(id -g) \
|
|
$DOCKER_IMAGE_NAME \
|
|
bash -c "./build.sh -p win64-cross ${{ matrix.build_param }} && ccache -sc"
|
|
cd dist
|
|
zip -r ../${{ matrix.artifact_filename }} *
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: ${{ matrix.artifact_filename }}
|
|
|
|
Ubuntu:
|
|
name: Build for Ubuntu
|
|
runs-on: ubuntu-latest
|
|
needs: Init
|
|
strategy:
|
|
matrix:
|
|
configuration: ["Debug", "Release"]
|
|
include:
|
|
- configuration: Debug
|
|
build_param: --debug
|
|
artifact_name: xemu-ubuntu-debug
|
|
artifact_filename: xemu-ubuntu-debug.tgz
|
|
- configuration: Release
|
|
build_param:
|
|
artifact_name: xemu-ubuntu-release
|
|
artifact_filename: xemu-ubuntu-release.tgz
|
|
steps:
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libepoxy-dev \
|
|
libgtk-3-dev \
|
|
libpixman-1-dev \
|
|
libsdl2-dev \
|
|
libsamplerate0-dev \
|
|
ccache \
|
|
ninja-build
|
|
- name: Initialize Compiler Cache
|
|
id: cache
|
|
uses: actions/cache@v2
|
|
with:
|
|
path: /tmp/xemu-ccache
|
|
key: cache-${{ runner.os }}-${{ matrix.configuration }}-${{ github.sha }}
|
|
restore-keys: cache-${{ runner.os }}-${{ matrix.configuration }}-
|
|
- name: Compile
|
|
run: |
|
|
export CCACHE_DIR=/tmp/xemu-ccache
|
|
export CCACHE_MAXSIZE=512M
|
|
export PATH="/usr/lib/ccache:$PATH"
|
|
./build.sh ${{ matrix.build_param }} --extra-cflags="-fuse-ld=gold"
|
|
echo -e "\nCompiler Cache Stats:"
|
|
ccache -s -c
|
|
tar -czvf ${{ matrix.artifact_filename }} --transform "s#^dist#xemu#" dist
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: ${{ matrix.artifact_filename }}
|
|
|
|
macOS:
|
|
name: Build for ${{ matrix.arch }} macOS (${{ matrix.configuration }})
|
|
runs-on: macOS-latest
|
|
needs: Init
|
|
strategy:
|
|
matrix:
|
|
arch: ["x86_64", "arm64"]
|
|
configuration: ["Debug", "Release"]
|
|
include:
|
|
- arch: x86_64
|
|
configuration: Debug
|
|
build_param: --debug -a x86_64
|
|
artifact_name: xemu-macos-x86_64-debug
|
|
artifact_filename: xemu-macos-x86_64-debug.zip
|
|
- arch: x86_64
|
|
configuration: Release
|
|
build_param: -a x86_64
|
|
artifact_name: xemu-macos-x86_64-release
|
|
artifact_filename: xemu-macos-x86_64-release.zip
|
|
- arch: arm64
|
|
configuration: Debug
|
|
build_param: --debug -a arm64
|
|
artifact_name: xemu-macos-arm64-debug
|
|
artifact_filename: xemu-macos-arm64-debug.zip
|
|
- arch: arm64
|
|
configuration: Release
|
|
build_param: -a arm64
|
|
artifact_name: xemu-macos-arm64-release
|
|
artifact_filename: xemu-macos-arm64-release.zip
|
|
steps:
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Install Dependencies
|
|
run: |
|
|
export HOMEBREW_NO_AUTO_UPDATE=1
|
|
export HOMEBREW_NO_INSTALL_CLEANUP=1
|
|
# brew doctor || true
|
|
# brew update-reset
|
|
|
|
# # Prevent updated packages from triggering PHP update
|
|
# brew uninstall php || true
|
|
|
|
# # Force update of Python, handle link issues
|
|
# brew uninstall --ignore-dependencies python || true
|
|
# brew install python@3.9 || true
|
|
# brew link --overwrite python@3.9 || true
|
|
|
|
brew install \
|
|
ccache \
|
|
coreutils \
|
|
dylibbundler \
|
|
pkg-config \
|
|
ninja
|
|
- name: Initialize Compiler Cache
|
|
id: cache
|
|
# FIXME: actions/cache@v2 broken on macOS?
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: /tmp/xemu-ccache
|
|
key: cache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-${{ github.sha }}
|
|
restore-keys: cache-${{ runner.os }}-${{ matrix.arch }}-${{ matrix.configuration }}-
|
|
- name: Compile
|
|
run: |
|
|
export CCACHE_DIR=/tmp/xemu-ccache
|
|
export CCACHE_MAXSIZE=512M
|
|
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
|
./build.sh ${{ matrix.build_param }}
|
|
echo -e "\nCompiler Cache Stats:"
|
|
ccache -s -c
|
|
pushd dist
|
|
zip -r ../${{ matrix.artifact_filename }} *
|
|
popd
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: ${{ matrix.artifact_name }}
|
|
path: ${{ matrix.artifact_filename }}
|
|
|
|
macOSBuildUniversal:
|
|
name: Build for Universal macOS (${{ matrix.configuration }})
|
|
runs-on: macOS-latest
|
|
needs: [macOS]
|
|
strategy:
|
|
matrix:
|
|
configuration: ["debug", "release"]
|
|
env:
|
|
BUILD_TAG:
|
|
steps:
|
|
- name: Download x86_64 Build
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: xemu-macos-x86_64-${{ matrix.configuration }}
|
|
path: xemu-macos-x86_64-${{ matrix.configuration }}
|
|
- name: Download arm64 Build
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: xemu-macos-arm64-${{ matrix.configuration }}
|
|
path: xemu-macos-arm64-${{ matrix.configuration }}
|
|
- name: Build Universal bundle
|
|
run: |
|
|
mkdir dist
|
|
for arch in x86_64 arm64; do
|
|
pushd xemu-macos-${arch}-${{ matrix.configuration }}
|
|
unzip xemu-macos-${arch}-${{ matrix.configuration }}.zip
|
|
popd
|
|
pushd dist
|
|
unzip -o ../xemu-macos-${arch}-${{ matrix.configuration }}/xemu-macos-${arch}-${{ matrix.configuration }}.zip
|
|
popd
|
|
done
|
|
pushd dist
|
|
rm xemu.app/Contents/MacOS/xemu
|
|
lipo -create -output xemu.app/Contents/MacOS/xemu \
|
|
../xemu-macos-x86_64-${{ matrix.configuration }}/xemu.app/Contents/MacOS/xemu \
|
|
../xemu-macos-arm64-${{ matrix.configuration }}/xemu.app/Contents/MacOS/xemu
|
|
zip -r ../xemu-macos-universal-${{ matrix.configuration }}.zip *
|
|
popd
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: xemu-macos-universal-${{ matrix.configuration }}
|
|
path: xemu-macos-universal-${{ matrix.configuration }}.zip
|
|
|
|
Release:
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/xemu-v'))
|
|
runs-on: ubuntu-latest
|
|
needs: [Ubuntu, macOSBuildUniversal, UbuntuWinCross]
|
|
env:
|
|
BUILD_TAG:
|
|
steps:
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
path: dist
|
|
- name: Get Package Info
|
|
run: |
|
|
echo "BUILD_TAG=$(cat dist/tag/tag)" >> $GITHUB_ENV
|
|
- name: Create Release
|
|
id: create_release
|
|
uses: actions/create-release@v1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
tag_name: ${{ env.BUILD_TAG }}
|
|
release_name: ${{ env.BUILD_TAG }}
|
|
draft: false
|
|
prerelease: false
|
|
- name: Upload Release Assets (Windows Debug Build)
|
|
id: upload-release-asset-win-debug
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_name: xemu-win-debug.zip
|
|
asset_path: dist/xemu-win-debug/xemu-win-debug.zip
|
|
asset_content_type: application/zip
|
|
- name: Upload Release Assets (Windows Release Build)
|
|
id: upload-release-asset-win-release
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_name: xemu-win-release.zip
|
|
asset_path: dist/xemu-win-release/xemu-win-release.zip
|
|
asset_content_type: application/zip
|
|
- name: Upload Release Assets (macOS Release Build)
|
|
id: upload-release-asset-macos-release
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_name: xemu-macos-universal-release.zip
|
|
asset_path: dist/xemu-macos-universal-release/xemu-macos-universal-release.zip
|
|
asset_content_type: application/zip
|
|
- name: Upload Release Assets (macOS Debug Build)
|
|
id: upload-release-asset-macos-debug
|
|
uses: actions/upload-release-asset@v1.0.1
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
with:
|
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
|
asset_name: xemu-macos-universal-debug.zip
|
|
asset_path: dist/xemu-macos-universal-debug/xemu-macos-universal-debug.zip
|
|
asset_content_type: application/zip
|
|
|
|
# Sync archive version of source (including submodule code) to the
|
|
# ppa-snapshot branch to work around limitations of the Launchpad platform,
|
|
# namely: no network egress on package build, no custom scripting in source
|
|
# package creation.
|
|
PushToPPA:
|
|
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/xemu-v'))
|
|
needs: [Ubuntu, macOSBuildUniversal, UbuntuWinCross]
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
with:
|
|
fetch-depth: 0
|
|
- name: Create Source Archive
|
|
run: |
|
|
./scripts/archive-source.sh archive.tgz
|
|
mkdir archive
|
|
pushd archive
|
|
tar xf ../archive.tgz
|
|
popd
|
|
- name: Integrate Debian Packaging
|
|
run: |
|
|
# Clone deb branch containing packaging files
|
|
git clone --branch=deb --depth=1 https://github.com/mborgerson/xemu.git /tmp/xemu-debian
|
|
mv /tmp/xemu-debian/debian archive
|
|
|
|
# Create changelog containing current version
|
|
echo -e "xemu (1:$(cat archive/XEMU_VERSION)-0) unstable; urgency=medium\n" > archive/debian/changelog
|
|
echo -e " Built from $(cat archive/XEMU_VERSION)\n" >> archive/debian/changelog
|
|
echo " -- Matt Borgerson <contact@mborgerson.com> $(date -R)" >> archive/debian/changelog
|
|
- name: Deploy Source Archive to Branch
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_dir: ./archive
|
|
publish_branch: ppa-snapshot
|
|
force_orphan: true
|