-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (77 loc) · 2.52 KB
/
ruby-ci.yml
File metadata and controls
85 lines (77 loc) · 2.52 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
name: "Ruby CI"
on:
pull_request:
branches: [main]
paths:
- "**.rb"
- "**Gemfile"
- "**Rakefile"
- ".github/workflows/ruby-ci.yml"
- "infra/**"
- ".mise.toml"
merge_group:
types: [checks_requested]
push:
branches: [main]
jobs:
setup:
name: "Setup"
runs-on: ubuntu-24.04-arm
outputs:
ruby-version: ${{ steps.set-ruby-version.outputs.ruby-version }}
spec-matrix: ${{ steps.build-matrix.outputs.spec-matrix }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Initialise mise and cache `hcl2json`
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
install_args: hcl2json
- name: Set Ruby version
id: set-ruby-version
run: |
echo "ruby-version=$(mise current ruby)" >> "$GITHUB_OUTPUT"
- name: Build spec matrix
id: build-matrix
run: |
spec_dirs_json="$(find . -type d -name 'spec' -not -path '*vendor*' | sed 's|/spec$||g' | jq -Rnc '[inputs]')"
echo "spec-matrix=$spec_dirs_json" >> "$GITHUB_OUTPUT"
ruby-lint:
name: "Ruby Lint"
runs-on: ubuntu-24.04-arm
needs: setup
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Install Ruby and gems at root
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
with:
bundler-cache: true
ruby-version: ${{needs.setup.outputs.ruby-version}}
- name: Run rubocop
run: make lint_ruby
ruby-spec:
name: "Rspec"
runs-on: ubuntu-24.04-arm
needs: setup
strategy:
fail-fast: false
matrix:
spec_target: ${{ fromJSON(needs.setup.outputs.spec-matrix) }}
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Set up hcl2json
uses: jdx/mise-action@1648a7812b9aeae629881980618f079932869151 # v4.0.1
with:
install_args: hcl2json
- name: "Install Ruby and gems in ${{matrix.spec_target}}"
uses: ruby/setup-ruby@4c56a21280b36d862b5fc31348f463d60bdc55d5 # v1.301.0
with:
bundler-cache: true
ruby-version: ${{needs.setup.outputs.ruby-version}}
working-directory: "${{matrix.spec_target}}"
- name: Run specs
run: |
cd "${{matrix.spec_target}}"
bundle exec rspec