-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (65 loc) · 1.8 KB
/
ruby-test-matrix.yml
File metadata and controls
69 lines (65 loc) · 1.8 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
name: Ruby Test Matrix
on:
workflow_call:
inputs:
ruby-versions:
required: false
default: "[3.1, 3.2, 3.3, 3.4]"
type: string
pre-test-hook:
required: false
default: "echo 'No pre-test hook provided. Skipping.'"
type: string
test-command:
required: false
default: "bundle exec rspec"
type: string
jobs:
gemfile-paths:
runs-on: ubuntu-latest
outputs:
gemfiles: ${{ steps.gemfiles.outputs.gemfiles }}
steps:
- uses: actions/checkout@v4
- id: gemfiles
run: echo "gemfiles=$(find . -type f -iname "*gemfile" | jq -R -s -c 'split("\n")[:-1]')" >> "$GITHUB_OUTPUT"
tests:
name: Unit Tests
runs-on: ubuntu-latest
needs: [gemfile-paths]
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJson(inputs.ruby-versions) }}
gemfile: ${{ fromJson(needs.gemfile-paths.outputs.gemfiles) }}
exclude:
- ruby: "3.1"
gemfile: "./gemfiles/activerecord_8_0.gemfile"
- ruby: "3.1"
gemfile: "./gemfiles/activesupport_8_0.gemfile"
- ruby: "3.1"
gemfile: "./gemfiles/rails_8_0.gemfile"
env:
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: ${{ inputs.pre-test-hook }}
- uses: nick-fields/retry@v3
with:
max_attempts: 2
timeout_minutes: 10
command: ${{ inputs.test-command }}
build_success:
if: always()
needs:
- tests
runs-on: Ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}