-
Notifications
You must be signed in to change notification settings - Fork 270
281 lines (244 loc) · 9.73 KB
/
build.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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
#
# Copyright: 2022, The Geany contributors
# License: GNU GPL v2 or later
name: CI Build
on:
push:
branches:
- master
pull_request:
branches:
- master
workflow_dispatch:
# cancel already running builds of the same branch or pull request
concurrency:
group: ci-${{ github.head_ref }} || concat(${{ github.ref }}
cancel-in-progress: true
env:
CFLAGS: -g -O2 -Werror=pointer-arith -Werror=implicit-function-declaration
CONFIGURE_FLAGS: --disable-silent-rules
CCACHE_DIR: ${{ github.workspace }}/.ccache
CCACHE_COMPRESS: true
CCACHE_MAXSIZE: 1G
PYTHON: python3
JOBS: 2
DEBUG: 0
jobs:
linux:
name: Linux Build
runs-on: ubuntu-20.04
env:
CC: ccache gcc
CXX: ccache g++
GEANY_SOURCE_PATH: ${{ github.workspace }}/.geany_source
GEANY_CACHE_PATH: ${{ github.workspace }}/.geany_cache
GEANY_INSTALLATION_PATH: ${{ github.workspace }}/.geany_cache/_geany_install
PKG_CONFIG_PATH: ${{ github.workspace }}/.geany_cache/_geany_install/lib/pkgconfig:$PKG_CONFIG_PATH
LD_LIBRARY_PATH: ${{ github.workspace }}/.geany_cache/_geany_install/lib:$LD_LIBRARY_PATH
steps:
- name: Checkout Geany-Plugins
uses: actions/checkout@v4
- name: Checkout Geany
uses: actions/checkout@v4
with:
repository: geany/geany
path: ${{ env.GEANY_SOURCE_PATH }}
token: ${{ github.token }}
# create and use a timestamp for the cache key: GH Actions will never update a cache
# only use an existing cache item or create a new one. To use an existing cache *and*
# push back the the updated cache after build, we use a always new cache key (to force
# the creation of the cache item at the end) in combination with "restore-keys" as fallback
- name: Prepare ccache timestamp
id: ccache_cache_timestamp
run: echo "timestamp=$(date +%Y-%m-%d-%H-%M)" >> $GITHUB_OUTPUT
- name: Configure ccache
uses: actions/cache@v4
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.os }}-${{ github.job }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: ${{ runner.os }}-${{ github.job }}-ccache-
- name: Prepare Geany Cache Key
id: prepare_geany_cache_key
working-directory: ${{ env.GEANY_SOURCE_PATH }}
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Configure Geany Cache
id: geany_cache
uses: actions/cache@v4
with:
path: ${{ env.GEANY_CACHE_PATH }}
key: ${{ runner.os }}-${{ github.job }}-geany-cache-${{ steps.prepare_geany_cache_key.outputs.commit_hash }}
- name: Show environment
if: ${{ env.DEBUG == '1' }}
run: |
env | sort
- name: Install Dependencies
run: |
sudo apt-get update --quiet --quiet
# write dependencies to a temporary file which is then fed to "apt-get install",
# so we can use comments in the dependency list
cat << EOF > $RUNNER_TEMP/dependencies
# general
ccache
libtool
libgtk-3-dev
# geany
autopoint
gettext
python-docutils
# geany-plugins
intltool
check
cppcheck
# debugger
libvte-2.91-dev
# geanygendoc
libctpl-dev
# geanylua
liblua5.1-0-dev
# geanypg
libgpgme-dev
# geanyvc
libgtkspell-dev
libgtkspell3-3-dev
# geaniuspaste/updatechecker
libsoup2.4-dev
# git-changebar
libgit2-dev
# markdown
libmarkdown2-dev
# markdown/webhelper
libwebkit2gtk-4.0-dev
# pretty-printer
libxml2-dev
# spellcheck
libenchant-dev
EOF
grep -v '^[ ]*#' $RUNNER_TEMP/dependencies | xargs sudo apt-get install --assume-yes --no-install-recommends
- name: Build Geany
if: steps.geany_cache.outputs.cache-hit != 'true'
run: |
cd "${{ env.GEANY_SOURCE_PATH }}"
NOCONFIGURE=1 ./autogen.sh
mkdir _build
cd _build
{ ../configure --prefix="${{ env.GEANY_INSTALLATION_PATH }}" || { cat config.log; exit 1; } ; }
make -j ${{ env.JOBS }}
make -j ${{ env.JOBS }} install
- name: Configure
run: |
NOCONFIGURE=1 ./autogen.sh
mkdir _build
cd _build
{ ../configure $CONFIGURE_FLAGS || { cat config.log; exit 1; } ; }
- name: Build
run: |
cd _build
make -j ${{ env.JOBS }}
- name: Run Tests
run: |
cd _build
make -j ${{ env.JOBS }} check
- name: Run distcheck
run: |
cd _build
make -j ${{ env.JOBS }} distcheck DISTCHECK_CONFIGURE_FLAGS="${{ env.CONFIGURE_FLAGS }}";
- name: ccache statistics
if: ${{ env.DEBUG == '1' }}
run: ccache --show-stats
mingw64:
name: Mingw-w64 Build (Windows)
runs-on: ubuntu-20.04
env:
GEANY_SOURCE_PATH: ${{ github.workspace }}/.geany_source
GEANY_CACHE_PATH: ${{ github.workspace }}/.geany_cache
INFRASTRUCTURE_PATH: ${{ github.workspace }}/.infrastructure
BUILDER_PATH: ${{ github.workspace }}/.infrastructure/builders
DOCKER_REGISTRY: "ghcr.io"
DOCKER_IMAGE_NAME: "geany-mingw64-ci"
DOCKER_IMAGE_TAG: "ghcr.io/geany/geany-mingw64-ci:latest"
steps:
- name: Checkout Geany-Plugins
uses: actions/checkout@v4
- name: Checkout Geany
uses: actions/checkout@v4
with:
repository: geany/geany
path: ${{ env.GEANY_SOURCE_PATH }}
token: ${{ github.token }}
- name: Checkout Build Scripts
uses: actions/checkout@v4
with:
ref: master
repository: geany/infrastructure
path: ${{ env.INFRASTRUCTURE_PATH }}
token: ${{ github.token }}
- uses: jwalton/gh-find-current-pr@v1
id: find_pull_request
with:
state: open
- name: Define environment variables
run: |
echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
echo "GITHUB_PULL_REQUEST=${GITHUB_PULL_REQUEST}" >> $GITHUB_ENV
echo "GITHUB_PULL_REQUEST_OR_REF=${GITHUB_PULL_REQUEST:-${{ github.ref_name }}}" | tr '/' '-' >> $GITHUB_ENV
env:
GITHUB_PULL_REQUEST: ${{ steps.find_pull_request.outputs.pr }}
- name: Prepare Geany Cache Key
id: prepare_geany_cache_key
working-directory: ${{ env.GEANY_SOURCE_PATH }}
run: echo "commit_hash=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
- name: Configure Geany Cache
id: geany_cache
uses: actions/cache@v4
with:
path: ${{ env.GEANY_CACHE_PATH }}
key: ${{ runner.os }}-${{ github.job }}-geany-mingw64-cache-${{ steps.prepare_geany_cache_key.outputs.commit_hash }}
- name: Show Environment
if: ${{ env.DEBUG == '1' }}
run: |
env | sort
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.DOCKER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull Or Build Docker Image
working-directory: ${{ env.BUILDER_PATH }}
run: |
docker_image_created=
docker pull ${{ env.DOCKER_IMAGE_TAG }} || true
if $(docker image inspect ${{ env.DOCKER_IMAGE_TAG }} --format="ignored" >/dev/null 2>&1); then
docker tag ${{ env.DOCKER_IMAGE_TAG }} ${{ env.DOCKER_IMAGE_NAME }}
docker_image_created=$(docker image inspect ${{ env.DOCKER_IMAGE_NAME }} --format='{{ index .Config.Labels "org.opencontainers.image.created" }}')
echo "Docker image built on: ${docker_image_created}"
fi
bash start_build.sh --log-to-stdout --mingw64 --rebuild-images
docker_image_created_new=$(docker image inspect ${{ env.DOCKER_IMAGE_NAME }} --format='{{ index .Config.Labels "org.opencontainers.image.created" }}')
# tag the image
if [ "${docker_image_created}" != "${docker_image_created_new}" ]; then
docker tag ${{ env.DOCKER_IMAGE_NAME }} ${{ env.DOCKER_IMAGE_TAG }}
fi
- name: Copy Geany Installer From Cache
if: steps.geany_cache.outputs.cache-hit == 'true'
run: |
cp ${{ env.GEANY_CACHE_PATH }}/geany-*.exe ${{ env.BUILDER_PATH }}/output/mingw64/
- name: Build Geany
if: steps.geany_cache.outputs.cache-hit != 'true'
working-directory: ${{ env.BUILDER_PATH }}
run: |
bash start_build.sh --log-to-stdout --mingw64 --geany --geany-source "${{ env.GEANY_SOURCE_PATH }}"
mkdir -p "${{ env.GEANY_CACHE_PATH }}"
cp ${{ env.BUILDER_PATH }}/output/mingw64/geany-*.exe ${{ env.GEANY_CACHE_PATH }}
- name: Build Geany-Plugins
working-directory: ${{ env.BUILDER_PATH }}
run: |
bash start_build.sh --log-to-stdout --mingw64 --geany-plugins --geany-plugins-source "${{ github.workspace }}"
- name: Archive Geany-Plugins Installer
uses: actions/upload-artifact@v4
with:
name: geany-plugins-installer-ci-${{ env.SHORT_SHA }}-pr${{ env.GITHUB_PULL_REQUEST_OR_REF }}
retention-days: 30
path: |
${{ env.BUILDER_PATH }}/output/mingw64/geany-*.exe
${{ env.BUILDER_PATH }}/output/mingw64/geany-*.zip