-
-
Notifications
You must be signed in to change notification settings - Fork 199
139 lines (117 loc) Β· 3.74 KB
/
Copy pathruby.yml
File metadata and controls
139 lines (117 loc) Β· 3.74 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
name: CI
on: [ push, pull_request ]
jobs:
test:
name: 'Tests (Group ${{ matrix.ci_node_index }})'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ci_node_total: [6]
ci_node_index: [0, 1, 2, 3, 4, 5]
env:
# prevent unnecessary log output -- https://bundler.io/man/bundle-config.1.html
BUNDLE_IGNORE_FUNDING_REQUESTS: true
BUNDLE_IGNORE_MESSAGES: true
RAILS_ENV: test
COVERAGE: true
PARALLEL_TEST_PROCESSORS: ${{ matrix.ci_node_total }}
services:
postgres:
image: postgres:17
ports: ["5432:5432"]
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
# .ruby-version provides the Ruby version implicitly.
bundler-cache: true
- name: Cache Playwright browsers
uses: actions/cache@v5
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: playwright-${{ runner.os }}-chromium-headless-shell-1.59.0-${{ matrix.ci_node_index }}
- name: Install Playwright Chromium Headless Shell
run: npx --yes playwright@1.59.0 install chromium-headless-shell
- name: Install Playwright system dependencies
run: npx --yes playwright@1.59.0 install-deps chromium-headless-shell
- name: Setup test databases
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
run: |
bundle exec rake parallel:setup
- name: Run tests in parallel
env:
DATABASE_URL: postgres://postgres:postgres@localhost:5432
CI_NODE_INDEX: ${{ matrix.ci_node_index }}
RAILS_ENV: test
PLAYWRIGHT_HEADLESS: true
run: |
bundle exec parallel_rspec spec/ \
-n ${{ matrix.ci_node_total }} \
--only-group ${{ matrix.ci_node_index }}
- name: Preserve coverage results
run: |
# Copy resultset immediately after tests complete to prevent deletion
cp coverage/.resultset.json coverage/resultset-${{ matrix.ci_node_index }}.json
- name: Upload coverage artifacts
uses: actions/upload-artifact@v7
with:
name: coverage-${{ matrix.ci_node_index }}
path: coverage/resultset-${{ matrix.ci_node_index }}.json
retention-days: 1
security-audit:
name: 'Security Audit'
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run bundler-audit
run: bundle exec bundler-audit check
coverage:
name: 'Report Coverage'
runs-on: ubuntu-latest
needs: test
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Download all coverage artifacts
uses: actions/download-artifact@v8
with:
path: coverage-results
- name: Merge coverage results
run: |
mkdir -p coverage
bundle exec ruby -e '
require "json"
require "simplecov"
resultsets = {}
Dir["coverage-results/coverage-*/resultset-*.json"].each do |file|
data = JSON.parse(File.read(file))
resultsets.merge!(data)
end
File.write("coverage/.resultset.json", JSON.generate(resultsets))
'
- name: Report to Coveralls
continue-on-error: true
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.github_token }}