Skip to content

Commit

Permalink
CI: Add test run on Centos and Alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
larskanis committed Oct 30, 2024
1 parent 55ef2a3 commit 26ba368
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 2 deletions.
34 changes: 32 additions & 2 deletions .github/workflows/binary-gems.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
- cron: "0 5 * * 3" # At 05:00 on Wednesday # https://crontab.guru/#0_5_*_*_3

jobs:
job_build_x64:
rcd_build:
name: Build
runs-on: ubuntu-latest
strategy:
Expand Down Expand Up @@ -45,7 +45,7 @@ jobs:

job_test_binary:
name: Test
needs: job_build_x64
needs: rcd_build
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -131,3 +131,33 @@ jobs:
ridk enable
find "$(ruby -e"puts RbConfig::CONFIG[%q[libdir]]")" -name mkmf.log -print0 | xargs -0 cat
find -name setup.log -print0 | xargs -0 cat
job_binary_multiarch:
name: multiarch (${{matrix.platform}} on ${{matrix.from_image}} ${{matrix.image_platform}})
needs: rcd_build
strategy:
fail-fast: false
matrix:
include:
- from_image: centos
image_platform: linux/x86_64
gem_platform: x86_64-linux-gnu
dockerfile: centos
- from_image: alpine
image_platform: linux/x86_64
gem_platform: x86_64-linux-musl
dockerfile: alpine

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download gem-${{matrix.gem_platform}}
uses: actions/download-artifact@v4
with:
name: gem-${{ matrix.gem_platform }}
- name: Build image and Run tests
run: |
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
docker build --rm --platform ${{matrix.image_platform}} --build-arg from_image=${{matrix.from_image}} -t ruby-test -f spec/env/Dockerfile.${{matrix.dockerfile}} .
docker run --rm -t --network=host -v `pwd`:/build ruby-test
19 changes: 19 additions & 0 deletions spec/env/Dockerfile.alpine
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
ARG from_image
FROM ${from_image}

RUN uname -a
RUN apk add ruby ruby-etc ruby-rake ruby-dev git gcc make musl-dev gcompat postgresql16

RUN ruby --version
RUN ruby -e 'puts File.read("/proc/#{Process.pid}/maps")'
RUN gem env
RUN gem inst bundler --conservative

WORKDIR /build

CMD ruby -v && \
ruby -e "puts Gem::Platform.local.to_s" && \
gem install --local *.gem --verbose --no-document && \
bundle config set --local without 'development' && \
bundle install && \
ruby -rpg -S rake test
27 changes: 27 additions & 0 deletions spec/env/Dockerfile.centos
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
ARG from_image
FROM ${from_image}

RUN uname -a

# Change download address of Centos-8 which is EOL
RUN sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*
RUN sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

RUN yum install -y ruby-devel git gcc make redhat-rpm-config postgresql14-server

RUN ruby --version
RUN gem env

RUN gem install rubygems-update:3.3.26 --no-doc && \
update_rubygems
# centos-8 comes with Ruby 2.5, and this is the last version of bundler that supports it
RUN gem install bundler -v2.2.28

WORKDIR /build

CMD ruby -v && \
ruby -e "puts Gem::Platform.local.to_s" && \
gem install --local *.gem --verbose --no-document && \
bundle config set --local without 'development' && \
bundle install && \
ruby -rpg -S rake test

0 comments on commit 26ba368

Please sign in to comment.