Skip to content

Commit 23fab86

Browse files
authored
Merge pull request #103 from mudge/github-actions-cleanup
Tidy up GitHub Actions
2 parents e37131c + a9b01b8 commit 23fab86

File tree

1 file changed

+77
-120
lines changed

1 file changed

+77
-120
lines changed

.github/workflows/tests.yml

Lines changed: 77 additions & 120 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,68 @@ on:
77
push:
88
branches:
99
- main
10-
- v*.*.x
10+
- v*.*
1111
tags:
1212
- v*.*.*
1313
pull_request:
1414

1515
jobs:
16+
build-cruby-gem:
17+
name: "Build CRuby gem"
18+
runs-on: "ubuntu-latest"
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: actions/cache@v3
22+
with:
23+
path: ports/archives
24+
key: archives-ubuntu-${{hashFiles('ext/re2/extconf.rb')}}
25+
- uses: ruby/setup-ruby@v1
26+
with:
27+
ruby-version: "3.2"
28+
bundler-cache: true
29+
- run: ./scripts/test-gem-build gems ruby ${{github.ref_type}}
30+
- uses: actions/upload-artifact@v3
31+
with:
32+
name: cruby-gem
33+
path: gems
34+
35+
build-precompiled-gems:
36+
name: "Precompile ${{ matrix.platform }} gem"
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
platform:
41+
- "aarch64-linux"
42+
- "arm-linux"
43+
- "arm64-darwin" # github actions does not support this runtime as of 2022-12, but let's build anyway
44+
- "x64-mingw-ucrt"
45+
- "x64-mingw32"
46+
- "x86-linux"
47+
- "x86-mingw32" # github actions does not support this runtime as of 2022-12, but let's build anyway
48+
- "x86_64-darwin"
49+
- "x86_64-linux"
50+
runs-on: ubuntu-latest
51+
steps:
52+
- uses: actions/checkout@v4
53+
- uses: actions/cache@v3
54+
with:
55+
path: ports/archives
56+
key: archives-ubuntu-${{hashFiles('ext/re2/extconf.rb')}}
57+
- run: |
58+
docker run --rm -v "$(pwd):/re2" -w /re2 \
59+
"ghcr.io/rake-compiler/rake-compiler-dock-image:1.3.0-mri-${{matrix.platform}}" \
60+
./scripts/test-gem-build gems ${{matrix.platform}} ${{github.ref_type}}
61+
- uses: actions/upload-artifact@v3
62+
with:
63+
name: "cruby-${{matrix.platform}}-gem"
64+
path: gems
65+
1666
compile-and-test-system-dependencies:
67+
name: System libre2.${{ matrix.libre2.soname }} - Ruby ${{ matrix.ruby }}
1768
needs: ["build-cruby-gem"]
18-
name: System Dependencies - ${{ matrix.sys }} vendored libs - Ruby ${{ matrix.ruby }} - libre2 ABI version ${{ matrix.libre2.soname }}
1969
runs-on: ubuntu-20.04
2070
strategy:
2171
matrix:
22-
sys: ["enable", "disable"]
2372
ruby:
2473
- '3.2'
2574
- '3.1'
@@ -43,11 +92,13 @@ jobs:
4392
soname: 10
4493
- version: "20230701"
4594
soname: 11
95+
needs_abseil: true
4696
steps:
4797
- uses: actions/checkout@v4
4898
- name: Remove any existing libre2 installation
4999
run: sudo apt-get remove -y libre2-dev libre2-5
50100
- name: Install Abseil for newer re2 releases
101+
if: ${{ matrix.libre2.needs_abseil }}
51102
run: |
52103
sudo apt-get install -y software-properties-common
53104
sudo add-apt-repository ppa:savoury1/build-tools
@@ -64,12 +115,11 @@ jobs:
64115
with:
65116
name: cruby-gem
66117
path: gems
67-
- name: "Link libre2 into Ruby's exec_prefix"
68-
run: ln -s /usr/lib/libre2.so `ruby -e "puts RbConfig::CONFIG['exec_prefix']"`/lib/libre2.so
69-
- run: ./scripts/test-gem-install gems --${{matrix.sys}}-system-libraries
118+
- run: ./scripts/test-gem-install gems --enable-system-libraries
70119

71120
compile-and-test-vendored-dependencies:
72-
name: Vendored Dependencies - Ruby ${{ matrix.ruby }} - ${{ matrix.runs-on }}
121+
name: Vendored - Ruby ${{ matrix.ruby }} - ${{ matrix.runs-on }}
122+
needs: ["build-cruby-gem"]
73123
strategy:
74124
fail-fast: false
75125
matrix:
@@ -92,136 +142,36 @@ jobs:
92142
- uses: ruby/setup-ruby@v1
93143
with:
94144
ruby-version: ${{matrix.ruby}}
95-
bundler-cache: true
96-
- uses: actions/cache@v3
97-
with:
98-
path: ports
99-
key: ports-${{matrix.runs-on}}-${{hashFiles('ext/re2/extconf.rb')}}
100-
- run: bundle exec rake compile spec
101-
102-
build-cruby-gem:
103-
runs-on: "ubuntu-latest"
104-
steps:
105-
- uses: actions/checkout@v4
106-
- uses: actions/cache@v3
107-
with:
108-
path: ports/archives
109-
key: archives-ubuntu-${{hashFiles('ext/re2/extconf.rb')}}
110-
- uses: ruby/setup-ruby@v1
111-
with:
112-
ruby-version: "3.2"
113-
bundler-cache: true
114-
- run: ./scripts/test-gem-build gems ruby ${{github.ref_type}}
115-
- uses: actions/upload-artifact@v3
116-
with:
117-
name: cruby-gem
118-
path: gems
119-
120-
test-cruby-gem-linux:
121-
needs: ["build-cruby-gem"]
122-
strategy:
123-
fail-fast: false
124-
matrix:
125-
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"]
126-
runs-on: ubuntu-latest
127-
steps:
128-
- uses: actions/checkout@v4
129-
- uses: ruby/setup-ruby@v1
130-
with:
131-
ruby-version: "${{matrix.ruby}}"
132-
- uses: actions/download-artifact@v3
133-
with:
134-
name: cruby-gem
135-
path: gems
136-
- run: ./scripts/test-gem-install gems
137-
138-
test-cruby-gem-macos:
139-
needs: ["build-cruby-gem"]
140-
strategy:
141-
fail-fast: false
142-
matrix:
143-
ruby: ["2.6", "2.7", "3.0", "3.1", "3.2"]
144-
runs-on: macos-latest
145-
steps:
146-
- uses: actions/checkout@v4
147-
- uses: ruby/setup-ruby@v1
148-
with:
149-
ruby-version: "${{matrix.ruby}}"
150-
- uses: actions/download-artifact@v3
151-
with:
152-
name: cruby-gem
153-
path: gems
154-
- run: ./scripts/test-gem-install gems
155-
156-
test-cruby-gem-windows:
157-
needs: ["build-cruby-gem"]
158-
strategy:
159-
fail-fast: false
160-
matrix:
161-
ruby: ["2.6", "2.7", "3.0"]
162-
runs-on: windows-latest
163-
steps:
164-
- uses: actions/checkout@v4
165-
- uses: ruby/setup-ruby@v1
166-
with:
167-
ruby-version: "${{matrix.ruby}}"
168145
- uses: actions/download-artifact@v3
169146
with:
170147
name: cruby-gem
171148
path: gems
172149
- run: ./scripts/test-gem-install gems
173150
shell: bash
174151

175-
test-cruby-gem-windows-ucrt:
152+
compile-and-test-vendored-dependencies-with-system-install:
153+
name: Vendored - system libre2-dev - Ruby 3.2
176154
needs: ["build-cruby-gem"]
177-
strategy:
178-
fail-fast: false
179-
matrix:
180-
ruby: ["3.1", "3.2"]
181-
runs-on: windows-2022
155+
runs-on: ubuntu-latest
182156
steps:
183157
- uses: actions/checkout@v4
158+
- name: Install RE2
159+
run: sudo apt-get install -y libre2-dev
184160
- uses: ruby/setup-ruby@v1
161+
id: setup-ruby
185162
with:
186-
ruby-version: "${{matrix.ruby}}"
163+
ruby-version: "3.2"
164+
bundler-cache: true
187165
- uses: actions/download-artifact@v3
188166
with:
189167
name: cruby-gem
190168
path: gems
169+
- name: "Link libre2 into Ruby's lib directory"
170+
run: ln -s /usr/lib/x86_64-linux-gnu/libre2.so ${{ steps.setup-ruby.outputs.ruby-prefix }}/lib/libre2.so
191171
- run: ./scripts/test-gem-install gems
192-
shell: bash
193-
194-
build-precompiled-gems:
195-
strategy:
196-
fail-fast: false
197-
matrix:
198-
platform:
199-
- "aarch64-linux"
200-
- "arm-linux"
201-
- "arm64-darwin" # github actions does not support this runtime as of 2022-12, but let's build anyway
202-
- "x64-mingw-ucrt"
203-
- "x64-mingw32"
204-
- "x86-linux"
205-
- "x86-mingw32" # github actions does not support this runtime as of 2022-12, but let's build anyway
206-
- "x86_64-darwin"
207-
- "x86_64-linux"
208-
runs-on: ubuntu-latest
209-
steps:
210-
- uses: actions/checkout@v4
211-
- uses: actions/cache@v3
212-
with:
213-
path: ports/archives
214-
key: archives-ubuntu-${{hashFiles('ext/re2/extconf.rb')}}
215-
- run: |
216-
docker run --rm -v "$(pwd):/re2" -w /re2 \
217-
"ghcr.io/rake-compiler/rake-compiler-dock-image:1.3.0-mri-${{matrix.platform}}" \
218-
./scripts/test-gem-build gems ${{matrix.platform}} ${{github.ref_type}}
219-
- uses: actions/upload-artifact@v3
220-
with:
221-
name: "cruby-${{matrix.platform}}-gem"
222-
path: gems
223172

224173
test-precompiled-aarch64-linux:
174+
name: Precompiled - Ruby ${{ matrix.ruby }} - aarch64-linux
225175
needs: ["build-precompiled-gems"]
226176
strategy:
227177
fail-fast: false
@@ -243,6 +193,7 @@ jobs:
243193
./scripts/test-gem-install ./gems
244194
245195
test-precompiled-arm-linux:
196+
name: Precompiled - Ruby ${{ matrix.ruby }} - arm-linux
246197
needs: ["build-precompiled-gems"]
247198
strategy:
248199
fail-fast: false
@@ -264,6 +215,7 @@ jobs:
264215
./scripts/test-gem-install ./gems
265216
266217
test-precompiled-x64-mingw-ucrt:
218+
name: Precompiled - Ruby ${{ matrix.ruby }} - x64-mingw-ucrt
267219
needs: ["build-precompiled-gems"]
268220
strategy:
269221
fail-fast: false
@@ -283,6 +235,7 @@ jobs:
283235
shell: bash
284236

285237
test-precompiled-x64-mingw32:
238+
name: Precompiled - Ruby ${{ matrix.ruby }} - x64-mingw32
286239
needs: ["build-precompiled-gems"]
287240
strategy:
288241
fail-fast: false
@@ -302,6 +255,7 @@ jobs:
302255
shell: bash
303256

304257
test-precompiled-x86-linux:
258+
name: Precompiled - Ruby ${{ matrix.ruby }} - x86-linux
305259
needs: ["build-precompiled-gems"]
306260
strategy:
307261
fail-fast: false
@@ -322,7 +276,8 @@ jobs:
322276
ruby:${{matrix.ruby}} \
323277
./scripts/test-gem-install ./gems
324278
325-
test-precompiled-linux-x86_64:
279+
test-precompiled-x86_64-linux:
280+
name: Precompiled - Ruby ${{ matrix.ruby }} - x86_64-linux
326281
needs: ["build-precompiled-gems"]
327282
strategy:
328283
fail-fast: false
@@ -341,6 +296,7 @@ jobs:
341296
- run: ./scripts/test-gem-install gems
342297

343298
test-precompiled-x86_64-darwin:
299+
name: Precompiled - Ruby ${{ matrix.ruby }} - x86_64-darwin
344300
needs: ["build-precompiled-gems"]
345301
strategy:
346302
fail-fast: false
@@ -358,7 +314,8 @@ jobs:
358314
path: gems
359315
- run: ./scripts/test-gem-install gems
360316

361-
test-precompiled-x86_64-linux:
317+
test-precompiled-x86_64-alpine:
318+
name: Precompiled - Ruby ${{ matrix.ruby }} - x86_64-alpine
362319
needs: ["build-precompiled-gems"]
363320
strategy:
364321
fail-fast: false

0 commit comments

Comments
 (0)