Skip to content

Commit 66e532b

Browse files
authored
Add rspec-specific GitHub workflow (#215)
* Add rspec-specific GitHub workflow
1 parent c9f6adf commit 66e532b

File tree

3 files changed

+36
-15
lines changed

3 files changed

+36
-15
lines changed

.github/workflows/rspec-shared.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,22 @@ name: RSpec Shared
33
on:
44
workflow_call:
55
inputs:
6-
os-version:
6+
os_version:
77
required: true
88
type: string
9-
ruby-version:
9+
ruby_version:
1010
required: true
1111
type: string
12-
test-tag:
13-
required: true
12+
test_tag:
13+
required: false
14+
type: string
15+
spec_paths:
16+
required: false
1417
type: string
1518

1619
jobs:
1720
rspec:
18-
runs-on: ${{ inputs.os-version }}
21+
runs-on: ${{ inputs.os_version }}
1922
env:
2023
RAILS_ENV: test
2124
# We have to add "_CI" to the end, otherwise it messes with tests where we switch profiles,
@@ -28,7 +31,7 @@ jobs:
2831
- name: Set up Ruby
2932
uses: ruby/setup-ruby@v1
3033
with:
31-
ruby-version: ${{ inputs.ruby-version }}
34+
ruby-version: ${{ inputs.ruby_version }}
3235
bundler-cache: true
3336
- name: Install dependencies
3437
run: bundle install
@@ -41,16 +44,16 @@ jobs:
4144
cpln profile create default --token $CPLN_TOKEN_CI --org $CPLN_ORG
4245
cpln image docker-login
4346
- name: Run tests
44-
run: bundle exec rspec --format documentation --tag ${{ inputs.test-tag }}
47+
run: bundle exec rspec --format documentation ${{ inputs.test_tag && format('--tag {0}', inputs.test_tag) }} ${{ inputs.spec_paths }}
4548
- name: Upload spec log
4649
uses: actions/upload-artifact@master
4750
if: always()
4851
with:
49-
name: spec-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}.log
52+
name: spec-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}.log
5053
path: spec.log
5154
- name: Upload coverage results
5255
uses: actions/upload-artifact@master
5356
if: always()
5457
with:
55-
name: coverage-report-${{ inputs.test-tag }}-${{ github.run_id }}-${{ inputs.os-version }}-${{ inputs.ruby-version }}
58+
name: coverage-report-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}
5659
path: coverage
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: RSpec Specific
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
spec_paths:
7+
description: "Test files or directories that should be run"
8+
required: true
9+
10+
jobs:
11+
rspec-specific:
12+
name: RSpec (Specific)
13+
uses: ./.github/workflows/rspec-shared.yml
14+
with:
15+
os_version: ubuntu-latest
16+
ruby_version: "3.2"
17+
spec_paths: ${{ inputs.spec_paths }}
18+
secrets: inherit

.github/workflows/rspec.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,17 @@ jobs:
1212
name: RSpec (Fast)
1313
uses: ./.github/workflows/rspec-shared.yml
1414
with:
15-
os-version: ubuntu-latest
16-
ruby-version: "3.2"
17-
test-tag: ~slow
15+
os_version: ubuntu-latest
16+
ruby_version: "3.2"
17+
test_tag: ~slow
1818
secrets: inherit
1919

2020
rspec-slow:
2121
name: RSpec (Slow)
2222
uses: ./.github/workflows/rspec-shared.yml
2323
if: github.event_name == 'workflow_dispatch'
2424
with:
25-
os-version: ubuntu-latest
26-
ruby-version: "3.2"
27-
test-tag: slow
25+
os_version: ubuntu-latest
26+
ruby_version: "3.2"
27+
test_tag: slow
2828
secrets: inherit

0 commit comments

Comments
 (0)