Skip to content

Commit

Permalink
Add lint and test to CI
Browse files Browse the repository at this point in the history
  • Loading branch information
SocFoot committed Dec 12, 2023
1 parent 4abbfc1 commit b25ed4b
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
Binary file added .env.swp
Binary file not shown.
75 changes: 75 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build and Deploy
concurrency: build_and_deploy_${{ github.ref_name }}

on: push

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
tests: [rubocop, erblint, prettier]
include:
- tests: rubocop
command: bundle exec rubocop
- tests: erblint
command: bundle exec erblint app
- tests: prettier
command: yarn prettier
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true
- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get -yqq install libpq-dev
bundle install --jobs 4 --retry 3
- name: ${{ matrix.tests }}
run: ${{ env.COMMAND }}
env:
COMMAND: ${{ matrix.command }}

test:
name: Test
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13.5
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
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.2.2
bundler-cache: true

- name: Install dependencies
run: |
sudo apt-get update && sudo apt-get -yqq install libpq-dev
bundle install --jobs 4 --retry 3
- name: Run Tests
env:
RAILS_ENV: test
PGHOST: localhost
DISABLE_SPRING: 1
run: |
bundle exec rails db:schema:load
bundle exec rspec --format progress
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -521,7 +521,7 @@ DEPENDENCIES
web-console

RUBY VERSION
ruby 3.2.2p53
ruby 3.2.0p0

BUNDLED WITH
2.4.22

0 comments on commit b25ed4b

Please sign in to comment.