forked from geany/geany
-
Notifications
You must be signed in to change notification settings - Fork 0
170 lines (162 loc) · 6.26 KB
/
windows-msys2-build.yml
File metadata and controls
170 lines (162 loc) · 6.26 KB
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
name: Windows/MSYS2 Build
on:
push:
branches:
- master
tags:
- '[0-9]**'
pull_request:
branches:
- master
workflow_dispatch:
inputs:
sign_artifacts:
description: 'Sign artifacts'
required: false
type: boolean
env:
SCCACHE_DIR: ${{ github.workspace }}/.sccache
SCCACHE_CACHE_SIZE: 1G
jobs:
msys2-mingw64:
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- build-tool: autotools
- build-tool: meson
defaults:
run:
shell: msys2 {0}
env:
CC: sccache gcc
CXX: sccache g++
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup MSYS2
uses: msys2/setup-msys2@v2
with:
msystem: UCRT64
update: true
install: |
mingw-w64-ucrt-x86_64-gcc
mingw-w64-ucrt-x86_64-${{ matrix.build-tool }}
${{ matrix.build-tool == 'meson' && 'mingw-w64-ucrt-x86_64-jq' || '' }}
mingw-w64-ucrt-x86_64-sccache
mingw-w64-ucrt-x86_64-gtk3
mingw-w64-ucrt-x86_64-python-docutils
patch
rsync
unzip
dos2unix
mingw-w64-ucrt-x86_64-nsis
# build the GTK bundle, but cache it for a week
- name: Cache timestamp for GTK-Bundle
id: cache_gtk_bundle_timestamp
# we use a Monday-based weekly cache, so it usually doesn't change
# right before a release, as we usually do them on Sundays.
run: echo "timestamp=$(date +%Y-%W)" >> $GITHUB_OUTPUT
- name: Cache GTK-Bundle
id: cache_gtk_bundle
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/geany_build/bundle/geany-gtk
key: ${{ runner.os }}-${{ github.job }}-bundle-geany-gtk-${{ hashFiles('scripts/gtk-bundle-from-msys2.sh') }}-${{ steps.cache_gtk_bundle_timestamp.outputs.timestamp }}
- name: GTK-Bundle
if: steps.cache_gtk_bundle.outputs.cache-hit != 'true'
run: |
mkdir -p geany_build/bundle/geany-gtk
cd geany_build/bundle/geany-gtk
bash $(cygpath -u "${GITHUB_WORKSPACE}")/scripts/gtk-bundle-from-msys2.sh -3 --ucrt64
- name: Configure sccache
uses: actions/cache@v4
with:
path: ${{ env.SCCACHE_DIR }}
key: ${{ runner.os }}-${{ github.job }}-${{ matrix.build-tool }}-sccache-${{ github.run_id }}
restore-keys: ${{ runner.os }}-${{ github.job }}-${{ matrix.build-tool }}-sccache-
- name: Prepare Build environment
run: |
echo "DESTINATION=$(cygpath -u "${GITHUB_WORKSPACE}")/geany_build" >> $GITHUB_ENV
- name: Build (Autotools)
if: matrix.build-tool == 'autotools'
run: |
echo "VERSION=$(autom4te --no-cache --language=Autoconf-without-aclocal-m4 --trace AC_INIT:\$2 configure.ac)" >> $GITHUB_ENV
NOCONFIGURE=1 ./autogen.sh
export lt_cv_deplibs_check_method=${lt_cv_deplibs_check_method='pass_all'}
mkdir -p _build
cd _build
../configure --prefix=${DESTINATION}/build/geany --disable-silent-rules
make -j
make install
- name: Build (Meson)
if: matrix.build-tool == 'meson'
run: |
echo "VERSION=$(meson introspect --projectinfo meson.build | jq -r .version)" >> $GITHUB_ENV
meson setup --prefix=${DESTINATION}/build/geany _build .
meson compile -C _build
meson install -C _build
- name: Compile NSIS
run: |
mkdir -p ${DESTINATION}/release/geany-orig
rsync -a --delete ${DESTINATION}/build/geany/ ${DESTINATION}/release/geany-orig
python scripts/msys2-geany-release.py ${VERSION}
# Test the resulting installer. We use cmd.exe as the shell because the
# installer doesn't seem to love MSYS2 for some reason.
- name: Test NSIS
shell: cmd
run: |
ECHO ON
SET DESTINATION=%GITHUB_WORKSPACE%\geany_install
start "geany-%VERSION%_setup.exe" /wait %GITHUB_WORKSPACE%\geany_build\geany-%VERSION%_setup.exe /S /D=%DESTINATION%
IF NOT EXIST "%DESTINATION%\uninst.exe" EXIT /B 1
IF NOT EXIST "%DESTINATION%\bin\geany.exe" EXIT /B 1
IF NOT EXIST "%DESTINATION%\lib\geany\export.dll" EXIT /B 1
IF EXIST "%DESTINATION%\lib\geany\demoplugin.dll" EXIT /B 1
- name: Test installed Geany
shell: cmd
run: |
%GITHUB_WORKSPACE%\geany_install\bin\geany.exe --version
- name: Test NSIS uninstaller
shell: cmd
run: |
ECHO ON
SET DESTINATION=%GITHUB_WORKSPACE%\geany_install
start "uninst" /wait %DESTINATION%\uninst.exe /S
REM it seems the uninstaller returns earlier than the files are actually removed, so wait a moment
ping -n 10 127.0.0.1 >NUL
IF EXIST "%DESTINATION%" EXIT /B 1
- name: Upload Unsigned Artifact
id: upload-unsigned-artifact
uses: actions/upload-artifact@v5
with:
name: geany-unsigned${{ matrix.build-tool != 'autotools' && format('-{0}', matrix.build-tool) || '' }}
path: geany_build/*.exe
retention-days: 3
overwrite: true
if-no-files-found: error
- name: sccache statistics
run: sccache --show-stats
- name: SignPath Signing
id: sign-artifact
uses: signpath/github-action-submit-signing-request@v2
# Only sign artifacts on tags
if: matrix.build-tool == 'autotools' && (inputs.sign_artifacts || startsWith(github.ref, 'refs/tags/'))
with:
api-token: '${{ secrets.SIGNPATH_API_TOKEN }}'
organization-id: '${{ vars.SIGNPATH_ORGANIZATION_ID }}'
project-slug: 'geany'
signing-policy-slug: 'release-signing'
github-artifact-id: '${{ steps.upload-unsigned-artifact.outputs.artifact-id }}'
wait-for-completion: true
output-artifact-directory: geany-signed
- name: Upload Signed Artifact
uses: actions/upload-artifact@v5
if: steps.sign-artifact.outcome == 'success'
with:
name: geany-signed
path: geany-signed
retention-days: 3
overwrite: true
if-no-files-found: error