-
Notifications
You must be signed in to change notification settings - Fork 3
202 lines (166 loc) · 5.24 KB
/
test.yml
File metadata and controls
202 lines (166 loc) · 5.24 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '.ruby-version'
# Install all gems (both test and development)
bundler-cache: true
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: |
package-lock.json
site/package-lock.json
- name: Install dependencies
run: |
# Install root and site npm dependencies
npm ci
cd site && npm ci && cd ..
# Make sure bundler is using the correct Ruby version
ruby -v
- name: Generate CSpell dictionaries from package lockfiles
run: |
bin/generate_lockfile_words
- name: CSpell (Spellcheck)
run: bin/spellcheck
- name: Prettier (Formatting)
run: bin/prettier --check
- name: Tapioca (Verify RBI files)
run: |
# Add a few excluded gems to tapioca config (different RBI on Mac vs. Linux)
ruby -r yaml -e '
CONFIG_FILE = "sorbet/tapioca/config.yml"
config = YAML.load_file(CONFIG_FILE)
config["gem"]["exclude"] += ["rack", "amazing_print"]
config["gem"]["exclude"].sort!.uniq!
File.write(CONFIG_FILE, config.to_yaml)
'
bundle exec tapioca gems --verify
bundle exec tapioca dsl --verify
git checkout sorbet/tapioca/config.yml || true
- name: Check for RBI changes
run: |
# Check if there are any uncommitted changes to RBI files
git status --porcelain sorbet/rbi/
if [[ -n $(git status --porcelain sorbet/rbi/) ]]; then
echo "Error: RBI files are out of date. Please run 'tapioca gems' and 'tapioca dsl' and commit the changes."
git diff sorbet/rbi/
exit 1
fi
- name: RuboCop (Linting/Formatting)
run: bin/rubocop
- name: Sorbet (Typecheck)
run: bin/typecheck
site:
name: 'Next.js Site Tests'
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '.ruby-version'
bundler-cache: true
- name: Setup Node.js (site)
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
cache-dependency-path: 'site/package-lock.json'
- name: Install site dependencies
run: cd site && npm ci
- name: Export TypeScript types from LogStruct
run: |
scripts/export_typescript_types.rb
- name: TypeScript type checking
run: |
cd site && npx tsc --noEmit
- name: Run TypeScript tests
run: |
cd site && npm test
pilot:
name: 'Pilot Test: Ruby 3.4 / Rails 8.0'
runs-on: ubuntu-22.04
env:
RAILS_VERSION: '8.0.1'
RUBY_VERSION: '3.4'
CI: 'true'
BUNDLE_WITHOUT: 'development'
steps:
- uses: actions/checkout@v4
# Remove Gemfile.lock since we're changing Ruby and Rails versions
- name: Remove Gemfile.lock for variable Ruby/Rails versions
run: rm -f Gemfile.lock
- name: Setup Ruby 3.4
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.4'
bundler-cache: true
# Coverage: /coverage
- name: Run tests
run: bin/test
# Coverage: /coverage_rails
- name: Run Rails integration tests
run: bin/rails_tests
# Merges /coverage and /coverage_rails into /site/public/coverage/
- name: Merge coverage reports
run: bin/merge_coverage
# Save merged coverage data as an artifact for deploy workflow
- name: Upload coverage reports
uses: actions/upload-artifact@v4
if: success()
with:
name: coverage-ruby3.4-rails8.0
path: |
site/public/coverage/
retention-days: 5
matrix:
name: 'Tests: ${{ matrix.name }}'
needs: [lint, pilot]
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- name: 'Ruby 3.2 / Rails 7.0'
ruby: '3.2'
rails: '7.0.8.7'
- name: 'Ruby 3.3 / Rails 7.1'
ruby: '3.3'
rails: '7.1.5.1'
- name: 'Ruby 3.4 / Rails 7.2'
ruby: '3.4'
rails: '7.2.2.1'
env:
RAILS_VERSION: ${{ matrix.rails }}
RUBY_VERSION: ${{ matrix.ruby }}
CI: 'true'
BUNDLE_WITHOUT: 'development'
steps:
- uses: actions/checkout@v4
# Remove Gemfile.lock since we're changing Ruby and Rails versions
- name: Remove Gemfile.lock for variable Ruby/Rails versions
run: rm -f Gemfile.lock
- name: Setup Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Run Ruby tests
run: bin/test
- name: Run Rails integration tests
run: bin/rails_tests