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