mirror of https://github.com/xemu-project/xemu.git
224 lines
7.0 KiB
YAML
224 lines
7.0 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 "::set-env name=BUILD_TAG::$BUILD_TAG"
|
|
mkdir -p dist
|
|
echo -n $BUILD_TAG > dist/tag
|
|
- name: Upload Artifacts
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: dist
|
|
|
|
Windows:
|
|
runs-on: windows-latest
|
|
needs: Init
|
|
strategy:
|
|
matrix:
|
|
configuration: ["Debug", "Release"]
|
|
steps:
|
|
- name: Define Build Options
|
|
shell: python
|
|
run: |
|
|
if "${{ matrix.configuration }}" == "Debug":
|
|
print('Configuring for Debug')
|
|
print('::set-env name=BUILD_PARAM::--debug')
|
|
print('::set-env name=ARTIFACT_NAME::xemu-win-debug.zip')
|
|
else:
|
|
print('Configuring for Release')
|
|
print('::set-env name=BUILD_PARAM::')
|
|
print('::set-env name=ARTIFACT_NAME::xemu-win-release.zip')
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
- name: Install Dependencies
|
|
run: |
|
|
echo "Downloading MSYS2 environment..."
|
|
Invoke-WebRequest -Uri "https://github.com/mborgerson/xemu-msys2/releases/latest/download/msys64.7z" -OutFile "msys64.7z"
|
|
echo "Extracting MSYS2 environment..."
|
|
7z x -y msys64.7z "-oC:\tools\"
|
|
echo "Updating MSYS2 environment..."
|
|
C:\tools\msys64\usr\bin\bash.exe -lc "pacman -Syu --noconfirm"
|
|
# - name: Initialize Compiler Cache
|
|
# id: cache
|
|
# uses: actions/cache@v1
|
|
# with:
|
|
# path: C:\tools\msys64\tmp\xemu-ccache
|
|
# key: cache-${{ runner.os }}-${{ matrix.configuration }}-${{ github.sha }}
|
|
# restore-keys: cache-${{ runner.os }}-${{ matrix.configuration }}-
|
|
- name: Compile
|
|
run: |
|
|
C:\tools\msys64\usr\bin\bash.exe -lc @"
|
|
set -e
|
|
cd `$GITHUB_WORKSPACE
|
|
# export CCACHE_DIR=/tmp/xemu-ccache
|
|
# export CCACHE_MAXSIZE=250M
|
|
# export PATH="/usr/lib/ccache/bin:/mingw64/bin:`$PATH"
|
|
export PATH="/mingw64/bin:`$PATH"
|
|
./build.sh ${{ env.BUILD_PARAM }}
|
|
# echo -e '\nCompiler Cache Stats:'
|
|
# ccache -s -c
|
|
"@
|
|
7z a ${{env.ARTIFACT_NAME}} .\dist\*
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: ${{env.ARTIFACT_NAME}}
|
|
|
|
Ubuntu:
|
|
runs-on: ubuntu-latest
|
|
needs: Init
|
|
strategy:
|
|
matrix:
|
|
configuration: ["Debug", "Release"]
|
|
steps:
|
|
- name: Define Build Options
|
|
shell: python
|
|
run: |
|
|
if "${{ matrix.configuration }}" == "Debug":
|
|
print('Configuring for Debug')
|
|
print('::set-env name=BUILD_PARAM::--debug')
|
|
print('::set-env name=ARTIFACT_NAME::xemu-ubuntu-debug')
|
|
else:
|
|
print('Configuring for Release')
|
|
print('::set-env name=BUILD_PARAM::')
|
|
print('::set-env name=ARTIFACT_NAME::xemu-ubuntu-release')
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
- name: Install Dependencies
|
|
run: |
|
|
sudo apt-get update
|
|
sudo apt-get install -y \
|
|
libepoxy-dev \
|
|
libgtk-3-dev \
|
|
libpixman-1-dev \
|
|
libsdl2-dev \
|
|
ccache
|
|
- name: Initialize Compiler Cache
|
|
id: cache
|
|
uses: actions/cache@v1
|
|
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=250M
|
|
export PATH="/usr/lib/ccache:$PATH"
|
|
./build.sh ${{ env.BUILD_PARAM }}
|
|
echo -e "\nCompiler Cache Stats:"
|
|
ccache -s -c
|
|
|
|
macOS:
|
|
runs-on: macOS-latest
|
|
needs: Init
|
|
strategy:
|
|
matrix:
|
|
configuration: ["Debug", "Release"]
|
|
steps:
|
|
- name: Define Build Options
|
|
shell: python
|
|
run: |
|
|
if "${{ matrix.configuration }}" == "Debug":
|
|
print('Configuring for Debug')
|
|
print('::set-env name=BUILD_PARAM::--debug')
|
|
print('::set-env name=ARTIFACT_NAME::xemu-macos-debug.zip')
|
|
else:
|
|
print('Configuring for Release')
|
|
print('::set-env name=BUILD_PARAM::')
|
|
print('::set-env name=ARTIFACT_NAME::xemu-macos-release.zip')
|
|
- name: Clone Tree
|
|
uses: actions/checkout@v2
|
|
- name: Install Dependencies
|
|
run: |
|
|
brew update
|
|
brew unlink python@2
|
|
brew install \
|
|
ccache \
|
|
coreutils \
|
|
dylibbundler \
|
|
libepoxy \
|
|
pixman \
|
|
pkg-config \
|
|
sdl2
|
|
- name: Initialize Compiler Cache
|
|
id: cache
|
|
uses: actions/cache@v1
|
|
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=250M
|
|
export PATH="/usr/local/opt/ccache/libexec:$PATH"
|
|
./build.sh ${{ env.BUILD_PARAM }}
|
|
echo -e "\nCompiler Cache Stats:"
|
|
ccache -s -c
|
|
pushd dist
|
|
zip -r ../${{env.ARTIFACT_NAME}} xemu.app
|
|
popd
|
|
- name: Upload Build Artifact
|
|
uses: actions/upload-artifact@v1
|
|
with:
|
|
name: dist
|
|
path: ${{env.ARTIFACT_NAME}}
|
|
|
|
Release:
|
|
runs-on: ubuntu-latest
|
|
needs: [Ubuntu, Windows, macOS]
|
|
env:
|
|
BUILD_TAG:
|
|
steps:
|
|
- name: Download Artifacts
|
|
uses: actions/download-artifact@v1
|
|
with:
|
|
name: dist
|
|
- name: Get Package Info
|
|
run: |
|
|
echo "::set-env name=BUILD_TAG::$(cat dist/tag)"
|
|
- name: Create Release
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
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)
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
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.zip
|
|
asset_content_type: application/zip
|
|
|
|
- name: Upload Release Assets (Windows Release Build)
|
|
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
|
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.zip
|
|
asset_content_type: application/zip
|