From 494ef96224e26efa2e69f3af1f0f5352bcab613b Mon Sep 17 00:00:00 2001 From: DeeDeeG Date: Sun, 28 Apr 2024 11:02:30 -0400 Subject: [PATCH] CI: Add a GitHub Actions workflow to run specs and rubocop --- .github/workflows/specs-and-rubocop.yml | 40 +++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 .github/workflows/specs-and-rubocop.yml diff --git a/.github/workflows/specs-and-rubocop.yml b/.github/workflows/specs-and-rubocop.yml new file mode 100644 index 00000000..c2d24d51 --- /dev/null +++ b/.github/workflows/specs-and-rubocop.yml @@ -0,0 +1,40 @@ +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