From e6a377bf96d3029b32e2f5d2442a7b7ae54ee983 Mon Sep 17 00:00:00 2001 From: Peter Yates Date: Sat, 21 Nov 2020 23:39:07 +0000 Subject: [PATCH] Add Github action that runs all build steps As per the previous travis.yml file we'll use a matrix to cover the supported versions of Ruby and Rails in all combinations. Unlike the previous version now we'll only run the following steps once (for the latest Ruby and Rails pairing): * Nanoc link check * CodeClimate setup * CodeClimate report submission It's unnecessary to run these multiple times --- .github/workflows/tests.yml | 54 +++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000..fedb7306 --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,54 @@ +name: Testing +on: + push: + branches: + - master + pull_request: +jobs: + rspec: + strategy: + fail-fast: false + matrix: + ruby: ['2.5.8', '2.6.6', '2.7.2'] + rails: ['5.2.4', '6.0.3'] + runs-on: ubuntu-20.04 + name: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }} + steps: + - uses: actions/checkout@v2 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby }} + + - name: Install gems + env: + RAILS_VERSION: ${{ matrix.rails }} + run: | + gem install bundler + bundle install --jobs 4 --retry 3 + + - name: Run Rubocop + run: make ruby-lint + + - name: Download CodeClimate reporter + if: ${{ matrix.ruby == '2.7.2' && matrix.rails == '6.0.3' }} + 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 + + - name: Run RSpec + run: make rspec + + - name: Report coverage to CodeClimate + if: ${{ matrix.ruby == '2.7.2' && matrix.rails == '6.0.3' }} + env: + CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} + GIT_BRANCH: ${{ steps.extract_branch.outputs.branch }} + GIT_COMMIT_SHA: ${{ github.sha }} + run: ./cc-test-reporter after-build -t simplecov + + - name: Run Nanoc Check + if: ${{ matrix.ruby == '2.7.2' && matrix.rails == '6.0.3' }} + run: make nanoc-check-all