Skip to content

Commit

Permalink
Use GHA arm runner beta
Browse files Browse the repository at this point in the history
  • Loading branch information
schneems committed Mar 25, 2024
1 parent e7f8d3b commit 67724ef
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 19 deletions.
47 changes: 38 additions & 9 deletions .github/workflows/build_ruby.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,12 @@ jobs:
- name: Output Rubygems version
run: bundle exec rake "rubygems_version[${{inputs.ruby_version}},$STACK]"

build-and-upload-heroku-24:
build-and-upload-heroku-24-amd:
if: (!startsWith(inputs.ruby_version, '3.0')) # https://bugs.ruby-lang.org/issues/18658
runs-on: pub-hk-ubuntu-22.04-xlarge
env:
STACK: "heroku-24"
DOCKER_DEFAULT_PLATFORM: "linux/amd64"
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -101,14 +102,42 @@ jobs:
run: bundle exec rake "new[${{inputs.ruby_version}},$STACK]"
- name: Build and package Ruby runtime
run: bash "rubies/$STACK/ruby-${{inputs.ruby_version}}.sh"
- name: Build and package Ruby runtime amd64
run: |
export DOCKER_DEFAULT_PLATFORM=linux/amd64
bash "rubies/$STACK/ruby-${{inputs.ruby_version}}.sh"
- name: Build and package Ruby runtime arm64
run: |
export DOCKER_DEFAULT_PLATFORM=linux/arm64
bash "rubies/$STACK/ruby-${{inputs.ruby_version}}.sh"
- name: Build and package Ruby runtime
run: bash "rubies/$STACK/ruby-${{inputs.ruby_version}}.sh"
- name: Upload Ruby runtime archive to S3 dry run
if: (inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}" --dryrun
- name: Upload Ruby runtime archive to S3 production
if: (!inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}"
- name: Output Rubygems version
run: bundle exec rake "rubygems_version[${{inputs.ruby_version}},$STACK]"

build-and-upload-heroku-24-arm:
if: (!startsWith(inputs.ruby_version, '3.0')) # https://bugs.ruby-lang.org/issues/18658
runs-on: pub-hk-ubuntu-22.04-arm-large
env:
STACK: "heroku-24"
DOCKER_DEFAULT_PLATFORM: "linux/arm64"
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.2'
- name: Install dependencies
run: bundle install
- name: Output CHANGELOG
run: bundle exec rake "changelog[${{inputs.ruby_version}}]"
- name: Build Docker image
run: bundle exec rake "generate_image[$STACK]"
- name: Generate Ruby Dockerfile
run: bundle exec rake "new[${{inputs.ruby_version}},$STACK]"
- name: Build and package Ruby runtime
run: bash "rubies/$STACK/ruby-${{inputs.ruby_version}}.sh"
- name: Build and package Ruby runtime
run: bash "rubies/$STACK/ruby-${{inputs.ruby_version}}.sh"
- name: Upload Ruby runtime archive to S3 dry run
if: (inputs.dry_run)
run: aws s3 sync ./builds "s3://${S3_BUCKET}" --dryrun
Expand Down
33 changes: 30 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -22,7 +22,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -39,7 +39,7 @@ jobs:
version: ["3.1.4"]
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
Expand All @@ -56,3 +56,30 @@ jobs:
run: bash "rubies/${{matrix.stack}}/ruby-${{matrix.version}}.sh"
- name: Verify ruby executable and output rubygems version
run: bundle exec rake "rubygems_version[${{matrix.version}},${{matrix.stack}}]"

integration_test-arm:
runs-on: pub-hk-ubuntu-22.04-arm-large
strategy:
matrix:
stack: ["heroku-24"]
version: ["3.2.3"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@ec02537da5712d66d4d50a0f33b7eb52773b5ed1
with:
ruby-version: '3.2'
- name: Install dependencies
run: bundle install
- name: Output CHANGELOG
run: bundle exec rake "changelog[${{matrix.version}}]"
- name: Build Docker image
run: bundle exec rake "generate_image[${{matrix.stack}}]"
- name: Generate Ruby Dockerfile
run: bundle exec rake "new[${{matrix.version}},${{matrix.stack}}]"
- name: Build and package Ruby runtime
run: bash "rubies/${{matrix.stack}}/ruby-${{matrix.version}}.sh"
- name: Verify ruby executable and output rubygems version
run: bundle exec rake "rubygems_version[${{matrix.version}},${{matrix.stack}}]"

15 changes: 8 additions & 7 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,13 +85,14 @@ task :generate_image, [:stack] do |t, args|
arguments = ["-t #{image}"]

# rubocop:disable Lint/EmptyWhen
case stack
when "heroku-24"
arguments.push("--platform='linux/amd64,linux/arm64'")
when "heroku-20", "heroku-22"
else
raise "Unknown stack: #{stack}"
end
# TODO: Local cross compile story?
# case stack
# when "heroku-24"
# arguments.push("--platform='linux/amd64,linux/arm64'")
# when "heroku-20", "heroku-22"
# else
# raise "Unknown stack: #{stack}"
# end
# rubocop:enable Lint/EmptyWhen

command = "docker build #{arguments.join(" ")} ."
Expand Down

0 comments on commit 67724ef

Please sign in to comment.