Skip to content

Commit

Permalink
Merge pull request #86 from ruby/build-versions
Browse files Browse the repository at this point in the history
Use matrix strategy for Ubuntu versions
  • Loading branch information
hsbt authored Mar 7, 2024
2 parents 40f31f1 + ca39590 commit 75d8432
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,6 @@ on:
description: The version of Ruby to be build
required: true
default: master
UBUNTU_VERSION:
description: The version of Ubuntu as the base image
type: choice
options:
- jammy
- focal
- bionic
default: jammy
required: true
ARCH:
description: Which architecture amd64 or arm64 do you want to build? (The default is amd64)
type: choice
Expand All @@ -37,23 +28,28 @@ on:

jobs:
build:
name: ${{ github.event.inputs.RUBY_VERSION }}-${{ github.event.inputs.UBUNTU_VERSION }}-${{ github.event.inputs.ARCH }}
name: ${{ github.event.inputs.RUBY_VERSION }}-${{ matrix.ubuntu_version }}-${{ github.event.inputs.ARCH }}
runs-on: ubuntu-latest
strategy:
matrix:
ubuntu_version:
- jammy
- focal
- bionic

steps:
- uses: actions/checkout@v4

- name: Show parameters
run: |
echo "RUBY_VERSION=${{ github.event.inputs.RUBY_VERSION }}"
echo "UBUNTU_VERSION=${{ github.event.inputs.UBUNTU_VERSION }}"
echo "ARCH=${{ github.event.inputs.ARCH }}"
echo "LATEST=${{ github.event.inputs.LATEST }}"
echo "NOPUSH=${{ github.event.inputs.NOPUSH }}"
- name: Build image
run: |
rake docker:build arch=${{ github.event.inputs.arch }} ruby_version=${{ github.event.inputs.RUBY_VERSION }} ubuntu_version=${{ github.event.inputs.UBUNTU_VERSION }}
rake docker:build arch=${{ github.event.inputs.arch }} ruby_version=${{ github.event.inputs.RUBY_VERSION }} ubuntu_version=${{ matrix.ubuntu_version }}
- name: Check image
run: |
Expand All @@ -62,7 +58,7 @@ jobs:
if [[ "${{ github.event.inputs.ARCH }}" != "amd64" ]]; then
ARCH_SUFFIX=-${{ github.event.inputs.ARCH }}
fi
docker run rubylang/ruby:${{ github.event.inputs.RUBY_VERSION }}-${{ github.event.inputs.UBUNTU_VERSION }}${ARCH_SUFFIX} ruby -v
docker run rubylang/ruby:${{ github.event.inputs.RUBY_VERSION }}-${{ matrix.ubuntu_version }}${ARCH_SUFFIX} ruby -v
- name: Login to DockerHub
uses: docker/login-action@v3
Expand Down

0 comments on commit 75d8432

Please sign in to comment.