-
Notifications
You must be signed in to change notification settings - Fork 11
87 lines (72 loc) · 2.86 KB
/
ci-mac.yml
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
name: macOS build
on:
pull_request:
branches:
- "*"
push:
branches:
- "*"
paths:
# This action only runs on push when C++ files are changed
- "**.cpp"
- "**.h"
- "**.cmake"
- "**Lists.txt"
- "**-mac.yml"
workflow_dispatch:
env:
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules
jobs:
build:
name: ${{ matrix.config.name }} (${{ matrix.buildtype }})
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- { name: "macOS 11", os: macos-11 }
- { name: "macOS 12", os: macos-12 }
buildtype: [Release, Debug]
steps:
- name: Install dependencies
run: brew install ninja create-dmg freetype
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/cache@v3
with:
path: "**/cpm_modules"
key: ${{ github.workflow }}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }}
# Setup caching of build artifacts to reduce total build time (only Linux and MacOS)
- name: ccache
uses: hendrikmuhs/[email protected]
with:
key: ${{ matrix.config.os }}-${{ matrix.buildtype }}
- name: Create Build Environment
run: cmake -E make_directory ${{github.workspace}}/build
- name: Configure CMake
run: |
cmake -B ${{github.workspace}}/build/${{ matrix.buildtype }} -G Ninja -DCMAKE_BUILD_TYPE=${{ matrix.buildtype }} -DCMAKE_POLICY_DEFAULT_CMP0135=NEW -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_OSX_DEPLOYMENT_TARGET=10.15
# -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64"
- name: Build
run: cmake --build ${{github.workspace}}/build/${{ matrix.buildtype }} --parallel 4 --config ${{ matrix.buildtype }}
- name: Checking that HDRView runs
run: |
${{github.workspace}}/build/${{ matrix.buildtype }}/HDRView.app/Contents/MacOS/HDRView --help
- name: Creating dmg (macOS)
run: |
RESULT="${{github.workspace}}/build/${{ matrix.buildtype }}/HDRView.dmg"
test -f $RESULT && rm $RESULT
create-dmg --window-size 500 300 --icon-size 96 --volname "HDRView Installer" --app-drop-link 360 105 --icon HDRView.app 130 105 $RESULT ${{github.workspace}}/build/${{ matrix.buildtype }}/HDRView.app
- name: Archive dmg (macOS)
uses: actions/upload-artifact@v3
with:
name: HDRView-${{ matrix.config.os }}-${{ matrix.buildtype }}.dmg
path: |
${{github.workspace}}/build/${{ matrix.buildtype }}/HDRView.dmg
- name: Archive build artifacts
uses: actions/upload-artifact@v3
with:
name: build-artifacts-${{ matrix.config.os }}-${{ matrix.buildtype }}
path: |
${{github.workspace}}/build/${{ matrix.buildtype }}