188: setup act as paranoid to all classes #20
Workflow file for this run
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 Rails CI | |
on: [pull_request] | |
jobs: | |
lint: | |
name: Linters | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: backend | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
working-directory: backend | |
- name: Lint files | |
run: bin/lint | |
scan: | |
name: Security Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
working-directory: backend | |
- name: Scan code vulnerabilities | |
run: bin/scan | |
working-directory: backend | |
test: | |
name: Test | |
defaults: | |
run: | |
working-directory: backend | |
needs: | |
- lint | |
- scan | |
runs-on: ubuntu-latest | |
env: | |
ELASTICSEARCH_HOST: http://localhost:9200 | |
DATABASE_URL: postgres://postgres:example@localhost:5432/app_test | |
services: | |
postgres: | |
image: postgres:14.2 | |
ports: ["5432:5432"] | |
env: | |
POSTGRES_DB: app_test | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: example | |
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
bundler-cache: true | |
working-directory: backend | |
- name: Install postgres client | |
run: sudo apt-get install libpq-dev | |
- name: Create database structure | |
run: RAILS_ENV=test bin/rails db:create db:migrate | |
- name: Configure sysctl limits | |
run: | | |
sudo swapoff -a | |
sudo sysctl -w vm.swappiness=1 | |
sudo sysctl -w fs.file-max=262144 | |
sudo sysctl -w vm.max_map_count=262144 | |
- name: Runs Elasticsearch | |
uses: elastic/elastic-github-actions/elasticsearch@master | |
with: | |
stack-version: 8.10.2 | |
security-enabled: false | |
- name: Elasticsearch is reachable | |
run: | | |
curl --verbose --show-error --insecure http://localhost:9200 | |
- name: Run tests | |
run: bundle exec bin/rspec spec --format progress -P ./*/**/*_spec.rb |