60 lines (56 loc) · 1.55 KB
/
test-gem.yml
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
---
name: Test
on:
workflow_call:
inputs:
working-directory:
description: The working directory where all jobs should be executed
default: '.'
required: false
type: string
command:
description: The command used to test
default: bundle exec rake spec
required: false
type: string
jobs:
setup_matrix:
name: "Determine Ruby versions"
runs-on: ubuntu-latest
outputs:
ruby: ${{ steps.ruby.outputs.versions }}
steps:
- id: ruby
uses: ekohl/ruby-version@v0
test:
name: "Ruby ${{ matrix.ruby }}"
runs-on: ubuntu-latest
needs: setup_matrix
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJSON(needs.setup_matrix.outputs.ruby) }}
steps:
- uses: actions/checkout@v4
- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
working-directory: ${{ inputs.working-directory }}
- name: Verify gemspec
run: |
if compgen -G "*.gemspec" > /dev/null ; then
gem build --verbose --strict *.gemspec
fi
working-directory: ${{ inputs.working-directory }}
- name: Run tests
run: ${{ inputs.command }}
working-directory: ${{ inputs.working-directory }}
# A dummy job that you can mark as a required check instead of each individual test
test-suite:
needs: test
runs-on: ubuntu-latest
name: Test suite
steps:
- run: echo Test suite completed