-
Notifications
You must be signed in to change notification settings - Fork 5
153 lines (128 loc) · 5.59 KB
/
macos-build.yaml
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
##############################################################################
# Copyright 2022-2024 Leon Lynch
#
# This file is licensed under the terms of the LGPL v2.1 license.
# See LICENSE file.
##############################################################################
name: MacOS build
on: [push]
jobs:
build-macos-debug:
strategy:
fail-fast: false
matrix:
include:
- { name: "MacOS 13", os: macos-13, osx_arch: "x86_64", build_type: "Debug", lib_type: "static", shared_libs: "NO", deps: "none", fetch_deps: YES, build_emv_tool: NO, build_emv_viewer: NO }
- { name: "MacOS 13", os: macos-13, osx_arch: "x86_64", build_type: "Debug", lib_type: "shared", shared_libs: "YES", deps: "pcsclite/qt5", fetch_deps: NO, build_emv_tool: YES, build_emv_viewer: YES }
- { name: "MacOS 13", os: macos-13, osx_arch: "x86_64", build_type: "Release", lib_type: "shared", shared_libs: "YES", deps: "pcsclite/qt6", fetch_deps: YES, build_emv_tool: YES, build_emv_viewer: YES }
- { name: "MacOS 14", os: macos-14, osx_arch: "arm64", build_type: "Release", lib_type: "static", shared_libs: "NO", deps: "none", fetch_deps: NO, build_emv_tool: NO, build_emv_viewer: NO }
- { name: "MacOS 14", os: macos-14, osx_arch: "arm64", build_type: "Release", lib_type: "shared", shared_libs: "YES", deps: "pcsclite/qt5", fetch_deps: NO, build_emv_tool: YES, build_emv_viewer: YES }
- { name: "MacOS 14", os: macos-14, osx_arch: "arm64", build_type: "Debug", lib_type: "static", shared_libs: "NO", deps: "pcsclite/qt6", fetch_deps: YES, build_emv_tool: YES, build_emv_viewer: YES }
name: ${{ matrix.name }} (${{ matrix.osx_arch }}) build (${{ matrix.lib_type}}/${{ matrix.build_type }}/${{ matrix.deps }})
runs-on: ${{ matrix.os }}
steps:
- name: Install dependencies
run: |
brew install boost
brew install iso-codes
brew install json-c
- name: Install argp-standalone using brew
if: ${{ matrix.fetch_deps == 'NO' }}
run: brew install argp-standalone
- name: Install PCSCLite using brew
if: contains(matrix.deps, 'pcsclite')
run: |
brew install pcsc-lite
echo "PKG_CONFIG_PATH=$(brew --prefix pcsc-lite)/lib/pkgconfig" >> $GITHUB_ENV
- name: Install Qt5 using brew
# Homebrew doesn't support universal binaries so only install Qt for arch-specific builds
if: contains(matrix.deps, 'qt5')
run: |
brew install qt@5
echo "QT_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5" >> $GITHUB_ENV
- name: Install Qt6 using brew
# Homebrew doesn't support universal binaries so only install Qt for arch-specific builds
if: contains(matrix.deps, 'qt6')
run: |
brew install qt@6
echo "QT_DIR=$(brew --prefix qt@6)/lib/cmake/Qt6" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_OSX_ARCHITECTURES="${{ matrix.osx_arch }}" \
-DCMAKE_BUILD_TYPE="${{ matrix.build_type }}" \
-DBUILD_SHARED_LIBS=${{ matrix.shared_libs }} \
-DFETCH_ARGP=${{ matrix.fetch_deps }} \
-DBUILD_EMV_DECODE=YES \
-DBUILD_EMV_TOOL=${{ matrix.build_emv_tool }} \
-DBUILD_EMV_VIEWER=${{ matrix.build_emv_viewer }}
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
build-macos-release:
name: MacOS 13 (release)
runs-on: macos-13
steps:
- name: Install dependencies
run: |
brew install boost
brew install iso-codes
brew install json-c
brew install pcsc-lite
echo "PKG_CONFIG_PATH=$(brew --prefix pcsc-lite)/lib/pkgconfig" >> $GITHUB_ENV
brew install qt@5
echo "QT_DIR=$(brew --prefix qt@5)/lib/cmake/Qt5" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
submodules: recursive
- name: Get version from git tag
run: echo "GIT_DESCRIBE=$(git describe --always --dirty)" >> $GITHUB_ENV
- name: Prepare keychain
env:
OPENEMV_MACOS_CERT_BASE64: ${{ secrets.OPENEMV_MACOS_CERT_BASE64 }}
OPENEMV_MACOS_CERT_PWD: ${{ secrets.OPENEMV_MACOS_CERT_PWD }}
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }}
run: scripts/prepare_macos_keychain.sh
- name: Configure CMake
run: |
cmake -B build \
-DCMAKE_OSX_ARCHITECTURES="x86_64" \
-DCMAKE_BUILD_TYPE="RelWithDebInfo" \
-DFETCH_ARGP=YES \
-DBUILD_EMV_DECODE=YES \
-DBUILD_EMV_TOOL=YES \
-DBUILD_EMV_VIEWER=YES \
-DBUILD_MACOSX_BUNDLE=YES \
-DCPACK_COMMAND_HDIUTIL="/usr/bin/sudo /usr/bin/hdiutil" \
-DSIGN_MACOSX_BUNDLE=openemv.org
- name: Build
run: cmake --build build
- name: Test
run: ctest --test-dir build --output-on-failure
- name: Package
run: cmake --build build --target package
- name: Clean up keychain
if: ${{ always() }}
run: scripts/cleanup_macos_keychain.sh
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: emv-utils-${{ env.GIT_DESCRIBE }}-macos
path: |
build/emv-utils-*.tar.gz
build/emv-utils-*.dmg
if-no-files-found: error
- name: Upload build directory if failed
if: ${{ failure() }}
uses: actions/upload-artifact@v4
with:
name: emv-utils-${{ env.GIT_DESCRIBE }}-macos-build
path: ./
if-no-files-found: error