-
Notifications
You must be signed in to change notification settings - Fork 3
59 lines (57 loc) · 1.88 KB
/
rspec-shared.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
name: RSpec Shared
on:
workflow_call:
inputs:
os_version:
required: true
type: string
ruby_version:
required: true
type: string
test_tag:
required: false
type: string
spec_paths:
required: false
type: string
jobs:
rspec:
runs-on: ${{ inputs.os_version }}
env:
RAILS_ENV: test
# We have to add "_CI" to the end, otherwise it messes with tests where we switch profiles,
# as Control Plane will try to use this token's profile instead.
CPLN_TOKEN_CI: ${{ secrets.CPLN_TOKEN }}
CPLN_ORG: ${{ vars.CPLN_ORG }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true
- name: Install dependencies
run: bundle install
- name: Install Control Plane tools
run: |
sudo npm install -g @controlplane/cli
cpln --version
- name: Setup Control Plane tools
run: |
cpln profile create default --token $CPLN_TOKEN_CI --org $CPLN_ORG
cpln image docker-login
- name: Run tests
run: bundle exec rspec --format documentation ${{ inputs.test_tag && format('--tag {0}', inputs.test_tag) }} ${{ inputs.spec_paths }}
- name: Upload spec log
uses: actions/upload-artifact@master
if: always()
with:
name: spec-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}.log
path: spec.log
- name: Upload coverage results
uses: actions/upload-artifact@master
if: always()
with:
name: coverage-report-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}
path: coverage