-
Notifications
You must be signed in to change notification settings - Fork 0
204 lines (179 loc) · 6.13 KB
/
qa.yml
File metadata and controls
204 lines (179 loc) · 6.13 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
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
name: Quality Assurance
on:
workflow_call:
inputs:
ruby_versions:
description: "Ruby versions to test (comma-separated)"
type: string
default: "3.1,3.2,3.3"
ref_override:
description: "Override config-packs ref for hotfixes (maps to CONFIG_PACKS_REF)"
type: string
required: false
enable_cache:
description: "Enable bundler and other caching"
type: boolean
default: true
vale_min_alert:
description: "Minimum Vale alert level (suggestion, warning, error)"
type: string
default: "warning"
paths:
description: "Paths to lint/test (space-separated)"
type: string
required: false
skip_vale:
description: "Skip Vale prose linting"
type: boolean
default: false
skip_rubocop:
description: "Skip RuboCop code linting"
type: boolean
default: false
skip_htmlproofer:
description: "Skip HTML-Proofer link checking"
type: boolean
default: false
jobs:
config-sync:
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: ${{ inputs.enable_cache }}
- name: Set config packs ref override
if: inputs.ref_override
run: echo "CONFIG_PACKS_REF=${{ inputs.ref_override }}" >> $GITHUB_ENV
- name: Sync configurations
run: bundle exec rake labdev:sync:configs
- name: Verify config sync
run: |
if ! git diff --quiet; then
echo "❌ Config files are out of sync!"
echo "Please run 'bundle exec rake labdev:sync:configs' and commit the changes."
git diff --name-only
exit 1
fi
rubocop:
runs-on: ubuntu-latest
needs: config-sync
timeout-minutes: 10
if: ${{ !inputs.skip_rubocop }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: ${{ inputs.enable_cache }}
- name: Sync configurations
run: bundle exec rake labdev:sync:configs
- name: Run RuboCop
run: |
if [ -n "${{ inputs.paths }}" ]; then
bundle exec rake labdev:lint:ruby PATHS="${{ inputs.paths }}"
else
bundle exec rake labdev:lint:ruby
fi
vale:
runs-on: ubuntu-latest
needs: config-sync
timeout-minutes: 15
if: ${{ !inputs.skip_vale }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: ${{ inputs.enable_cache }}
- name: Sync configurations
run: bundle exec rake labdev:sync:configs
- name: Set Vale alert level
run: echo "VALE_MIN_ALERT_LEVEL=${{ inputs.vale_min_alert }}" >> $GITHUB_ENV
- name: Run Vale
run: |
if [ -n "${{ inputs.paths }}" ]; then
bundle exec rake labdev:lint:docs PATHS="${{ inputs.paths }}"
else
bundle exec rake labdev:lint:docs
fi
htmlproofer:
runs-on: ubuntu-latest
needs: config-sync
timeout-minutes: 20
if: ${{ !inputs.skip_htmlproofer }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2'
bundler-cache: ${{ inputs.enable_cache }}
- name: Sync configurations
run: bundle exec rake labdev:sync:configs
- name: Build site (if needed)
run: |
if [ -f "_config.yml" ] || [ -f "config.ru" ]; then
if command -v jekyll &> /dev/null && [ -f "_config.yml" ]; then
echo "Building Jekyll site..."
bundle exec jekyll build
elif [ -f "config.ru" ]; then
echo "Rack application detected - HTML-Proofer will run against existing files"
fi
fi
- name: Run HTML-Proofer
run: |
if [ -n "${{ inputs.paths }}" ]; then
bundle exec rake labdev:lint:html PATHS="${{ inputs.paths }}"
else
bundle exec rake labdev:lint:html
fi
summary:
runs-on: ubuntu-latest
needs: [config-sync, rubocop, vale, htmlproofer]
if: always()
timeout-minutes: 2
steps:
- name: Quality Assurance Summary
run: |
echo "## Quality Assurance Results" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
# Config Sync
if [ "${{ needs.config-sync.result }}" = "success" ]; then
echo "✅ **Config Sync**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Config Sync**: Failed" >> $GITHUB_STEP_SUMMARY
fi
# RuboCop
if [ "${{ inputs.skip_rubocop }}" = "true" ]; then
echo "⏭️ **RuboCop**: Skipped" >> $GITHUB_STEP_SUMMARY
elif [ "${{ needs.rubocop.result }}" = "success" ]; then
echo "✅ **RuboCop**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **RuboCop**: Failed" >> $GITHUB_STEP_SUMMARY
fi
# Vale
if [ "${{ inputs.skip_vale }}" = "true" ]; then
echo "⏭️ **Vale**: Skipped" >> $GITHUB_STEP_SUMMARY
elif [ "${{ needs.vale.result }}" = "success" ]; then
echo "✅ **Vale**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **Vale**: Failed" >> $GITHUB_STEP_SUMMARY
fi
# HTML-Proofer
if [ "${{ inputs.skip_htmlproofer }}" = "true" ]; then
echo "⏭️ **HTML-Proofer**: Skipped" >> $GITHUB_STEP_SUMMARY
elif [ "${{ needs.htmlproofer.result }}" = "success" ]; then
echo "✅ **HTML-Proofer**: Passed" >> $GITHUB_STEP_SUMMARY
else
echo "❌ **HTML-Proofer**: Failed" >> $GITHUB_STEP_SUMMARY
fi