You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.3 KiB
53 lines
1.3 KiB
name: Build and Test
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
services:
|
|
postgres:
|
|
image: postgres
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: postgres
|
|
POSTGRES_DB: postgres
|
|
ports:
|
|
- 5432:5432
|
|
# needed because the postgres container does not provide a healthcheck
|
|
# tmpfs makes DB faster by using RAM
|
|
options: >-
|
|
--mount type=tmpfs,destination=/var/lib/postgresql/data
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
env:
|
|
RAILS_ENV: test
|
|
PGHOST: localhost
|
|
PGUSER: postgres
|
|
PGPASSWORD: postgres
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
- name: Set up Ruby
|
|
uses: ruby/setup-ruby@v1
|
|
with:
|
|
bundler-cache: true
|
|
- name: Install rails dependencies
|
|
run: bundle install
|
|
- name: Create DB
|
|
run: bundle exec rake db:test:prepare
|
|
- name: Run tests
|
|
run: bundle exec rake
|
|
- name: Install javascript dependencies
|
|
run: yarn install
|
|
- name: Run javascript tests
|
|
run: yarn test
|
|
- name: Run Cypress tests
|
|
run: bundle exec rake cypress:run
|