Skip to content

Commit 5187f69

Browse files
committed
Add CI job to build C sources with various compiler versions
* See #4048
1 parent 1e20625 commit 5187f69

2 files changed

Lines changed: 30 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,18 @@ jobs:
174174
env:
175175
PRISM_BUILD_MINIMAL: "1"
176176

177+
build-with-various-compilers:
178+
runs-on: ubuntu-latest
179+
steps:
180+
- uses: actions/checkout@v6
181+
- name: Set up Ruby
182+
uses: ruby/setup-ruby@v1
183+
with:
184+
ruby-version: ruby
185+
bundler-cache: true
186+
- name: Build with various compilers
187+
run: bundle exec rake build_in_docker
188+
177189
build-java:
178190
runs-on: ubuntu-latest
179191
env:

Rakefile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,21 @@ namespace :build do
7676
desc "Build a development version of the gem"
7777
task dev: ["build:dev_version_set", "build", "build:dev_version_clear"]
7878
end
79+
80+
task :build_in_docker => :templates do
81+
# Versions from https://github.com/ruby/ruby/blob/master/.github/workflows/compilers.yml
82+
compilers = (7..15).map { |v| "gcc-#{v}" }
83+
compilers.each do |compiler|
84+
dockerfile = <<~DOCKERFILE
85+
FROM ghcr.io/ruby/ruby-ci-image:#{compiler}
86+
USER root
87+
ADD . /prism
88+
WORKDIR /prism
89+
RUN #{compiler} --version
90+
RUN make CC=#{compiler}
91+
DOCKERFILE
92+
File.write 'Dockerfile', dockerfile
93+
sh "docker build ."
94+
rm 'Dockerfile'
95+
end
96+
end

0 commit comments

Comments
 (0)