-
Notifications
You must be signed in to change notification settings - Fork 5
173 lines (149 loc) · 4.73 KB
/
Copy pathci.yml
File metadata and controls
173 lines (149 loc) · 4.73 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- "**"
permissions:
contents: read
env:
BUNDLE_JOBS: '3'
BUNDLE_RETRY: '3'
PAGER: ''
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- name: Set up Ruby and bundle cache
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: .tool-versions
bundler-cache: true
cache-version: 1
- name: Run RuboCop
run: bundle exec rubocop --format progress
zizmor:
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
- name: Run zizmor
run: uvx "zizmor@1.29.0" .
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
test:
runs-on: ubuntu-latest
timeout-minutes: 45
permissions:
contents: read
issues: write
pull-requests: write
packages: read
env:
RAILS_ENV: test
POSTGRES_DB: choco_cake_test
POSTGRES_PASSWORD: password
POSTGRES_USER: choco
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: '5432'
REDIS_URL: redis://127.0.0.1:6379/1
HOSTNAME: 127.0.0.1
ACTIVE_RECORD_ENCRYPTION_PRIMARY_KEY: primary-key
ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT: derivation-salt
EDITOR_ENCRYPTION_KEY: a1b2c3d4e5f67890123456789abcdef0123456789abcdef0123456789abcdef0
SALESFORCE_CONNECT_HOST: 127.0.0.1
SALESFORCE_CONNECT_PORT: '4101'
SALESFORCE_CONNECT_USER: postgres
SALESFORCE_CONNECT_PASSWORD: password
SALESFORCE_CONNECT_DB: salesforce_test
services:
postgres:
image: postgres:12
env:
POSTGRES_DB: choco_cake_test
POSTGRES_PASSWORD: password
POSTGRES_USER: choco
ports:
- 5432:5432
options: >-
--health-cmd="pg_isready -U choco -d choco_cake_test"
--health-interval=10s
--health-timeout=5s
--health-retries=5
redis:
image: redis:6.2-alpine
ports:
- 6379:6379
salesforce_connect:
image: 'ghcr.io/raspberrypifoundation/heroku-connect' # zizmor: ignore[unpinned-images]
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
env:
POSTGRES_DB: salesforce_test
POSTGRES_PASSWORD: password
POSTGRES_USER: postgres
ports:
- 4101:5432
options: >-
--health-cmd="pg_isready -h 127.0.0.1 -U postgres"
--health-interval=5s
--health-timeout=5s
--health-retries=5
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0
with:
persist-credentials: false
- name: Install test dependencies
run: >
sudo apt-get update && sudo apt-get install --yes --no-install-recommends
libvips
- name: Set up Firefox
uses: browser-actions/setup-firefox@0bc507ddf224827e3b1af68e014d5e42ab93e795 # v1.7.2
- name: Set up Ruby and bundle cache
uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1.321.0
with:
ruby-version: .tool-versions
bundler-cache: true
cache-version: 1
- name: Verify Firefox availability
run: firefox --version
- name: Wait for DB
run: |
until pg_isready -h "$POSTGRES_HOST" -p "$POSTGRES_PORT" -U "$POSTGRES_USER"; do
sleep 1
done
- name: Database setup
run: bin/rails db:setup --trace
- name: Run test suite
run: bundle exec rspec
- name: Upload coverage artifact
if: always()
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: coverage
path: coverage
if-no-files-found: ignore
- name: Build coverage comment
if: always() && github.event_name == 'pull_request'
id: coverage_comment
run: .github/scripts/build_coverage_comment.sh
- name: Comment coverage on PR
if: always() && github.event_name == 'pull_request'
continue-on-error: true
env:
GITHUB_TOKEN: ${{ github.token }}
COVERAGE_MESSAGE: ${{ steps.coverage_comment.outputs.message }}
run: .github/scripts/post_coverage_comment.sh