From bbb5a86f19eb622242cdeebfa35644f2f861d210 Mon Sep 17 00:00:00 2001 From: Cristian Molina Date: Sat, 7 Oct 2023 10:06:03 -0300 Subject: [PATCH] Update GH actions build (#6) --- .github/workflows/ci.yml | 54 +++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f3673a4..bebd39f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,46 +1,37 @@ name: ci on: [push, pull_request] - jobs: - build: - runs-on: ubuntu-latest + test: strategy: + fail-fast: false matrix: - ruby_version: [2.5.x, 2.6.x, 2.7.x] - + os: [ubuntu-latest, macos-latest] + ruby: ['2.7', '3.0', '3.1', head, jruby, jruby-head, truffleruby, truffleruby-head] + runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v2 - - name: Set up Ruby - uses: actions/setup-ruby@v1 - with: - ruby-version: ${{ matrix.ruby_version }} - - name: Calculate variable dynamic values - id: dynamic_values - run: | - echo "::set-output name=installed_ruby_version::$(ruby -e 'print RUBY_VERSION')" - echo "::set-output name=cacheTimeAnchor::$(ruby -e 'require %Q{date}; cacheExpirationSeconds = 60*60*24; print (Time.now.to_i / cacheExpirationSeconds)')" + - uses: actions/checkout@v3 - name: Download CodeClimate reporter run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build + if [ "$RUNNER_OS" == "Linux" ]; then + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + elif [ "$RUNNER_OS" == "macOS" ]; then + curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-darwin-amd64 > ./cc-test-reporter + chmod +x ./cc-test-reporter + ./cc-test-reporter before-build + else + echo "$RUNNER_OS not supported" + exit 1 + fi env: CC_TEST_REPORTER_ID: 903dc1a761aaec438bc9f39467e2cb4a2ea332bdb65241b37abef6338c5e6326 - - name: Install and config bundler - run: | - gem install bundler:2.1.4 - - name: Generate 'Gemfile.lock' before caching gems - run: | - bundle lock --update - - uses: actions/cache@v2 + shell: bash + - uses: ruby/setup-ruby@v1 with: - path: vendor/bundle - key: ${{ runner.os }}-ruby_v${{ steps.dynamic_values.outputs.installed_ruby_version }}-time_${{steps.dynamic_values.outputs.cacheTimeAnchor}}-gems-${{ hashFiles('**/Gemfile.lock') }} - - name: Install dependencies - run: | - bundle config set path 'vendor/bundle' - bundle install --jobs 4 --retry 3 + ruby-version: ${{ matrix.ruby }} + bundler-cache: true # runs 'bundle install' and caches installed gems automatically - name: Run code analysis run: | bundle exec rake code_analysis @@ -52,3 +43,4 @@ jobs: ./cc-test-reporter after-build --exit-code 0 env: CC_TEST_REPORTER_ID: 903dc1a761aaec438bc9f39467e2cb4a2ea332bdb65241b37abef6338c5e6326 + - run: bundle exec rspec