From 35f625a2a6bbae8dc5de6256f00e2941920c995a Mon Sep 17 00:00:00 2001 From: Patrik Ragnarsson Date: Tue, 8 Feb 2022 10:03:02 +0100 Subject: [PATCH 1/3] Improve Ruby guide - The wildcard doesn't work in setup-ruby - Update to the latest version of setup-ruby: https://github.com/ruby/setup-ruby/releases/tag/v1.97.0 --- .../building-and-testing-ruby.md | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/content/actions/automating-builds-and-tests/building-and-testing-ruby.md b/content/actions/automating-builds-and-tests/building-and-testing-ruby.md index 3e95e6376acc..ee474908d4a5 100644 --- a/content/actions/automating-builds-and-tests/building-and-testing-ruby.md +++ b/content/actions/automating-builds-and-tests/building-and-testing-ruby.md @@ -54,9 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Ruby - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6 + uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: - ruby-version: 2.6 + ruby-version: '3.1' - name: Install dependencies run: bundle install - name: Run tests @@ -65,7 +65,7 @@ jobs: ## Specifying the Ruby version -The easiest way to specify a Ruby version is by using the `ruby/setup-ruby` action provided by the Ruby organization on GitHub. The action adds any supported Ruby version to `PATH` for each job run in a workflow. For more information see, the [`ruby/setup-ruby`](https://github.com/ruby/setup-ruby). +The easiest way to specify a Ruby version is by using the `ruby/setup-ruby` action provided by the Ruby organization on GitHub. The action adds any supported Ruby version to `PATH` for each job run in a workflow. For more information and available Ruby versions, see [`ruby/setup-ruby`](https://github.com/ruby/setup-ruby). Using Ruby's `ruby/setup-ruby` action is the recommended way of using Ruby with GitHub Actions because it ensures consistent behavior across different runners and different versions of Ruby. @@ -75,9 +75,9 @@ The `setup-ruby` action takes a Ruby version as an input and configures that ver ```yaml steps: - uses: actions/checkout@v2 -- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6 +- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: - ruby-version: 2.6 # Not needed with a .ruby-version file + ruby-version: '3.1' # Not needed with a .ruby-version file - run: bundle install - run: bundle exec rake ``` @@ -87,13 +87,13 @@ Alternatively, you can check a `.ruby-version` file into the root of your repos ## Testing with multiple versions of Ruby -You can add a matrix strategy to run your workflow with more than one version of Ruby. For example, you can test your code against the latest patch releases of versions 2.7, 2.6, and 2.5. The 'x' is a wildcard character that matches the latest patch release available for a version. +You can add a matrix strategy to run your workflow with more than one version of Ruby. For example, you can test your code against the latest patch releases of versions 3.1, 3.0, and 2.7. {% raw %} ```yaml strategy: matrix: - ruby-version: [2.7.x, 2.6.x, 2.5.x] + ruby-version: ['3.1', '3.0', '2.7'] ``` {% endraw %} @@ -119,12 +119,12 @@ jobs: strategy: matrix: - ruby-version: [2.7.x, 2.6.x, 2.5.x] + ruby-version: ['3.1', '3.0', '2.7'] steps: - uses: actions/checkout@v2 - name: {% raw %}Set up Ruby ${{ matrix.ruby-version }}{% endraw %} - uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6 + uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: ruby-version: {% raw %}${{ matrix.ruby-version }}{% endraw %} - name: Install dependencies @@ -141,9 +141,9 @@ The `setup-ruby` action will automatically install bundler for you. The version ```yaml steps: - uses: actions/checkout@v2 -- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6 +- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: - ruby-version: 2.6 + ruby-version: '3.1' - run: bundle install ``` {% endraw %} @@ -157,7 +157,7 @@ To enable caching, set the following. {% raw %} ```yaml steps: -- uses: ruby/setup-ruby@477b21f02be01bcb8030d50f37cfec92bfa615b6 +- uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: bundler-cache: true ``` From d685ce3dc303da1c4c760a37efb37b469f1ccb7b Mon Sep 17 00:00:00 2001 From: Patrik Ragnarsson Date: Tue, 8 Feb 2022 12:02:38 +0100 Subject: [PATCH 2/3] Add comment about ruby/setup-ruby@v1 The same comment can be found in the actions/starter-workflows workflow for Ruby: https://github.com/actions/starter-workflows/blob/2e489c26196ef3b0c1ff38e460beae83e522e2d4/ci/ruby.yml#L27-L29 --- .../automating-builds-and-tests/building-and-testing-ruby.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/content/actions/automating-builds-and-tests/building-and-testing-ruby.md b/content/actions/automating-builds-and-tests/building-and-testing-ruby.md index ee474908d4a5..6e8ff885b9b2 100644 --- a/content/actions/automating-builds-and-tests/building-and-testing-ruby.md +++ b/content/actions/automating-builds-and-tests/building-and-testing-ruby.md @@ -54,6 +54,9 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Ruby + # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, + # change this to (see https://github.com/ruby/setup-ruby#versioning): + # uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: ruby-version: '3.1' From c954a53c9ead40f7ec3d022cfb99c18684b5c3a5 Mon Sep 17 00:00:00 2001 From: Sarah Edwards Date: Fri, 11 Feb 2022 11:05:31 -0800 Subject: [PATCH 3/3] remove comment for now --- .../automating-builds-and-tests/building-and-testing-ruby.md | 3 --- 1 file changed, 3 deletions(-) diff --git a/content/actions/automating-builds-and-tests/building-and-testing-ruby.md b/content/actions/automating-builds-and-tests/building-and-testing-ruby.md index 6e8ff885b9b2..ee474908d4a5 100644 --- a/content/actions/automating-builds-and-tests/building-and-testing-ruby.md +++ b/content/actions/automating-builds-and-tests/building-and-testing-ruby.md @@ -54,9 +54,6 @@ jobs: steps: - uses: actions/checkout@v2 - name: Set up Ruby - # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby, - # change this to (see https://github.com/ruby/setup-ruby#versioning): - # uses: ruby/setup-ruby@v1 uses: ruby/setup-ruby@359bebbc29cbe6c87da6bc9ea3bc930432750108 with: ruby-version: '3.1'