OpenRCT2/.github/workflows/ci.yml

120 lines
4.1 KiB
YAML

name: CI
on: [push, pull_request]
env:
OPENRCT2_BUILD_SERVER: GitHub
OPENRCT2_ORG_TOKEN: ${{ secrets.OPENRCT2_ORG_TOKEN }}
OPENRCT2_VERSION: 0.2.4
jobs:
check-code-formatting:
name: Check code formatting
runs-on: ubuntu-latest
container:
image: openrct2/openrct2:format
steps:
- uses: actions/checkout@v1
- name: Run clang-format
run: scripts/run-clang-format.py -r src test --exclude src/openrct2/thirdparty
windows:
name: Windows
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
platform: [win32, x64]
env:
CONFIGURATION: Release
PLATFORM: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Build OpenRCT2
shell: bash
run: . scripts/setenv && build
- name: Build artifacts
shell: bash
run: |
. scripts/setenv -q
build-portable
build-symbols
build-installer -i
- uses: actions/upload-artifact@master
name: Upload artifacts (CI)
with:
name: "OpenRCT2-Windows-${{ matrix.platform }}"
path: artifacts
- name: Run Tests
shell: bash
run: . scripts/setenv -q && run-tests
- name: Upload artifacts (openrct2.org)
shell: bash
run: |
. scripts/setenv -q
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
upload-build artifacts/openrct2-portable-*.zip "windows-portable-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-installer-*.exe "windows-installer-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
upload-build artifacts/openrct2-symbols-*.zip "windows-symbols-$PLATFORM" $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
osx:
name: macOS
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Build OpenRCT2
run: |
. scripts/setenv
xcodebuild
mkdir -p artifacts
mv build/Release/OpenRCT2.app artifacts
- uses: actions/upload-artifact@master
name: Upload artifacts (CI)
with:
name: "OpenRCT2-macOS"
path: artifacts
- name: Upload artifacts (openrct2.org)
run: |
. scripts/setenv
if [[ "$OPENRCT2_PUSH" == "true" ]]; then
echo -e "\033[0;36mCompressing OpenRCT2.app...\033[0m"
cd artifacts
zip -rq openrct2-macos.zip OpenRCT2.app
upload-build openrct2-macos.zip macos $OPENRCT2_VERSION $OPENRCT2_SHA1 $OPENRCT2_BRANCH
else
echo 'Not going to push build'
fi
build-appimage:
name: Linux (x64, AppImage)
runs-on: ubuntu-latest
container:
image: openrct2/openrct2:ubuntu_amd64
steps:
- uses: actions/checkout@v1
name: Checkout
- name: Get pre-reqs
run: |
git clone https://github.com/discordapp/discord-rpc -b v3.4.0
git clone https://github.com/janisozaur/rapidjson discord-rpc/thirdparty/rapidjson -b patch-1
mkdir bin && cd bin
apt-get update
apt-get install -y wget libcairo2
wget https://github.com/TheAssassin/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage
chmod +x linuxdeploy*.AppImage
- name: Build OpenRCT2
working-directory: bin
run: |
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
ninja -v
DESTDIR=AppDir ninja install
- name: Build AppImage
working-directory: bin
run: |
./linuxdeploy*.AppImage --appimage-extract-and-run --appdir AppDir/ --output appimage --desktop-file AppDir/usr/share/applications/openrct2.desktop
mkdir artifacts
mv OpenRCT2*.AppImage artifacts
- uses: actions/upload-artifact@master
with:
name: OpenRCT2-AppImage
path: bin/artifacts