Skip to content

Commit a204140

Browse files
committed
Unify gnu and musl
1 parent 81b40bd commit a204140

File tree

16 files changed

+33
-77
lines changed

16 files changed

+33
-77
lines changed

.github/workflows/build-ruby.yml

Lines changed: 33 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -22,112 +22,68 @@ jobs:
2222
fail-fast: false
2323
matrix:
2424
include:
25+
# gnu
2526
- engine: ruby
2627
version: "2.1"
28+
libc: gnu
29+
arch: ["x86_64", "aarch64"]
2730
- engine: ruby
2831
version: "2.2"
32+
libc: gnu
33+
arch: ["x86_64", "aarch64"]
2934
- engine: ruby
3035
version: "2.3"
36+
libc: gnu
37+
arch: ["x86_64", "aarch64"]
3138
- engine: ruby
3239
version: "2.4"
40+
libc: gnu
41+
arch: ["x86_64", "aarch64"]
3342
- engine: ruby
3443
version: "2.5"
44+
libc: gnu
45+
arch: ["x86_64", "aarch64"]
3546
- engine: ruby
3647
version: "2.6"
48+
libc: gnu
49+
arch: ["x86_64", "aarch64"]
3750
- engine: ruby
3851
version: "2.7"
52+
libc: gnu
53+
arch: ["x86_64", "aarch64"]
3954
- engine: ruby
4055
version: "3.0"
56+
libc: gnu
57+
arch: ["x86_64", "aarch64"]
4158
- engine: ruby
4259
version: "3.1"
60+
libc: gnu
61+
arch: ["x86_64", "aarch64"]
4362
- engine: ruby
4463
version: "3.2"
64+
libc: gnu
65+
arch: ["x86_64", "aarch64"]
4566
- engine: ruby
4667
version: "3.3"
68+
libc: gnu
69+
arch: ["x86_64", "aarch64"]
4770
- engine: ruby
4871
version: "3.4"
72+
libc: gnu
73+
arch: ["x86_64", "aarch64"]
4974
- engine: jruby
5075
version: "9.2"
76+
libc: gnu
77+
arch: ["x86_64", "aarch64"]
5178
- engine: jruby
5279
version: "9.3"
80+
libc: gnu
81+
arch: ["x86_64", "aarch64"]
5382
- engine: jruby
5483
version: "9.4"
55-
runs-on: ubuntu-latest
56-
name: Build (${{ matrix.engine }} ${{ matrix.version }} gnu)
57-
steps:
58-
- name: Set variables
59-
id: vars
60-
run: |
61-
echo "SRC=src/engines/${{ matrix.engine }}/${{ matrix.version }}" >> $GITHUB_OUTPUT
62-
echo "IMAGE=${{ env.REGISTRY }}/${{ env.REPO }}/engines/${{ matrix.engine }}" >> $GITHUB_OUTPUT
63-
echo "TAG=${{ matrix.version }}" >> $GITHUB_OUTPUT
64-
echo "DOCKERFILE=src/engines/${{ matrix.engine }}/${{ matrix.version }}/Dockerfile" >> $GITHUB_OUTPUT
65-
- name: Checkout
66-
uses: actions/checkout@v4
67-
68-
# Using docker-container engine enables advanced buildx features
69-
- name: Set up Docker container engine
70-
run: |
71-
docker buildx create --name=container --driver=docker-container --use --bootstrap
72-
73-
# First, build image for x86_64 as it will fail fast
74-
#
75-
# Tagging is necessary to reference the image for the testing step
76-
# Tagging is done separately to avoid interfrence with caching
77-
- name: Build single-arch image (x86_64)
78-
run: |
79-
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --output=type=image,push=false --platform linux/x86_64 -f ${{ steps.vars.outputs.DOCKERFILE }}
80-
- name: Tag single-arch image (x86_64)
81-
run: |
82-
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --load --platform linux/x86_64 -f ${{ steps.vars.outputs.DOCKERFILE }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }}
83-
- name: Test single-arch image (x86_64)
84-
run: |
85-
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} /bin/sh -c 'true'
86-
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} ruby -e 'puts RUBY_DESCRIPTION'
87-
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} gem --version
88-
docker run --platform linux/x86_64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} bundle --version
89-
docker run --platform linux/x86_64 --rm -v "${PWD}":"${PWD}" -w "${PWD}" ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} /bin/sh -c 'bundle install && bundle exec rake test'
90-
91-
# Then, build image for aarch64 which, being emulated under qemu, is slower
92-
#
93-
# Tagging is necessary to reference the image for the testing step
94-
# Tagging is done separately to avoid interfrence with caching
95-
# Start by enabling qemu for aarch64
96-
- name: Enable aarch64 emulation (x86_64)
97-
run: |
98-
docker run --privileged --rm tonistiigi/binfmt --install arm64
99-
- name: Build single-arch image (aarch64)
100-
run: |
101-
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --output=type=image,push=false --platform linux/aarch64 -f ${{ steps.vars.outputs.DOCKERFILE }}
102-
- name: Tag single-arch image (aarch64)
103-
run: |
104-
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --load --platform linux/aarch64 -f ${{ steps.vars.outputs.DOCKERFILE }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }}
105-
- name: Test single-arch image (aarch64)
106-
run: |
107-
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} /bin/sh -c 'true'
108-
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} ruby -e 'puts RUBY_DESCRIPTION'
109-
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} gem --version
110-
docker run --platform linux/aarch64 --rm ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} bundle --version
111-
docker run --platform linux/aarch64 --rm -v "${PWD}":"${PWD}" -w "${PWD}" ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} /bin/sh -c 'bundle install && bundle exec rake test'
112-
113-
# Finally, assemble multi-arch image for a combined push to the registry
114-
#
115-
# This reruns docker build but layers are in the cache, so it's fast
116-
- name: Log in to the Container Registry
117-
if: ${{ inputs.push }}
118-
run: |
119-
echo ${{ secrets.GITHUB_TOKEN }} | docker login ${{ env.REGISTRY }} -u ${{ github.actor }} --password-stdin
120-
- name: Build multi-arch image (x86_64, aarch64)
121-
if: ${{ inputs.push }}
122-
run: |
123-
docker buildx build ${{ steps.vars.outputs.SRC }} --builder=container --cache-from=type=registry,ref=${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }} --output=type=image,push=true --build-arg BUILDKIT_INLINE_CACHE=1 --platform linux/x86_64,linux/aarch64 -f ${{ steps.vars.outputs.DOCKERFILE }} --tag ${{ steps.vars.outputs.IMAGE }}:${{ steps.vars.outputs.TAG }}
124-
125-
126-
build-musl:
127-
strategy:
128-
fail-fast: false
129-
matrix:
130-
include:
84+
libc: gnu
85+
arch: ["x86_64", "aarch64"]
86+
# musl
13187
- engine: ruby
13288
version: "2.1"
13389
libc: musl
@@ -189,7 +145,7 @@ jobs:
189145
libc: musl
190146
arch: ["x86_64", "aarch64"]
191147
runs-on: ubuntu-latest
192-
name: Build (${{ matrix.engine }} ${{ matrix.version }} musl)
148+
name: Build (${{ matrix.engine }} ${{ matrix.version }} ${{ matrix.libc }})
193149
steps:
194150
- name: Set variables
195151
id: vars
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)