summaryrefslogtreecommitdiff
path: root/.github/workflows/meshmc-build.yml
blob: d7b0a2335e5701b7b619488f334ac8122bc60096 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
name: "MeshMC: Build"

concurrency:
  group: meshmc-${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

on:
  push:
    branches:
      - 'master'
    paths:
      - 'meshmc/**'
      - '.github/workflows/meshmc-build.yml'
      - '.github/actions/meshmc/**'
  merge_group:
    types: [checks_requested]
  pull_request:
    paths:
      - 'meshmc/**'
      - '.github/workflows/meshmc-build.yml'
      - '.github/actions/meshmc/**'
  workflow_call:
    inputs:
      build-type:
        description: Type of build (Debug or Release)
        type: string
        default: Debug
      environment:
        description: Deployment environment to run under
        type: string
  workflow_dispatch:
    inputs:
      build-type:
        description: Type of build (Debug or Release)
        type: string
        default: Debug

permissions: {}

jobs:
  build:
    name: Build (${{ matrix.artifact-name }})

    environment: ${{ inputs.environment || '' }}

    permissions:
      contents: read
      id-token: write
      packages: write

    strategy:
      fail-fast: false
      matrix:
        include:
          - os: ubuntu-24.04
            artifact-name: Linux
            cmake-preset: linux
            qt-version: 6.10.2

          - os: ubuntu-24.04-arm
            artifact-name: Linux-aarch64
            cmake-preset: linux
            qt-version: 6.10.2

          - os: windows-2022
            artifact-name: Windows-MinGW-w64
            cmake-preset: windows_mingw
            msystem: CLANG64
            vcvars-arch: amd64_x86

          - os: windows-11-arm
            artifact-name: Windows-MinGW-arm64
            cmake-preset: windows_mingw
            msystem: CLANGARM64
            vcvars-arch: arm64

          - os: windows-2022
            artifact-name: Windows-MSVC
            cmake-preset: windows_msvc
            vcvars-arch: amd64
            qt-version: 6.10.2

          - os: windows-11-arm
            artifact-name: Windows-MSVC-arm64
            cmake-preset: windows_msvc
            vcvars-arch: arm64
            qt-version: 6.10.2

          - os: macos-26
            artifact-name: macOS
            cmake-preset: macos_universal
            macosx-deployment-target: 12.0
            qt-version: 6.9.3

    runs-on: ${{ matrix.os }}

    defaults:
      run:
        shell: ${{ matrix.msystem != '' && 'msys2 {0}' || 'bash' }}
        working-directory: meshmc

    env:
      ARTIFACT_NAME: ${{ matrix.artifact-name }}-Qt6
      BUILD_PLATFORM: official
      BUILD_TYPE: ${{ inputs.build-type || 'Debug' }}
      CMAKE_PRESET: ${{ matrix.cmake-preset }}
      MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macosx-deployment-target }}

    steps:
      ##
      # SETUP
      ##

      - name: Checkout
        uses: actions/checkout@v6
        with:
          submodules: true

      - name: Setup dependencies
        id: setup-dependencies
        uses: ./.github/actions/meshmc/setup-dependencies
        with:
          build-type: ${{ env.BUILD_TYPE }}
          artifact-name: ${{ matrix.artifact-name }}
          msystem: ${{ matrix.msystem }}
          vcvars-arch: ${{ matrix.vcvars-arch }}
          qt-version: ${{ matrix.qt-version }}

      ##
      # BUILD
      ##

      - name: Configure project
        run: |
          cmake --preset "$CMAKE_PRESET"

      - name: Run build
        run: |
          cmake --build --preset "$CMAKE_PRESET" --config "$BUILD_TYPE"

      - name: Run tests
        run: |
          ctest --preset "$CMAKE_PRESET" --build-config "$BUILD_TYPE"

      ##
      # PACKAGE
      ##

      - name: Get short version
        id: short-version
        shell: bash
        run: |
          echo "version=$(git rev-parse --short HEAD)" >> "$GITHUB_OUTPUT"

      - name: Package (Linux)
        if: ${{ runner.os == 'Linux' }}
        uses: ./.github/actions/meshmc/package/linux
        with:
          version: ${{ steps.short-version.outputs.version }}
          build-type: ${{ steps.setup-dependencies.outputs.build-type }}
          artifact-name: ${{ matrix.artifact-name }}
          qt-version: ${{ steps.setup-dependencies.outputs.qt-version }}
          gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
          gpg-private-key-id: ${{ secrets.GPG_PRIVATE_KEY_ID }}

      - name: Package (macOS)
        if: ${{ runner.os == 'macOS' }}
        uses: ./.github/actions/meshmc/package/macos
        with:
          version: ${{ steps.short-version.outputs.version }}
          build-type: ${{ steps.setup-dependencies.outputs.build-type }}
          artifact-name: ${{ matrix.artifact-name }}
          apple-codesign-cert: ${{ secrets.APPLE_CODESIGN_CERT }}
          apple-codesign-password: ${{ secrets.APPLE_CODESIGN_PASSWORD }}
          apple-codesign-id: ${{ secrets.APPLE_CODESIGN_ID }}
          apple-notarize-apple-id: ${{ secrets.APPLE_NOTARIZE_APPLE_ID }}
          apple-notarize-team-id: ${{ secrets.APPLE_NOTARIZE_TEAM_ID }}
          apple-notarize-password: ${{ secrets.APPLE_NOTARIZE_PASSWORD }}
          sparkle-ed25519-key: ${{ secrets.SPARKLE_ED25519_KEY }}

      - name: Package (Windows)
        if: ${{ runner.os == 'Windows' }}
        uses: ./.github/actions/meshmc/package/windows
        with:
          version: ${{ steps.short-version.outputs.version }}
          build-type: ${{ env.BUILD_TYPE }}
          artifact-name: ${{ matrix.artifact-name }}
          windows-codesign-cert: ${{ secrets.WINDOWS_CODESIGN_CERT }}
          windows-codesign-password: ${{ secrets.WINDOWS_CODESIGN_PASSWORD }}
          msystem: ${{ matrix.msystem }}