-
Notifications
You must be signed in to change notification settings - Fork 7
82 lines (80 loc) · 2.94 KB
/
test.yml
File metadata and controls
82 lines (80 loc) · 2.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This workflow uses actions that are not certified by GitHub. They are
# provided by a third-party and are governed by separate terms of service,
# privacy policy, and support documentation.
#
# This workflow will install a prebuilt Ruby version, install dependencies, and
# run tests and linters.
name: "Tests"
on:
push:
branches: [main]
pull_request:
branches: [main]
merge_group:
types: [checks_requested]
permissions:
contents: read
jobs:
build_and_test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:13-alpine
ports:
- "5432:5432"
env:
POSTGRES_DB: forms_runner_test
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
env:
RAILS_ENV: "test"
DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test"
QUEUE_DATABASE_URL: "postgres://postgres:postgres@localhost:5432/forms_runner_test_queue"
steps:
# TODO: remove these steps once we can use latest Chrome again (see https://github.com/teamcapybara/capybara/issues/2800)
- uses: nanasess/setup-chromedriver@e93e57b843c0c92788f22483f1a31af8ee48db25 # v2.3.0
with:
chromedriver-version: '128.0.6613.8600'
chromeapp: chrome
- run: |
sudo apt-get purge google-chrome-stable
- uses: browser-actions/setup-chrome@4f8e94349a351df0f048634f25fec36c3c91eded # v2.1.1
with:
chrome-version: 128
install-chromedriver: 'false'
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
# Add or replace dependency steps here
- name: Install Ruby and gems
# The ruby version is taken from the .ruby-version file, no need to specify here.
uses: ruby/setup-ruby@09a7688d3b55cf0e976497ff046b70949eeaccfd # v1.288.0
with:
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Install Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: Install frontend dependencies
run: npm ci
- name: Run Frontend build
run: bin/vite build
# Add or replace database setup steps here
- name: Create db
run: bin/rails db:migrate
- name: Set up database schema
run: bin/rails db:schema:load
# Add or replace test runners here
- name: Run Ruby tests
run: bundle exec rspec
- name: Run JavaScript tests
run: npm test
# Add or replace any other lints here
- name: Security audit dependencies
run: bundle exec bundle-audit check --update
- name: Security audit application code
run: bundle exec brakeman -q -w2
- name: Lint Ruby files
run: bundle exec rubocop --parallel
- name: Lint Javascript and Sass files
run: npm run lint