Skip to content

Commit

Permalink
ci: use a ruby_versions.outputs context for ruby version matrix
Browse files Browse the repository at this point in the history
  • Loading branch information
flavorjones committed Dec 11, 2024
1 parent b128d39 commit ba70658
Showing 1 changed file with 52 additions and 41 deletions.
93 changes: 52 additions & 41 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,16 +89,42 @@ jobs:
- run: bundle exec rake compile -- --enable-system-libraries
- run: bundle exec rake test

#
# SECTION meta - control variables
#
ruby_versions:
needs: ["basic"]
outputs:
minors: "['3.1', '3.2', '3.3']"
runs-on: ubuntu-latest
steps:
- run: echo "generating rubies ..."

rcd_image_version:
needs: ["basic"]
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{steps.rcd_image_version.outputs.rcd_image_version}}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
bundler: latest
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT

#
# SECTION run the test suite across a broad matrix of rubies, configs, and systems
#
linux:
needs: ["basic"]
needs: ["basic", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
container:
image: ghcr.io/sparklemotion/nokogiri-test:mri-${{matrix.ruby}}
Expand All @@ -117,12 +143,12 @@ jobs:
- run: bundle exec rake test:bench

valgrind:
needs: ["linux"]
needs: ["linux", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
mem: ["ruby"]
include:
- sys: "disable"
Expand Down Expand Up @@ -233,12 +259,12 @@ jobs:
- run: bundle exec rake test:valgrind

osx:
needs: ["basic"]
needs: ["basic", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -442,21 +468,6 @@ jobs:
#
# SECTION the end-to-end gem installation tests
#
rcd_image_version:
needs: ["basic"]
runs-on: ubuntu-latest
outputs:
rcd_image_version: ${{steps.rcd_image_version.outputs.rcd_image_version}}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true
bundler: latest
- id: rcd_image_version
run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT

generic-package:
needs: ["rcd_image_version"]
name: "generic-package"
Expand All @@ -482,12 +493,12 @@ jobs:
retention-days: 1

generic-linux-install:
needs: ["generic-package"]
needs: ["generic-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -504,12 +515,12 @@ jobs:
- run: ./scripts/test-gem-install gems --${{matrix.sys}}-system-libraries

generic-darwin-install:
needs: ["generic-package"]
needs: ["generic-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -525,12 +536,12 @@ jobs:
- run: ./scripts/test-gem-install gems --${{matrix.sys}}-system-libraries

generic-windows-install:
needs: ["generic-package"]
needs: ["generic-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
sys: ["enable", "disable"]
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -584,11 +595,11 @@ jobs:
retention-days: 1

cruby-x86-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -606,11 +617,11 @@ jobs:
./scripts/test-gem-install gems
cruby-aarch64-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -628,11 +639,11 @@ jobs:
./scripts/test-gem-install gems
cruby-arm-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -650,11 +661,11 @@ jobs:
./scripts/test-gem-install gems
cruby-x86_64-linux-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -687,11 +698,11 @@ jobs:
- run: ./scripts/test-gem-install gems

cruby-x86_64-darwin-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-13
steps:
- uses: actions/checkout@v4
Expand All @@ -707,11 +718,11 @@ jobs:
- run: ./scripts/test-gem-install gems

cruby-arm64-darwin-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: macos-14
steps:
- uses: actions/checkout@v4
Expand All @@ -727,11 +738,11 @@ jobs:
- run: ./scripts/test-gem-install gems

cruby-x64-mingw-ucrt-install:
needs: ["cruby-package"]
needs: ["cruby-package", "ruby_versions"]
strategy:
fail-fast: false
matrix:
ruby: ["3.1", "3.2", "3.3"]
ruby: ${{ fromJSON(needs.ruby_versions.outputs.minors) }}
runs-on: windows-2022
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit ba70658

Please sign in to comment.