-
Notifications
You must be signed in to change notification settings - Fork 371
151 lines (147 loc) · 4.95 KB
/
Copy pathunit_tests.yml
File metadata and controls
151 lines (147 loc) · 4.95 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
name: Unit Tests
concurrency:
group: '${{ github.workflow }}-${{ github.head_ref || github.run_id }}'
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
rspec_profile:
description: 'Top N slowest examples to print (rspec --profile), e.g. 20. Leave blank to disable.'
required: false
default: ''
pull_request:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'decisions/**'
- '.github/workflows/docs_test.yml'
push:
branches: [ main ]
paths-ignore:
- 'docs/**'
- 'decisions/**'
- '.github/workflows/docs_test.yml'
permissions:
contents: read # to fetch code (actions/checkout)
jobs:
Rubocop:
runs-on: ubuntu-latest
steps:
- uses: hmarr/debug-action@v3
- uses: actions/checkout@v7
- uses: ./.github/workflows/composite/setup
- name: Run Rubocop
run: bundle exec rake rubocop
- uses: ravsamhq/notify-slack-action@v2
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
Test-Postgres:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
image: ["postgres:14", "postgres:15", "postgres:17"]
services:
postgres:
image: ${{ matrix.image }}
env:
POSTGRES_PASSWORD: rootpassword
# Test-only durability tuning: skip the work that backs durability.
command: >-
postgres
-c fsync=off
-c synchronous_commit=off
-c full_page_writes=off
options: >-
--tmpfs /var/lib/postgresql/data:rw,size=2g
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- uses: hmarr/debug-action@v3
- uses: actions/checkout@v7
- uses: ./.github/workflows/composite/setup
- name: Restore parallel_rspec runtime logs
uses: actions/cache/restore@v6
with:
path: tmp/parallel_runtime_rspec_*.log
key: parallel-runtime-postgres-${{ matrix.image }}-${{ github.run_id }}
restore-keys: |
parallel-runtime-postgres-${{ matrix.image }}-
parallel-runtime-postgres-
- name: Run tests
run: DB=postgres POSTGRES_CONNECTION_PREFIX="postgres://postgres:rootpassword@localhost:5432" RSPEC_PROFILE="${{ inputs.rspec_profile }}" bundle exec rake spec
- name: Save parallel_rspec runtime logs
if: always() && github.ref == 'refs/heads/main'
uses: actions/cache/save@v6
with:
path: tmp/parallel_runtime_rspec_*.log
key: parallel-runtime-postgres-${{ matrix.image }}-${{ github.run_id }}
- uses: ravsamhq/notify-slack-action@v2
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required
Test-Mysql:
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
fail-fast: false
matrix:
image: ["mysql:8.0", "mysql:8.2"]
services:
mysql:
image: ${{ matrix.image }}
env:
MYSQL_DATABASE: cc_test
MYSQL_ROOT_PASSWORD: password
# Test-only durability tuning: skip the redo/binlog/doublewrite work.
command: >-
--innodb-flush-log-at-trx-commit=0
--sync-binlog=0
--innodb-doublewrite=OFF
options: >-
--tmpfs /var/lib/mysql:rw,size=2g
--health-cmd="mysqladmin ping"
--health-interval=10s
--health-timeout=5s
--health-retries=3
ports:
- 3306:3306
steps:
- uses: hmarr/debug-action@v3
- uses: actions/checkout@v7
- uses: ./.github/workflows/composite/setup
- name: Restore parallel_rspec runtime logs
uses: actions/cache/restore@v6
with:
path: tmp/parallel_runtime_rspec_*.log
key: parallel-runtime-mysql-${{ matrix.image }}-${{ github.run_id }}
restore-keys: |
parallel-runtime-mysql-${{ matrix.image }}-
parallel-runtime-mysql-
- name: Run tests
run: DB=mysql MYSQL_CONNECTION_PREFIX="mysql2://root:password@127.0.0.1:3306" RSPEC_PROFILE="${{ inputs.rspec_profile }}" bundle exec rake spec
- name: Save parallel_rspec runtime logs
if: always() && github.ref == 'refs/heads/main'
uses: actions/cache/save@v6
with:
path: tmp/parallel_runtime_rspec_*.log
key: parallel-runtime-mysql-${{ matrix.image }}-${{ github.run_id }}
- uses: ravsamhq/notify-slack-action@v2
if: github.event_name == 'push'
with:
status: ${{ job.status }}
notify_when: 'failure' # default is 'success,failure,warnings'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} # required