Skip to content

Commit

Permalink
Add Github action that runs all build steps
Browse files Browse the repository at this point in the history
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
  • Loading branch information
peteryates committed Nov 21, 2020
1 parent 88f1211 commit 8e2c3a0
Showing 1 changed file with 51 additions and 0 deletions.
51 changes: 51 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Testing
on:
- 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

0 comments on commit 8e2c3a0

Please sign in to comment.