-
Notifications
You must be signed in to change notification settings - Fork 0
197 lines (163 loc) · 7.22 KB
/
macos.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
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
191
192
193
194
195
196
197
# This is a basic workflow to help you get started with Actions
name: macOS Installer build
# Controls when the workflow will run
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
debug_enabled:
type: boolean
description: 'Run the build with tmate debugging enabled'
required: false
default: false
# run this task every week at 2am
schedule:
- cron: '0 2 * * 0'
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: macos-latest
# setup environment variables
env:
MACOS_CERTIFICATE: ${{ secrets.MACOS_CERTIFICATE }}
MACOS_CERTIFICATE_PWD: ${{ secrets.MACOS_CERTIFICATE_PWD }}
MACOS_CERTIFICATE_NAME: ${{ secrets.MACOS_CERTIFICATE_NAME }}
MACOS_KEYCHAIN_PWD: ${{ secrets.MACOS_KEYCHAIN_PWD }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: seanmiddleditch/gha-setup-ninja@master
- uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: install dependencies
shell: bash
run: |
brew install wget astyle openjdk gawk coreutils bash
brew install --cask mono-mdk
- name: create virtual environment
shell: bash
run: |
python3 -m venv env-build
source ./env-build/bin/activate
pip install aqtinstall swig cmake ninja
aqt install-qt mac desktop 6.8.0 clang_64 -m qt5compat qtcharts qtdatavis3d
ls $PWD/6.8.0/macos/bin
- name: checkout build system
run: |
git clone https://github.com/copasi/build-system
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
- name: initialize build system, compile dependencies
shell: bash
run: |
# print bash version
bash --version
# print bash location
which bash
export PATH=$PWD/env-build/bin:$PATH
export HOME_BUILD_SYSTEM=$PWD
source ./env-build/bin/activate
source build-system/profile/darwin-universal
export Qt6_DIR=$PWD/6.8.0/macos
export PATH=$PWD/6.8.0/macos/bin/:$PATH
export SELECT_QT=Qt6
# emerge
emerge
# build dependencies, ignore exit code
install-dependencies || true
- name: build release
shell: bash
run: |
# print bash version
bash --version
# print bash location
which bash
export PATH=$PWD/env-build/bin:$PATH
export HOME_BUILD_SYSTEM=$PWD
source ./env-build/bin/activate
source build-system/profile/darwin-universal
export Qt6_DIR=$PWD/6.8.0/macos
export PATH=$PWD/6.8.0/macos/bin/:$PATH
export SELECT_QT=Qt6
# build release
release --branch release/Version-4.45 --comment stable --noscp
# remove binding folders as we have the tar.gz by now
rm -rf build-system/packages/setup.release/*Bindings*Darwin
- name: extract COPASI Version and add it to environment
shell: bash
run: |
# extract version
AWK=${COPASI_AWK:-gawk}
SOURCE=build-system/git/COPASI.release
major=`${AWK} -- '$2 ~ "COPASI_VERSION_MAJOR" {print $3}' "${SOURCE}/copasi/CopasiVersion.h"`
minor=`${AWK} -- '$2 ~ "COPASI_VERSION_MINOR" {print $3}' "${SOURCE}/copasi/CopasiVersion.h"`
build=`${AWK} -- '$2 ~ "COPASI_VERSION_BUILD" {print $3}' "${SOURCE}/copasi/CopasiVersion.h"`
modified=`${AWK} -- '$2 ~ "COPASI_VERSION_MODIFIED" {print $3}' "${SOURCE}/copasi/CopasiVersion.h"`
comment=`${AWK} -- '$2 ~ "COPASI_VERSION_COMMENT" {print $3}' "${SOURCE}/copasi/CopasiVersion.h"`
buildname=${build}
if [ $modified == true ]; then
buildname=${buildname}+
fi
MyAppVersion=${major}.${minor}.${build}
echo "COPASI_VERSION_ONLY=$MyAppVersion" >> $GITHUB_ENV
if [ x"${comment}" = x\"Snapshot\" ]; then
MyAppVersion=${major}.
[ ${#minor} = 1 ] && MyAppVersion=${MyAppVersion}0
MyAppVersion=${MyAppVersion}${minor}.
[ ${#build} = 1 ] && MyAppVersion=${MyAppVersion}0
MyAppVersion=${MyAppVersion}${build}
fi
export COPASI_VERSION=$MyAppVersion
echo "COPASI_VERSION=$COPASI_VERSION" >> $GITHUB_ENV
- name: create keychain, sign executables create DMG
shell: bash
run: |
echo -n "$MACOS_CERTIFICATE" | base64 --decode -o certificate.p12
security create-keychain -p "$MACOS_KEYCHAIN_PWD" build.keychain
security default-keychain -s build.keychain
security unlock-keychain -p "$MACOS_KEYCHAIN_PWD" build.keychain
security import certificate.p12 -k build.keychain -P "$MACOS_CERTIFICATE_PWD" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple:,codesign: -s -k "$MACOS_KEYCHAIN_PWD" build.keychain
security list-keychain -d user -s build.keychain
security find-identity -v -p codesigning
# now sign the executables
export HOME_BUILD_SYSTEM=$PWD
pushd build-system/packages/setup.release/COPASI-${COPASI_VERSION_ONLY}-Darwin/COPASI/
cp $HOME_BUILD_SYSTEM/build-system/src/entitlements.plist .
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime --entitlements ./entitlements.plist CopasiUI.app -v
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" --options runtime --entitlements ./entitlements.plist CopasiSE -v
/usr/bin/codesign -vvvv CopasiUI.app
rm entitlements.plist
popd
# now create the DMG
pushd build-system/packages/setup.release/
hdiutil create -volname COPASI-${COPASI_VERSION}-Darwin -fs HFS+ -srcfolder ./COPASI-${COPASI_VERSION_ONLY}-Darwin/ -ov -format UDZO COPASI-${COPASI_VERSION_ONLY}-Darwin
/usr/bin/codesign --force -s "$MACOS_CERTIFICATE_NAME" COPASI-${COPASI_VERSION_ONLY}-Darwin.dmg -v
popd
# remove the keychain
security delete-keychain build.keychain
- name: create release archive
shell: bash
run: |
# zip the COPASI-*-Darwin folder
pushd build-system/packages/setup.release/
zip -r -q -y COPASI-$COPASI_VERSION-Darwin.zip ./COPASI-${COPASI_VERSION_ONLY}-Darwin/
popd
- uses: actions/upload-artifact@v4
with:
name: macOS
path: |
build-system/packages/setup.release/*.zip
build-system/packages/setup.release/*.tar.gz
retention-days: 7
if-no-files-found: error
- uses: actions/upload-artifact@v4
with:
name: macOS DMG
path: |
build-system/packages/setup.release/*.dmg
retention-days: 7
if-no-files-found: error