Getting Ruby and Rails versions from endoflife.date #206
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
# branches: [main] | |
pull_request: | |
jobs: | |
versions: | |
name: Get latest versions | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
product: ["ruby", "rails"] | |
outputs: | |
ruby: ${{ steps.supported.outputs.ruby }} | |
rails: ${{ steps.supported.outputs.rails }} | |
steps: | |
- id: latest | |
run: | | |
product="${{ matrix.product }}" | |
data=$(curl https://endoflife.date/api/$product.json) | |
supported=$(echo $data | jq '[.[] | select(.eol > (now | strftime("%Y-%m-%d")))]') | |
echo "${product}=$(echo $supported | jq -c 'map(.latest)')" >> $GITHUB_OUTPUT | |
test: | |
needs: versions | |
runs-on: ubuntu-latest | |
name: Test on Ruby ${{ matrix.ruby }} and Rails ${{ matrix.rails }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ruby: ${{ fromJSON(needs.versions.outputs.ruby) }} | |
rails: ${{ fromJSON(needs.versions.outputs.rails) }} | |
env: | |
RAILS_VERSION: ${{ matrix.rails }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
ruby-version: ${{ matrix.ruby }} | |
- name: Run Rake | |
run: bundle exec rake |