-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (47 loc) · 1.65 KB
/
test.yml
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
name: Lint & test
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
permissions:
contents: read # for actions/checkout to fetch code
id-token: write # to get access to GitHub autogenerated OIDC token, used by codecov/codecov-action
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
# Install the version defined in .ruby-version
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
rubygems: latest
env:
BUNDLE_FROZEN: "true"
- name: Run git hooks
run: |
# Sign Overcommit configuration
bundle exec overcommit --sign
# Sign our custom hooks
bundle exec overcommit --sign pre-commit
bundle exec overcommit --run
env:
OVERCOMMIT_COLOR: "1"
- name: Run RuboCop
run: bundle exec rubocop --parallel --format github
- name: Configure PostgreSQL authentication
run: |
# Add our authentication line before everything else
# https://unix.stackexchange.com/a/99351
sudo sed --in-place '1 i\local all lea5 scram-sha-256' /etc/postgresql/*/main/pg_hba.conf
sudo systemctl restart postgresql.service
- name: Create PostgreSQL user and database
run: cp ./.github/workflows/init_db.sql /tmp/ && sudo --user postgres psql --file /tmp/init_db.sql
- name: Migrate database
run: bundle exec rails db:migrate RAILS_ENV=test
- name: Run tests
run: bundle exec rails test:all
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
use_oidc: true