CI: Add a GitHub Actions workflow to run specs and rubocop #1
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: Specs and Rubocop | |
on: | |
pull_request: | |
push: | |
env: | |
CC_TEST_REPORTER_ID: c18df080592f9c99ca8080a6d5e052aa5fd3964044a0fe0b71e48f8e18998dc2 | |
jobs: | |
specs-and-rubocop: | |
name: Specs and Rubocop | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout the latest code | |
uses: actions/checkout@v4 | |
- name: Setup codeclimate | |
continue-on-error: true | |
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 docker-compose build | |
run: docker-compose build | |
- name: Run rubocop | |
run: docker-compose run web rubocop | |
- name: Run specs | |
run: docker-compose run -e "RAILS_ENV=test" web rake db:test:prepare spec | |
- name: Report results to codeclimate (for job success) | |
if: ${{ success() }} | |
continue-on-error: true | |
run: ./cc-test-reporter after-build --exit-code 0 --prefix /refugerestrooms | |
- name: Report results to codeclimate (for job failure) | |
if: ${{ failure() }} | |
continue-on-error: true | |
run: ./cc-test-reporter after-build --exit-code 1 --prefix /refugerestrooms |