sneedmc/.github/workflows/build.yml

190 lines
6.4 KiB
YAML
Raw Normal View History

2022-02-02 06:28:00 +00:00
name: build_portable
on:
[push, pull_request, workflow_dispatch]
jobs:
build:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-20.04
qt_version: 5.15.2
qt_host: linux
app_image: true
2022-02-02 06:28:00 +00:00
- os: windows-2022
qt_version: 5.15.2
qt_host: windows
2022-02-08 13:14:30 +00:00
qt_arch: win32_mingw81
2022-02-02 06:28:00 +00:00
- os: macos-11
qt_version: 5.12.12
qt_host: mac
macosx_deployment_target: 10.12
runs-on: ${{ matrix.os }}
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
INSTALL_DIR: "install"
BUILD_DIR: "build"
2022-02-02 06:28:00 +00:00
steps:
2022-02-08 13:14:30 +00:00
- name: Install 32bit mingw on Windows
if: runner.os == 'Windows'
uses: egor-tensin/setup-mingw@v2
with:
platform: x86
- name: Install 32bit zlib via Strawberry on Windows
if: runner.os == 'Windows'
run: |
choco install strawberryperl -y --force --x86
2022-02-02 06:28:00 +00:00
2022-02-10 15:28:31 +00:00
- name: Download OpenSSL libs on Windows
if: runner.os == 'Windows'
run: |
python -m pip install --upgrade pip
python -m pip install aqtinstall==2.0.5
python -m aqt install-tool -O "${{ github.workspace }}\Qt\" windows desktop tools_openssl_x86
2022-02-02 06:28:00 +00:00
- name: Checkout
uses: actions/checkout@v2
with:
submodules: 'true'
- name: Install OpenJDK
uses: AdoptOpenJDK/install-jdk@v1
with:
version: '17'
- name: Cache Qt
id: cache-qt
uses: actions/cache@v2
with:
path: "${{ github.workspace }}/Qt/"
2022-02-08 13:14:30 +00:00
key: ${{ runner.os }}-${{ matrix.qt_version }}-${{ matrix.qt_arch }}-qt_cache
2022-02-02 06:28:00 +00:00
- name: Install Qt
uses: jurplel/install-qt-action@v2
with:
version: ${{ matrix.qt_version }}
host: ${{ matrix.qt_host }}
arch: ${{ matrix.qt_arch }}
cached: ${{ steps.cache-qt.outputs.cache-hit }}
dir: "${{ github.workspace }}/Qt/"
- name: Install Ninja
uses: urkle/action-get-ninja@v1
2022-02-07 12:19:58 +00:00
- name: Download linuxdeploy family
if: runner.os == 'Linux'
2022-02-07 12:19:58 +00:00
run: |
wget "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage"
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage"
wget "https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage"
- name: Download JREs for AppImage on Linux
if: runner.os == 'Linux'
2022-02-07 12:19:58 +00:00
shell: bash
run: |
${{ github.workspace }}/.github/scripts/prepare_JREs.sh
2022-02-02 06:28:00 +00:00
- name: Configure CMake
if: runner.os != 'Linux'
run: |
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=Debug -G Ninja
- name: Configure CMake on Linux
if: runner.os == 'Linux'
2022-02-02 06:28:00 +00:00
run: |
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=Debug -DLauncher_LAYOUT=lin-system -G Ninja
2022-02-02 06:28:00 +00:00
- name: Build
run: |
cmake --build ${{ env.BUILD_DIR }}
2022-02-02 06:28:00 +00:00
- name: Install
if: matrix.app_image != true
run: |
cmake --install ${{ env.BUILD_DIR }}
- name: Install for AppImage on Linux
if: runner.os == 'Linux'
2022-02-02 06:28:00 +00:00
run: |
DESTDIR=${{ env.INSTALL_DIR }} cmake --install ${{ env.BUILD_DIR }}
2022-02-07 12:19:58 +00:00
- name: Bundle AppImage
if: runner.os == 'Linux'
shell: bash
run: |
export OUTPUT="PolyMC-${{ github.sha }}-x86_64.AppImage"
2022-02-07 13:11:42 +00:00
chmod +x linuxdeploy-*.AppImage
2022-02-07 13:11:42 +00:00
mkdir -p ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-{8,17}-openjdk
2022-02-07 13:11:42 +00:00
2022-02-07 10:18:47 +00:00
cp -r ${{ github.workspace }}/JREs/jre8/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk
2022-02-07 13:11:42 +00:00
2022-02-07 10:18:47 +00:00
cp -r ${{ github.workspace }}/JREs/jre17/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk
2022-02-07 13:11:42 +00:00
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk/lib/amd64/server"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk/lib/amd64"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib/server"
LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk/lib"
2022-02-08 03:25:52 +00:00
./linuxdeploy-x86_64.AppImage --appdir ${{ env.INSTALL_DIR }} --output appimage --plugin qt -i ${{ env.INSTALL_DIR }}/usr/share/icons/hicolor/scalable/apps/org.polymc.PolyMC.svg
- name: Run windeployqt
if: runner.os == 'Windows'
run: |
windeployqt "${{ env.INSTALL_DIR }}/polymc.exe"
2022-02-02 06:28:00 +00:00
2022-02-10 15:28:31 +00:00
- name: Install OpenSSL libs on Windows
2022-02-02 06:28:00 +00:00
if: runner.os == 'Windows'
run: |
2022-02-08 13:14:30 +00:00
copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x86\bin\libssl-1_1.dll" "${{ github.workspace }}\${{ env.INSTALL_DIR }}\"
copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x86\bin\libcrypto-1_1.dll" "${{ github.workspace }}\${{ env.INSTALL_DIR }}\"
- name: Run macdeployqt
if: runner.os == 'macOS'
run: |
cd ${{ env.INSTALL_DIR }}
macdeployqt "PolyMC.app" -executable="PolyMC.app/Contents/MacOS/polymc" -always-overwrite
2022-02-02 06:28:00 +00:00
- name: chmod binary on macOS
if: runner.os == 'macOS'
run: |
chmod +x "${{ github.workspace }}/${{ env.INSTALL_DIR }}/PolyMC.app/Contents/MacOS/polymc"
2022-02-02 06:28:00 +00:00
- name: tar bundle on macOS
if: runner.os == 'macOS'
run: |
cd ${{ env.INSTALL_DIR }}
2022-02-02 06:28:00 +00:00
tar -czf ../polymc.tar.gz *
- name: Upload AppImage for Linux
if: runner.os == 'Linux'
uses: actions/upload-artifact@v2
with:
name: PolyMC-${{ github.sha }}-x86_64.AppImage
path: PolyMC-${{ github.sha }}-x86_64.AppImage
- name: Upload package for Windows
if: runner.os == 'Windows'
2022-02-02 06:28:00 +00:00
uses: actions/upload-artifact@v2
with:
name: polymc-${{ runner.os }}-${{ github.sha }}-portable
path: ${{ env.INSTALL_DIR }}/**
2022-02-02 06:28:00 +00:00
- name: Upload package for macOS
if: runner.os == 'macOS'
uses: actions/upload-artifact@v2
with:
name: polymc-${{ runner.os }}-${{ github.sha }}-portable
2022-02-02 06:28:00 +00:00
path: polymc.tar.gz