From d0dc780d440bae42bbc2a6cf816e0345db8109ae Mon Sep 17 00:00:00 2001 From: Ernesto Tagwerker Date: Thu, 3 Apr 2025 22:10:15 -0400 Subject: [PATCH 1/6] Try to fix test suite in GitHub Actions CI for Ruby 2.6 --- .github/workflows/test.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 2b4b48e..d8ddea4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,15 +16,12 @@ jobs: ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4"] steps: - - uses: actions/checkout@v1 + - uses: actions/checkout@v4 - name: Setup Ruby uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - - name: Uninstall existing Bundler - run: | - gem uninstall bundler -a -x || true - name: Install Bundler run: | if [[ "${{ matrix.ruby-version }}" == "2.5" ]]; then From 01adeb75d46ec39d172949b256a3daf54159b314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 31 Mar 2026 14:51:13 -0600 Subject: [PATCH 2/6] Use matrix includes to declare bundler versions per Ruby instead of bash conditionals --- .github/workflows/test.yml | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d8ddea4..74f7409 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,18 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - ruby-version: ["2.5", "2.6", "2.7", "3.0", "3.1", "3.2", "3.3", "3.4"] + include: + - ruby-version: "2.5" + bundler-version: "2.3.27" + - ruby-version: "2.6" + bundler-version: "2.4.0" + - ruby-version: "2.7" + bundler-version: "2.4.0" + - ruby-version: "3.0" + - ruby-version: "3.1" + - ruby-version: "3.2" + - ruby-version: "3.3" + - ruby-version: "3.4" steps: - uses: actions/checkout@v4 @@ -23,12 +34,8 @@ jobs: ruby-version: ${{ matrix.ruby-version }} bundler-cache: true - name: Install Bundler - run: | - if [[ "${{ matrix.ruby-version }}" == "2.5" ]]; then - gem install bundler -v "~> 2.3.27" - elif [[ "${{ matrix.ruby-version }}" == "2.6" || "${{ matrix.ruby-version }}" == "2.7" ]]; then - gem install bundler -v "~> 2.4.0" - fi + if: matrix.bundler-version + run: gem install bundler -v "~> ${{ matrix.bundler-version }}" - name: Build and run tests env: COVERAGE: true From 00beced5988e47d4baa1fc78a5e0873b64c4b246 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 31 Mar 2026 14:52:09 -0600 Subject: [PATCH 3/6] Fix bundler-cache: disable it when a custom bundler version is installed to avoid cache mismatches --- .github/workflows/test.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 74f7409..28f0f6c 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -32,10 +32,15 @@ jobs: uses: ruby/setup-ruby@v1 with: ruby-version: ${{ matrix.ruby-version }} - bundler-cache: true + # Disable bundler-cache when a custom bundler version is required, + # as setup-ruby's cache is tied to the bundler it installs. + bundler-cache: ${{ !matrix.bundler-version }} - name: Install Bundler if: matrix.bundler-version run: gem install bundler -v "~> ${{ matrix.bundler-version }}" + - name: Install gems + if: matrix.bundler-version + run: bundle install - name: Build and run tests env: COVERAGE: true From a5dc8d92559c458da67c7a235eda81d8ffe363ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 31 Mar 2026 14:52:26 -0600 Subject: [PATCH 4/6] Document TERM=xterm env var in CI test step --- .github/workflows/test.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 28f0f6c..3806c11 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -44,6 +44,7 @@ jobs: - name: Build and run tests env: COVERAGE: true + # TERM is required for colored/formatted test output in CI TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | From 6e3afb9c712b1f78824bcf392a21b25a93bae920 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 31 Mar 2026 14:52:58 -0600 Subject: [PATCH 5/6] Use run in a single line, no need to break it down --- .github/workflows/test.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3806c11..2c9146b 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,5 +47,4 @@ jobs: # TERM is required for colored/formatted test output in CI TERM: xterm CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} - run: | - bundle exec rake test + run: bundle exec rake test From 25d20590366425abba0c66fae789e59aa2f360fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20V=C3=A1squez?= Date: Tue, 31 Mar 2026 14:56:51 -0600 Subject: [PATCH 6/6] Update CHANGELOG.md --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5b33b72..03655ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # main ([unreleased](https://github.com/fastruby/rails_stats/compare/v1.0.2...main)) +* [CHORE: Improve the GH Test Workflow](https://github.com/fastruby/rails_stats/pull/35) * [BUGFIX: Fix JSON output missing Code and Tests total count](https://github.com/fastruby/rails_stats/pull/40) * Update README examples * [FEATURE: Output number of tables created from schema.rb or structure.sql, add polymorphic models count](https://github.com/fastruby/rails_stats/pull/37) @@ -25,4 +26,4 @@ # v1.0.1 / 2018-10-8 * [FEATURE: add more aggregate stats](https://github.com/fastruby/rails_stats/pull/5) -* [FEATURE: More detailed introspection of app](https://github.com/fastruby/rails_stats/pull/1) \ No newline at end of file +* [FEATURE: More detailed introspection of app](https://github.com/fastruby/rails_stats/pull/1)