made DRY-er #151
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: build | |
on: [push, workflow_dispatch] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
CCTR: ./cc-test-reporter | |
BUNDLE_WITHOUT: production | |
BUNDLE_BUILD__NOKOGIRI: --use-system-libraries | |
TZ: America/Los_Angeles | |
steps: | |
- uses: actions/checkout@v1 | |
- name: install libxslt | |
run: | | |
sudo apt-get install -y libxslt-dev | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.7.7 | |
bundler-cache: false | |
- name: create test database and secrets file | |
run: | | |
gpg --pinentry-mode loopback --batch --passphrase "${{ secrets.GPG_SYMMETRIC_KEY }}" -d -o config/application.yml config/application.yml.asc | |
cp config/database.yml.test config/database.yml | |
- name: Setup CodeClimate test-reporter | |
run: | | |
curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > $CCTR | |
chmod +x $CCTR | |
$CCTR before-build | |
- name: install gems | |
run: | | |
bundle install --without production | |
- name: run RSpec tests and capture coverage | |
run: | | |
bundle exec rspec | |
$CCTR format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov | |
- name: run Cucumber tests and capture coverage | |
run: | | |
bundle exec cucumber --retry 2 2>/dev/null | |
$CCTR format-coverage --output coverage/codeclimate.$SUITE.json --input-type simplecov | |
- name: Publish code coverage | |
run: | | |
export GIT_BRANCH="${GITHUB_REF/refs\/heads\//}" | |
$CCTR sum-coverage coverage/codeclimate.*.json | |
$CCTR upload-coverage --id ${{ secrets.CC_TEST_REPORTER_ID }} | |
$CCTR after-build --id ${{ secrets.CC_TEST_REPORTER_ID }} |