-
Notifications
You must be signed in to change notification settings - Fork 10
91 lines (71 loc) · 2.76 KB
/
Copy pathci.yml
File metadata and controls
91 lines (71 loc) · 2.76 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
83
84
85
86
87
88
89
90
91
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
# Style only, so it needs no database and no RAILS_ENV. Runs alongside the
# test jobs rather than gating them: a bracket-spacing nit should not hide
# whether the suite passes.
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Set up Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Run RuboCop
run: bin/rubocop
test:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
DATABASE_URL: mysql2://root:root@127.0.0.1:3306/planning_department_test
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Start MySQL
run: sudo systemctl start mysql
- name: Set up Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Create database
run: bin/rails db:create db:schema:load
- name: Run tests
run: bundle exec rspec
# Hosts may run the engine on PostgreSQL, so the suite must stay green
# there too. Deliberately initializes via db:migrate (not schema:load,
# which the MySQL job covers): replaying every migration on PG is exactly
# the fresh-host installation path, and schema.rb is MySQL-flavored.
test-postgres:
runs-on: ubuntu-latest
env:
RAILS_ENV: test
# encoding=unicode overrides database.yml's MySQL-only utf8mb4;
# SCHEMA keeps the post-migrate dump away from the checked-in schema.rb.
DATABASE_URL: postgresql://postgres:postgres@127.0.0.1:5432/planning_department_test?encoding=unicode
SCHEMA: tmp/pg_schema.rb
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
- name: Start PostgreSQL
run: |
sudo systemctl start postgresql.service
sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"
- name: Set up Ruby
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: .ruby-version
bundler-cache: true
- name: Create database
run: bin/rails db:create db:migrate
# Two invocations: the second proves the seed is idempotent (rake
# would dedupe a repeated task within one invocation, so it needs to
# be two commands).
- name: Install required reference data (idempotency smoke test)
run: bin/rails coplan:seed && bin/rails coplan:seed
- name: Run tests
run: bundle exec rspec