pt #4641
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: Build and Test | |
concurrency: build_and_test_${{ github.ref_name }} | |
on: push | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
tests: [rubocop, erblint] | |
include: | |
- tests: rubocop | |
command: bundle exec rubocop | |
- tests: erblint | |
command: bundle exec erb_lint app | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.5 | |
bundler-cache: true | |
- name: ${{ matrix.tests }} | |
run: ${{ matrix.COMMAND }} | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:16 | |
env: | |
POSTGRES_PASSWORD: password | |
ports: ["5432:5432"] | |
options: >- | |
--health-cmd pg_isready | |
--health-interval 10s | |
--health-timeout 5s | |
--health-retries 5 | |
strategy: | |
fail-fast: false | |
env: | |
RAILS_ENV: test | |
DATABASE_URL: postgres://postgres:password@localhost:5432 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 3.3.5 | |
bundler-cache: true | |
- name: Setup PROJ | |
run: | | |
sudo apt-get update | |
sudo apt-get install proj-bin | |
- name: Use Node.js 20.9.0 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.9.0 | |
cache: "npm" | |
- name: Run RSpec tests | |
run: bundle exec rails test:prepare parallel:setup zeitwerk:check parallel:spec | |
- name: Upload code coverage report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: code-coverage | |
path: coverage/ | |
- name: Detect missing code coverage | |
run: bundle exec undercover --compare origin/main | |
- name: Upload failure screenshots | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: failure-screenshots | |
path: tmp/capybara/ | |
if-no-files-found: ignore |