remove rack-cors locking & update test credentials #277
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: Backend CI + Lint | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
pull_request: | |
branches: | |
- main | |
- develop | |
jobs: | |
test: | |
name: Rspec Test & Code Coverage | |
runs-on: ubuntu-latest | |
needs: lint | |
services: | |
postgres: | |
image: postgres:latest | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
ports: | |
- 5432:5432 | |
options: --health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Ruby and gems | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- name: Install system dependencies | |
run: | | |
sudo apt-get -y update | |
- name: Install PostgreSQL client | |
run: | | |
sudo apt-get -yqq install libpq-dev | |
- name: Install vips image variant | |
run: | | |
sudo apt-get install libvips | |
- name: Database setup | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/inicro_testing | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY_TEST }} | |
RAILS_ENV: test | |
run: | | |
bundle exec rails db:test:prepare db:migrate | |
- name: RSpec tests | |
env: | |
DATABASE_URL: postgres://postgres:password@localhost:5432/inicro_testing | |
RAILS_MASTER_KEY: ${{ secrets.RAILS_MASTER_KEY_TEST }} | |
RAILS_ENV: test | |
run: | | |
bundle exec rspec | |
- name: Create code coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: coverage/ | |
lint: | |
name: Linting and Security Audit | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
- name: Install dependencies | |
run: | | |
gem install bundler | |
bundle install --jobs 4 --retry 3 | |
- name: Security audit dependencies | |
run: bundle exec bundler-audit --update | |
- name: Security audit application code | |
run: bundle exec brakeman -q -w2 | |
- name: Lint via RuboCop | |
run: bundle exec rubocop --parallel -A |