From eb147231e008afa60f842fbc58434149259ab7f8 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 13 Dec 2024 09:29:32 -0500 Subject: [PATCH 1/3] Getting Ruby and Rails versions from endoflife.date --- .github/workflows/ci.yml | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ecb285f8..afd96368 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,14 +4,31 @@ on: 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: supported + 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: - name: Test on Ruby ${{ matrix.ruby }} and Rails ${{ matrix.rails }} + needs: versions runs-on: ubuntu-latest + name: Test on Ruby ${{ matrix.ruby }} and Rails ${{ matrix.rails }} strategy: fail-fast: false matrix: - ruby: ['3.0', '3.1', '3.2', '3.3'] - rails: ['6.1.0', '7.0.0', '7.1.0'] + ruby: ${{ fromJSON(needs.versions.outputs.ruby) }} + rails: ${{ fromJSON(needs.versions.outputs.rails) }} env: RAILS_VERSION: ${{ matrix.rails }} steps: From 882de3142c23bfc908941c0a92246a480efce199 Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 13 Dec 2024 14:40:20 -0500 Subject: [PATCH 2/3] Try continuing when bundle install fails --- .github/workflows/ci.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index afd96368..541accd8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -35,9 +35,15 @@ jobs: - name: Check out repository code uses: actions/checkout@v4 - name: Set up Ruby + id: setup-ruby uses: ruby/setup-ruby@v1 with: bundler-cache: true ruby-version: ${{ matrix.ruby }} + continue-on-error: true + - name: Incompatible Versions + if: steps.setup-ruby.outcome == 'failure' + run: echo "Ruby ${{ matrix.ruby }} is not supported with Rails ${{ matrix.rails }}" - name: Run Rake + if: steps.setup-ruby.outcome != 'failure' run: bundle exec rake From fdd83ed9946ce4ffb1e39c790ebbe2ea572f387d Mon Sep 17 00:00:00 2001 From: Brandon Keepers Date: Fri, 13 Dec 2024 15:03:57 -0500 Subject: [PATCH 3/3] Run tests once/day to test against latest versions --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 541accd8..adf53c93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,6 +3,9 @@ on: push: branches: [main] pull_request: + schedule: + - cron: "0 0 * * *" # Once/day + jobs: versions: name: Get latest versions