-
Notifications
You must be signed in to change notification settings - Fork 0
310 lines (279 loc) · 11.8 KB
/
release.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
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
# Setting up a release workflow for `mpdpopm'. Much thanks to
# BurntShushi from whom I shamelessly copied a lot of this
# <https://github.com/BurntSushi/ripgrep/blob/master/.github/workflows/release.yml>
name: release
on:
# This permits this workflow to be triggered manually. See the
# environment variable RELEASE_VERSION below, however.
workflow_dispatch:
# Modifying the push event with 'branches' and 'tags' seems to be an
# OR operation (i.e. the workflow will run if either on branch
# release-infra *or* it has a tag of n.n.n)
push:
# Un-comment this for testing
# branches:
# - 0.6
tags:
- '[0-9]+.[0-9]+.[0-9]+'
jobs:
####################################################################
# This job will create the GitHub release entity.
####################################################################
create-release:
name: create-release
runs-on: ubuntu-latest
# Un-comment this for testing
# env:
# RELEASE_VERSION: 0.6.23
steps:
- name: Create artifacts directory
run: mkdir artifacts
- name: Get the release version from the tag
if: env.RELEASE_VERSION == ''
run: |
# No idea how this incantation works-- got it from:
# https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
echo "version is: ${{ env.RELEASE_VERSION }}"
- name: Create GitHub release
id: release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
release_name: ${{ env.RELEASE_VERSION }}
- name: Save release upload URL to artifact
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url
- name: Save version number to artifact
run: echo "${{ env.RELEASE_VERSION }}" > artifacts/release-version
- name: Upload artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts
path: artifacts
####################################################################
# This job will actually create the artifacts I want to include with
# the release
####################################################################
build-release:
name: build-release
needs: ['create-release']
runs-on: ${{ matrix.os }}
strategy:
matrix:
build: [linux, macos]
include:
- build: linux
os: ubuntu-22.04
- build: macos
os: macos-10.15
boost: latest
boost-ver: 1_76_0
boost-dl: https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Install pre-requisites (MacOS)
if: matrix.os == 'macos-10.15'
shell: bash
run: |
set -x
pwd
brew install autoconf automake libtool openssl guile doxygen flex \
bison graphviz texinfo
- name: Install pre-requisites (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -x
pwd
sudo apt-get update
sudo apt-get install -y autoconf automake libtool openssl \
guile-3.0-dev doxygen flex bison graphviz libunistring-dev texlive
- name: Cache boost (MacOS)
if: matrix.os == 'macos-10.15'
id: cache-boost-macos
uses: actions/cache@v2
with:
path: boost_${{ matrix.boost-ver }}/installdir
key: ${{ runner.os }}-${{ matrix.boost-ver }}
- name: Get boost (MacOS)
if: matrix.os == 'macos-10.15' && steps.cache-boost-macos.outputs.cache-hit != 'true'
run: |
set -x
pwd
curl -L -o boost_${{ matrix.boost-ver }}.tar.bz2 ${{ matrix.boost-dl }}
md5 boost_${{ matrix.boost-ver }}.tar.bz2
cc --version
tar xf boost_${{ matrix.boost-ver }}.tar.bz2
mkdir boost_${{ matrix.boost-ver }}/installdir
- name: Build boost (MacOS)
if: matrix.os == 'macos-10.15' && steps.cache-boost-macos.outputs.cache-hit != 'true'
shell: bash
run: |
pwd
set -x
cd boost_${{ matrix.boost-ver }}
pwd
ls
export CFLAGS="-Wno-error=implicit-function-declaration"
./bootstrap.sh --prefix=./installdir || { cat bootstrap.log; exit 1; }
./b2
./b2 install
cd installdir/lib
pwd
ls
here=$(pwd)
install_name_tool -change libboost_chrono.dylib ${here}/libboost_chrono.dylib libboost_log.dylib
install_name_tool -change libboost_thread.dylib ${here}/libboost_thread.dylib libboost_log.dylib
install_name_tool -change libboost_date_time.dylib ${here}/libboost_date_time.dylib libboost_log.dylib
install_name_tool -change libboost_filesystem.dylib ${here}/libboost_filesystem.dylib libboost_log.dylib
install_name_tool -change libboost_system.dylib ${here}/libboost_system.dylib libboost_log.dylib
install_name_tool -change libboost_regex.dylib ${here}/libboost_regex.dylib libboost_log.dylib
install_name_tool -change libboost_system.dylib ${here}/libboost_system.dylib libboost_chrono.dylib
install_name_tool -change libboost_system.dylib ${here}/libboost_system.dylib libboost_thread.dylib
- name: Install boost (Ubuntu, latest)
if: matrix.os == 'ubuntu-22.04'
run: |
set -x
pwd
sudo apt-get install -y libboost-all-dev
- name: Get release download URL
uses: actions/download-artifact@v1
with:
name: artifacts
path: artifacts
- name: Set release upload URL and release version
shell: bash
run: |
release_upload_url="$(cat artifacts/release-upload-url)"
echo "RELEASE_UPLOAD_URL=$release_upload_url" >> $GITHUB_ENV
echo "release upload url: $RELEASE_UPLOAD_URL"
release_version="$(cat artifacts/release-version)"
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV
echo "release version: $RELEASE_VERSION"
- name: Configure scribbu (MacOS)
if: matrix.os == 'macos-10.15'
shell: bash
run: |
set -x
pwd
ls
./bootstrap
PATH="/usr/local/opt/bison/bin:/usr/local/opt/texinfo/bin:$PATH" ./configure --with-boost=$(cd boost_${{ matrix.boost-ver }}/installdir; pwd) --with-openssl=/usr/local/opt/openssl CPPFLAGS="-D_LIBCPP_ENABLE_CXX17_REMOVED_AUTO_PTR -I/usr/local/opt/[email protected]/include" LDFLAGS="-L/usr/local/opt/[email protected]/lib"
- name: Configure scribbu (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -x
pwd
ls
./bootstrap
./configure
echo "DISTRO_BZ2=scribbu-${{ env.RELEASE_VERSION }}.tar.bz2" >> $GITHUB_ENV
echo "DISTRO_GZ=scribbu-${{ env.RELEASE_VERSION }}.tar.gz" >> $GITHUB_ENV
echo "DISTRO_XZ=scribbu-${{ env.RELEASE_VERSION }}.tar.xz" >> $GITHUB_ENV
- name: Make scribbu (MacOS)
if: matrix.os == 'macos-10.15'
shell: bash
run: |
set -x
pwd
PATH="/usr/local/opt/bison/bin:/usr/local/opt/texinfo/bin:$PATH" make
- name: Make scribbu (Ubuntu)
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -x
pwd
make
- name: Patch boost dependencies (MacOS)
if: matrix.os == 'macos-10.15'
shell: bash
run: |
set -x
pwd
echo "===================================="
otool -L src/.libs/scribbu
echo "===================================="
otool -l src/.libs/scribbu
echo "===================================="
there=$(cd boost_${{ matrix.boost-ver }}/installdir; pwd)
echo "Changing the load location for boost libs to ${there}."
install_name_tool -change libboost_iostreams.dylib ${there}/libboost_iostreams.dylib src/.libs/scribbu
install_name_tool -change libboost_filesystem.dylib ${there}/libboost_filesystem.dylib src/.libs/scribbu
install_name_tool -change libboost_log.dylib ${there}/libboost_log.dylib src/.libs/scribbu
install_name_tool -change libboost_program_options.dylib ${there}/libboost_program_options.dylib src/.libs/scribbu
install_name_tool -change libboost_regex.dylib ${there}/libboost_regex.dylib src/.libs/scribbu
install_name_tool -change libboost_system.dylib ${there}/libboost_system.dylib src/.libs/scribbu
echo "===================================="
otool -L src/.libs/scribbu
echo "===================================="
otool -l src/.libs/scribbu
echo "===================================="
cd test && make unit
echo "===================================="
otool -L .libs/unit
echo "===================================="
otool -l .libs/unit
install_name_tool -change libboost_iostreams.dylib ${there}/libboost_iostreams.dylib .libs/unit
install_name_tool -change libboost_filesystem.dylib ${there}/libboost_filesystem.dylib .libs/unit
install_name_tool -change libboost_log.dylib ${there}/libboost_log.dylib .libs/unit
install_name_tool -change libboost_program_options.dylib ${there}/libboost_program_options.dylib .libs/unit
install_name_tool -change libboost_regex.dylib ${there}/libboost_regex.dylib .libs/unit
install_name_tool -change libboost_system.dylib ${there}/libboost_system.dylib .libs/unit
install_name_tool -change libboost_unit_test_framework.dylib ${there}/libboost_unit_test_framework.dylib .libs/unit
echo "===================================="
otool -L .libs/unit
echo "===================================="
otool -l .libs/unit
- name: Test scribbu
shell: bash
run: |
set -x
pwd
make check || cat test/test-suite.log
- name: Test the Autotools distribution (Ubuntu)
# I only make the Autotools distro on Ubuntu, so just test there
# (besides, I can't get 'distcheck' to work on MacOS anyway)
if: matrix.os == 'ubuntu-22.04'
shell: bash
run: |
set -x
pwd
make distcheck
# TODO(sp1ff): strip the binaries?
# TODO(sp1ff): assemble pre-built binaries?
- name: Upload bzip2 tarball
if: matrix.os == 'ubuntu-22.04'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
asset_path: ${{ env.DISTRO_BZ2 }}
asset_name: ${{ env.DISTRO_BZ2 }}
asset_content_type: application/octet-stream
- name: Upload gzip tarball
if: matrix.os == 'ubuntu-22.04'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
asset_path: ${{ env.DISTRO_GZ }}
asset_name: ${{ env.DISTRO_GZ }}
asset_content_type: application/octet-stream
- name: Upload xzip tarball
if: matrix.os == 'ubuntu-22.04'
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ env.RELEASE_UPLOAD_URL }}
asset_path: ${{ env.DISTRO_XZ }}
asset_name: ${{ env.DISTRO_XZ }}
asset_content_type: application/octet-stream
# NB. The Debian & Arch packages will be created
# downstream from this process & uploaded manually.