-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (79 loc) · 2.35 KB
/
test.yml
File metadata and controls
95 lines (79 loc) · 2.35 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
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: file
bundler-cache: true
- name: Install dependencies
run: |
# Make sure bundler is using the correct Ruby version
ruby -v
bundle install
npm install prettier
- name: Rubocop
run: bin/rubocop
- name: Sorbet Typecheck
run: bin/typecheck
- name: Spellcheck
run: bin/spellcheck
- name: Prettier (Format Check)
run: npx prettier --check "**/*.{js,json,md}"
test:
name: "Tests: Ruby ${{ matrix.ruby }} / Rails ${{ matrix.rails }}"
needs: [lint]
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby: ["2.7", "3.0", "3.2", "3.4"]
rails: ["7.0", "7.1", "8.0"]
exclude:
# Rails 8.0 requires Ruby 3.1+
- ruby: "2.7"
rails: "8.0"
- ruby: "3.0"
rails: "8.0"
env:
RAILS_VERSION: ${{ matrix.rails }}
RUBY_VERSION: ${{ matrix.ruby }}
steps:
- uses: actions/checkout@v3
- name: Setup Ruby ${{ matrix.ruby }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
# For bundler to work with different Ruby versions, we just need to set CI=true
# This will make our conditional Gemfile logic skip the Ruby version requirement
- name: Set CI environment variable
run: echo "CI=true" >> $GITHUB_ENV
- name: Install dependencies
run: |
# Make sure bundler is using the correct Ruby version
ruby -v
# Configure bundler
bundle config set --local without 'development'
# Install dependencies with the specific Rails version
bundle install
- name: Run tests
run: bin/test
# Optional: Save coverage data as an artifact
- name: Upload coverage reports
uses: actions/upload-artifact@v3
if: success()
with:
name: coverage-ruby${{ matrix.ruby }}-rails${{ matrix.rails }}
path: coverage/
retention-days: 5