2022-02-12 09:09:36 +05:30
|
|
|
name: Build
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
on:
|
2022-02-12 09:09:36 +05:30
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
build_type:
|
|
|
|
description: Type of build (Debug, Release, RelWithDebInfo, MinSizeRel)
|
|
|
|
type: string
|
|
|
|
default: Debug
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
include:
|
|
|
|
|
2022-02-20 01:16:43 +05:30
|
|
|
- os: ubuntu-20.04
|
|
|
|
qt_version: 5.12.8
|
|
|
|
qt_host: linux
|
|
|
|
|
2022-02-07 01:05:50 +05:30
|
|
|
- os: ubuntu-20.04
|
|
|
|
qt_version: 5.15.2
|
|
|
|
qt_host: linux
|
2022-02-20 01:16:43 +05:30
|
|
|
app_image: true
|
2022-02-07 01:05:50 +05:30
|
|
|
|
2022-02-02 11:58:00 +05:30
|
|
|
- os: windows-2022
|
2022-03-17 21:25:45 +05:30
|
|
|
name: "Windows-i686"
|
|
|
|
msystem: mingw32
|
2022-03-21 23:41:55 +05:30
|
|
|
portable: false
|
2022-03-17 21:25:45 +05:30
|
|
|
|
|
|
|
- os: windows-2022
|
|
|
|
name: "Windows-x86_64"
|
|
|
|
msystem: mingw64
|
2022-03-21 23:41:55 +05:30
|
|
|
portable: false
|
|
|
|
|
|
|
|
- os: windows-2022
|
|
|
|
name: "Windows-i686-portable"
|
|
|
|
msystem: mingw32
|
|
|
|
portable: true
|
|
|
|
|
|
|
|
- os: windows-2022
|
|
|
|
name: "Windows-x86_64-portable"
|
|
|
|
msystem: mingw64
|
|
|
|
portable: true
|
|
|
|
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- os: macos-11
|
|
|
|
qt_version: 5.12.12
|
|
|
|
qt_host: mac
|
|
|
|
macosx_deployment_target: 10.12
|
|
|
|
|
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
|
|
|
|
env:
|
2022-02-07 01:05:50 +05:30
|
|
|
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx_deployment_target }}
|
|
|
|
INSTALL_DIR: "install"
|
|
|
|
BUILD_DIR: "build"
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
steps:
|
2022-02-12 10:00:13 +05:30
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
with:
|
|
|
|
submodules: 'true'
|
|
|
|
|
2022-03-17 21:25:45 +05:30
|
|
|
- name: 'Setup MSYS2'
|
2022-02-10 20:58:31 +05:30
|
|
|
if: runner.os == 'Windows'
|
2022-03-17 21:25:45 +05:30
|
|
|
uses: msys2/setup-msys2@v2
|
|
|
|
with:
|
|
|
|
msystem: ${{ matrix.msystem }}
|
|
|
|
update: true
|
|
|
|
install: >-
|
|
|
|
git
|
|
|
|
pacboy: >-
|
|
|
|
toolchain:p
|
|
|
|
cmake:p
|
|
|
|
ninja:p
|
|
|
|
qt5:p
|
2022-02-12 09:09:36 +05:30
|
|
|
|
2022-03-19 02:58:52 +05:30
|
|
|
- name: Set short version
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
ver_short=`git rev-parse --short HEAD`
|
|
|
|
echo "VERSION=$ver_short" >> $GITHUB_ENV
|
|
|
|
|
2022-02-02 11:58:00 +05:30
|
|
|
- name: Install OpenJDK
|
2022-03-18 04:02:44 +05:30
|
|
|
uses: actions/setup-java@v3
|
2022-02-02 11:58:00 +05:30
|
|
|
with:
|
2022-03-18 04:02:44 +05:30
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: '17'
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: Cache Qt
|
2022-03-17 21:25:45 +05:30
|
|
|
if: runner.os != 'Windows'
|
2022-02-02 11:58:00 +05:30
|
|
|
id: cache-qt
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: "${{ github.workspace }}/Qt/"
|
2022-02-08 18:44:30 +05:30
|
|
|
key: ${{ runner.os }}-${{ matrix.qt_version }}-${{ matrix.qt_arch }}-qt_cache
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: Install Qt
|
2022-03-17 21:25:45 +05:30
|
|
|
if: runner.os != 'Linux' && runner.os != 'Windows' || matrix.app_image == true
|
2022-02-02 11:58:00 +05:30
|
|
|
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/"
|
|
|
|
|
2022-02-22 20:11:17 +05:30
|
|
|
- name: Install System Qt on Linux
|
|
|
|
if: runner.os == 'Linux' && matrix.app_image != true
|
|
|
|
run: |
|
2022-03-10 13:38:16 +05:30
|
|
|
sudo apt-get -y update
|
2022-02-22 20:11:17 +05:30
|
|
|
sudo apt-get -y install qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools libqt5core5a libqt5network5 libqt5gui5
|
|
|
|
|
2022-02-02 11:58:00 +05:30
|
|
|
- name: Install Ninja
|
2022-03-17 21:25:45 +05:30
|
|
|
if: runner.os != 'Windows'
|
2022-02-02 11:58:00 +05:30
|
|
|
uses: urkle/action-get-ninja@v1
|
|
|
|
|
2022-02-20 01:16:43 +05:30
|
|
|
- name: Download linuxdeploy family for AppImage on Linux
|
|
|
|
if: matrix.app_image == true
|
2022-02-07 17:49:58 +05:30
|
|
|
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"
|
|
|
|
|
2022-02-10 21:30:03 +05:30
|
|
|
- name: Download JREs for AppImage on Linux
|
2022-02-20 01:16:43 +05:30
|
|
|
if: matrix.app_image == true
|
2022-02-07 17:49:58 +05:30
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
${{ github.workspace }}/.github/scripts/prepare_JREs.sh
|
|
|
|
|
2022-02-02 11:58:00 +05:30
|
|
|
- name: Configure CMake
|
2022-03-17 21:25:45 +05:30
|
|
|
if: runner.os != 'Linux' && runner.os != 'Windows'
|
|
|
|
run: |
|
|
|
|
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -G Ninja
|
|
|
|
|
|
|
|
- name: Configure CMake on Windows
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
shell: msys2 {0}
|
2022-02-07 01:05:50 +05:30
|
|
|
run: |
|
2022-02-12 09:09:36 +05:30
|
|
|
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=${{ env.INSTALL_DIR }} -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -G Ninja
|
2022-02-07 01:05:50 +05:30
|
|
|
|
2022-02-10 21:30:03 +05:30
|
|
|
- name: Configure CMake on Linux
|
|
|
|
if: runner.os == 'Linux'
|
2022-02-02 11:58:00 +05:30
|
|
|
run: |
|
2022-02-15 00:42:14 +05:30
|
|
|
cmake -S . -B ${{ env.BUILD_DIR }} -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=${{ inputs.build_type }} -DLauncher_PORTABLE=OFF -G Ninja
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: Build
|
2022-03-17 21:25:45 +05:30
|
|
|
if: runner.os != 'Windows'
|
|
|
|
run: |
|
|
|
|
cmake --build ${{ env.BUILD_DIR }}
|
|
|
|
|
2022-03-21 23:41:55 +05:30
|
|
|
- name: Build on Windows portable
|
|
|
|
if: runner.os == 'Windows' && matrix.portable == true
|
2022-03-17 21:25:45 +05:30
|
|
|
shell: msys2 {0}
|
2022-02-02 11:58:00 +05:30
|
|
|
run: |
|
2022-02-07 01:05:50 +05:30
|
|
|
cmake --build ${{ env.BUILD_DIR }}
|
2022-03-21 23:41:55 +05:30
|
|
|
|
|
|
|
- name: Build on Windows
|
|
|
|
if: runner.os == 'Windows' && matrix.portable != true
|
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
2022-03-21 23:51:09 +05:30
|
|
|
cmake --build ${{ env.BUILD_DIR }} -DLauncher_PORTABLE=OFF
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: Install
|
2022-03-17 21:25:45 +05:30
|
|
|
if: runner.os != 'Linux' && runner.os != 'Windows'
|
|
|
|
run: |
|
|
|
|
cmake --install ${{ env.BUILD_DIR }}
|
|
|
|
|
|
|
|
- name: Install on Windows
|
|
|
|
if: runner.os == 'Windows'
|
|
|
|
shell: msys2 {0}
|
2022-02-07 01:05:50 +05:30
|
|
|
run: |
|
|
|
|
cmake --install ${{ env.BUILD_DIR }}
|
|
|
|
|
2022-02-20 01:16:43 +05:30
|
|
|
- name: Install on Linux
|
2022-02-10 21:30:03 +05:30
|
|
|
if: runner.os == 'Linux'
|
2022-02-02 11:58:00 +05:30
|
|
|
run: |
|
2022-02-07 01:05:50 +05:30
|
|
|
DESTDIR=${{ env.INSTALL_DIR }} cmake --install ${{ env.BUILD_DIR }}
|
|
|
|
|
2022-02-07 17:49:58 +05:30
|
|
|
- name: Bundle AppImage
|
2022-02-20 01:16:43 +05:30
|
|
|
if: matrix.app_image == true
|
2022-02-07 01:05:50 +05:30
|
|
|
shell: bash
|
|
|
|
run: |
|
2022-02-12 09:09:36 +05:30
|
|
|
export OUTPUT="PolyMC-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage"
|
2022-02-07 18:41:42 +05:30
|
|
|
|
2022-02-07 01:05:50 +05:30
|
|
|
chmod +x linuxdeploy-*.AppImage
|
2022-02-07 18:41:42 +05:30
|
|
|
|
2022-02-07 01:05:50 +05:30
|
|
|
mkdir -p ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-{8,17}-openjdk
|
2022-02-07 18:41:42 +05:30
|
|
|
|
2022-02-07 15:48:47 +05:30
|
|
|
cp -r ${{ github.workspace }}/JREs/jre8/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-8-openjdk
|
2022-02-07 18:41:42 +05:30
|
|
|
|
2022-02-07 15:48:47 +05:30
|
|
|
cp -r ${{ github.workspace }}/JREs/jre17/* ${{ env.INSTALL_DIR }}/usr/lib/jvm/java-17-openjdk
|
2022-02-07 18:41:42 +05:30
|
|
|
|
|
|
|
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 08:55:52 +05:30
|
|
|
./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
|
2022-02-07 01:05:50 +05:30
|
|
|
|
|
|
|
- name: Run macdeployqt
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
|
|
|
cd ${{ env.INSTALL_DIR }}
|
2022-02-12 09:09:36 +05:30
|
|
|
macdeployqt "PolyMC.app" -executable="PolyMC.app/Contents/MacOS/polymc" -always-overwrite
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: chmod binary on macOS
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
2022-02-07 01:05:50 +05:30
|
|
|
chmod +x "${{ github.workspace }}/${{ env.INSTALL_DIR }}/PolyMC.app/Contents/MacOS/polymc"
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: tar bundle on macOS
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
run: |
|
2022-02-07 01:05:50 +05:30
|
|
|
cd ${{ env.INSTALL_DIR }}
|
2022-02-12 09:09:36 +05:30
|
|
|
tar -czf ../PolyMC.tar.gz *
|
2022-02-02 11:58:00 +05:30
|
|
|
|
2022-02-20 01:16:43 +05:30
|
|
|
- name: tar on Linux
|
|
|
|
if: runner.os == 'Linux' && matrix.app_image != true
|
|
|
|
run: |
|
|
|
|
cd ${{ env.INSTALL_DIR }}
|
|
|
|
tar -czf ../PolyMC.tar.gz *
|
|
|
|
|
|
|
|
- name: Upload Linux tar.gz
|
|
|
|
if: runner.os == 'Linux' && matrix.app_image != true
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: PolyMC-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}
|
|
|
|
path: PolyMC.tar.gz
|
|
|
|
|
2022-02-10 21:30:03 +05:30
|
|
|
- name: Upload AppImage for Linux
|
2022-02-20 01:16:43 +05:30
|
|
|
if: matrix.app_image == true
|
2022-02-07 01:05:50 +05:30
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-02-12 09:09:36 +05:30
|
|
|
name: PolyMC-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage
|
|
|
|
path: PolyMC-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}-x86_64.AppImage
|
2022-02-07 01:05:50 +05:30
|
|
|
|
2022-03-17 21:25:45 +05:30
|
|
|
- name: Copy OpenSSL libs on Windows x86
|
|
|
|
if: runner.os == 'Windows' && matrix.msystem == 'mingw32'
|
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
|
|
|
cp /mingw32/bin/libcrypto-1_1.dll ${{ env.INSTALL_DIR }}/
|
|
|
|
cp /mingw32/bin/libssl-1_1.dll ${{ env.INSTALL_DIR }}/
|
|
|
|
|
|
|
|
- name: Copy OpenSSL libs on Windows x86_64
|
|
|
|
if: runner.os == 'Windows' && matrix.msystem == 'mingw64'
|
|
|
|
shell: msys2 {0}
|
|
|
|
run: |
|
|
|
|
cp /mingw64/bin/libcrypto-1_1-x64.dll ${{ env.INSTALL_DIR }}/
|
|
|
|
cp /mingw64/bin/libssl-1_1-x64.dll ${{ env.INSTALL_DIR }}/
|
|
|
|
|
2022-02-10 21:30:03 +05:30
|
|
|
- name: Upload package for Windows
|
|
|
|
if: runner.os == 'Windows'
|
2022-02-02 11:58:00 +05:30
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-03-19 02:58:52 +05:30
|
|
|
name: PolyMC-${{ matrix.name }}-${{ env.VERSION }}-${{ inputs.build_type }}
|
2022-02-07 01:05:50 +05:30
|
|
|
path: ${{ env.INSTALL_DIR }}/**
|
2022-02-02 11:58:00 +05:30
|
|
|
|
|
|
|
- name: Upload package for macOS
|
|
|
|
if: runner.os == 'macOS'
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
2022-02-12 09:09:36 +05:30
|
|
|
name: PolyMC-${{ runner.os }}-${{ env.VERSION }}-${{ inputs.build_type }}
|
|
|
|
path: PolyMC.tar.gz
|