aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows/build.yml
blob: d7eeaf1d5f74ae701221536ffd367adcb7ebd5cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: build_portable

on:
  [push, pull_request, workflow_dispatch]

jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        include:

          - os: ubuntu-20.04
            qt_version: 5.12.8
            qt_host: linux

          - os: windows-2022
            qt_version: 5.15.2
            qt_host: windows
            qt_arch: win64_mingw81

          - 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}}

    steps:

      - 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/"
          key: ${{ runner.os }}-${{ matrix.qt_version }}-qt_cache

      - 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

      - name: Configure CMake
        run: |
          cmake -S . -B build -DCMAKE_INSTALL_PREFIX=install -DCMAKE_BUILD_TYPE=Debug -G Ninja

      - name: Build
        run: |
          cmake --build build

      - name: Install
        run: |
          cmake --install build

      - name: Install OpenSSL libs
        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_x64
          copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x64\bin\libssl-1_1-x64.dll" "${{ github.workspace }}\install\"
          copy "${{ github.workspace }}\Qt\Tools\OpenSSL\Win_x64\bin\libcrypto-1_1-x64.dll" "${{ github.workspace }}\install\"

      - name: chmod binary on macOS
        if: runner.os == 'macOS'
        run: |
          chmod +x "${{ github.workspace }}/install/PolyMC.app/Contents/MacOS/polymc"

      - name: tar bundle on macOS
        if: runner.os == 'macOS'
        run: |
          cd install
          tar -czf ../polymc.tar.gz *

      - name: Upload package for Linux and Windows
        if: runner.os != 'macOS'
        uses: actions/upload-artifact@v2
        with:
          name: polymc-${{ matrix.os }}-portable
          path: install/**

      - name: Upload package for macOS
        if: runner.os == 'macOS'
        uses: actions/upload-artifact@v2
        with:
          name: polymc-${{ matrix.os }}-portable
          path: polymc.tar.gz