-
Notifications
You must be signed in to change notification settings - Fork 0
200 lines (174 loc) · 5.67 KB
/
test-and-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
name: test-and-release
on:
push:
branches: [ main ]
tags: [ 'v*' ]
pull_request:
workflow_dispatch:
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
env:
BUNDLER_VER: 2.3.24
# Forcing bundler version to ensure that it is consistent everywhere and
# does not cause bundler gem reinstalls
# bundler/rubygems 2.3.22 is a minimal requirement to support gnu/musl differentiation
# https://github.com/rubygems/rubygems/pull/4488
jobs:
pack:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
platform: x64-mingw32
ruby: '2.7'
- os: windows-latest
platform: x64-mingw-ucrt
ruby: '3.1'
- os: macos-latest
platform: x86_64-darwin
ruby: '2.7'
- os: macos-latest
platform: arm64-darwin
ruby: '2.7'
- os: ubuntu-20.04
platform: x86_64-linux
ruby: '2.7'
- os: ubuntu-20.04
platform: aarch64-linux
ruby: '2.7'
- os: ubuntu-20.04
platform: any
ruby: '2.7'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: true
- if: matrix.platform == 'aarch64-linux'
name: Install aarch64 compilers
run: |
sudo apt-get update
sudo apt-get install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binutils-aarch64-linux-gnu gperf
echo "CMAKE_TOOLCHAIN_FILE=$(pwd)/toolchain/aarch64-linux-gnu.cmake" >> $GITHUB_ENV
- run: bundle exec rake gem:native:${{ matrix.platform }}
- uses: actions/upload-artifact@v4
if: failure()
with:
name: build-logs-${{ matrix.platform }}
path: tmp/*/ports/*/*/*.log
- if: matrix.platform != 'any' && matrix.platform != 'aarch64-linux'
uses: metanorma/metanorma-build-scripts/native-deps-action@main
with:
libname: archive
directory: lib/ffi-libarchive-binary
- run: |
cd pkg/
gem unpack ffi-libarchive-binary-*.gem
ls */lib/ffi-libarchive-binary
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}-pkg
path: pkg/*.gem
- if: matrix.platform != 'any'
uses: actions/upload-artifact@v4
with:
name: lib-${{ matrix.platform }}
path: lib/ffi-libarchive-binary/libarchive.*
test:
needs: pack
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
ruby: [ '2.7', '3.0', '3.1', '3.2', '3.3' ]
os: [ windows-latest, macos-latest, ubuntu-latest ]
include:
- os: windows-latest
platform: x64-mingw32
- os: macos-latest
platform: x86_64-darwin
- os: ubuntu-latest
platform: x86_64-linux
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: true
- uses: actions/download-artifact@v4
with:
name: lib-${{ matrix.platform }}
path: lib/ffi-libarchive-binary
- run: bundle exec rspec
metanorma:
needs: pack
runs-on: ${{ matrix.env.os }}
strategy:
fail-fast: false
matrix:
ruby: [ '3.1', '3.2', '3.3' ]
env: [ { os: macos-latest, platform: arm64-darwin }, { os: ubuntu-latest, platform: x86_64-linux } ]
experimental: [true]
include:
- env: { os: windows-latest, platform: x64-mingw-ucrt }
ruby: '3.3'
experimental: true
- env: { os: windows-latest, platform: x64-mingw-ucrt }
ruby: '3.1'
experimental: true
steps:
- uses: actions/checkout@v4
with:
repository: metanorma/metanorma
- uses: actions/download-artifact@v4
with:
path: pkg
pattern: '*-pkg'
merge-multiple: true
- name: Setup ffi-libarchive-binary
run: |
gem unpack --target pkg pkg/ffi-libarchive-binary-*-${{ matrix.env.platform }}.gem
mv pkg/ffi-libarchive-binary-*-${{ matrix.env.platform }} pkg/ffi-libarchive-binary
echo "gem 'ffi-libarchive-binary', path: 'pkg/ffi-libarchive-binary'" > Gemfile.devel
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ env.BUNDLER_VER }}
bundler-cache: true
- uses: metanorma/metanorma-build-scripts/inkscape-setup-action@main
- run: bundle exec rake
continue-on-error: ${{ matrix.experimental }}
# ----- Release -----
release:
name: Release gem
needs: [ pack, test, metanorma ]
runs-on: ubuntu-latest
if: contains(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
path: pkg
pattern: '*-pkg'
merge-multiple: true
- name: Publish to rubygems.org
env:
RUBYGEMS_API_KEY: ${{secrets.FONTIST_CI_RUBYGEMS_API_KEY}}
run: |
mkdir -p ~/.gem
touch ~/.gem/credentials
cat > ~/.gem/credentials << EOF
---
:rubygems_api_key: ${RUBYGEMS_API_KEY}
EOF
chmod 0600 ~/.gem/credentials
gem signin
mkdir tmp
for gem in pkg/*.gem; do gem push -V $gem; done
# for gem in pkg/*.gem; do echo "Will do: 'gem push -V $gem'"; done