Merge pull request #461 from nla/feat/blac-673_bibref-structure #1492
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
# This workflow runs the unit and system tests, as well as static code analysis | |
# and dependecy vulnerability checks. | |
# | |
# It uses the default MySQL database included in the runner (usually ubuntu-latest). | |
name: "Tests and code quality" | |
on: | |
push: | |
branches: | |
- "main" | |
- "release/sprint-*" | |
- "hotfix/*" | |
pull_request: | |
branches: | |
- "main" | |
- "release/sprint-*" | |
- "hotfix/*" | |
jobs: | |
linters: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-lint | |
cancel-in-progress: true | |
name: Linters | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: RuboCop | |
run: | | |
bundle exec rubocop --parallel | |
- name: Brakeman code scanning | |
run: | | |
bundle exec brakeman -q -o tmp/brakeman.html | |
- name: Bundler Audit check | |
run: | | |
bundle exec bundle audit check --update | |
tests: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }}-test | |
cancel-in-progress: true | |
name: Tests | |
runs-on: ubuntu-latest | |
env: | |
CI: true | |
DB_DATABASE: arclight_test | |
DB_USER: root | |
DB_PASSWORD: root | |
RAILS_ENV: test | |
DATABASE_URL: "mysql2://root:root@localhost:3306/arclight_test" | |
PATRONS_DB_URL: "mysql2://root:root@localhost:3306/arclight_test" | |
REDIS_URL: redis://localhost:6379/0 | |
services: | |
redis: | |
image: redis:alpine | |
ports: | |
- 6379:6379 | |
options: --entrypoint redis-server | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Set up MySQL | |
run: | | |
pwd | |
sudo /etc/init.d/mysql start | |
mysql -e 'CREATE DATABASE ${{ env.DB_DATABASE }};' -u${{ env.DB_USER }} -p${{ env.DB_PASSWORD }} | |
- name: RSpec tests | |
run: | | |
bundle exec rails assets:precompile | |
bundle exec rspec | |
- name: Simplecov Report | |
uses: aki77/simplecov-report-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
failedThreshold: 80 | |
if: ${{ github.actor != 'dependabot[bot]' }} |