Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rspec-specific GitHub workflow #215

Merged
merged 2 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions .github/workflows/rspec-shared.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,22 @@ name: RSpec Shared
on:
workflow_call:
inputs:
os-version:
os_version:
required: true
type: string
ruby-version:
ruby_version:
required: true
type: string
test-tag:
required: true
test_tag:
required: false
type: string
spec_paths:
zzaakiirr marked this conversation as resolved.
Show resolved Hide resolved
required: false
type: string

jobs:
rspec:
runs-on: ${{ inputs.os-version }}
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,
Expand All @@ -28,7 +31,7 @@ jobs:
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ inputs.ruby-version }}
ruby-version: ${{ inputs.ruby_version }}
bundler-cache: true
- name: Install dependencies
run: bundle install
Expand All @@ -41,16 +44,16 @@ jobs:
cpln profile create default --token $CPLN_TOKEN_CI --org $CPLN_ORG
cpln image docker-login
- name: Run tests
run: bundle exec rspec --format documentation --tag ${{ inputs.test-tag }}
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
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 }}
name: coverage-report-${{ inputs.test_tag }}-${{ github.run_id }}-${{ inputs.os_version }}-${{ inputs.ruby_version }}
path: coverage
18 changes: 18 additions & 0 deletions .github/workflows/rspec-specific.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: RSpec Specific

on:
workflow_dispatch:
inputs:
spec_paths:
description: "Test files or directories that should be run"
required: true

jobs:
rspec-specific:
name: RSpec (Specific)
uses: ./.github/workflows/rspec-shared.yml
with:
os_version: ubuntu-latest
ruby_version: "3.2"
spec_paths: ${{ inputs.spec_paths }}
secrets: inherit
12 changes: 6 additions & 6 deletions .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,17 @@ jobs:
name: RSpec (Fast)
uses: ./.github/workflows/rspec-shared.yml
with:
os-version: ubuntu-latest
ruby-version: "3.2"
test-tag: ~slow
os_version: ubuntu-latest
ruby_version: "3.2"
test_tag: ~slow
secrets: inherit

rspec-slow:
name: RSpec (Slow)
uses: ./.github/workflows/rspec-shared.yml
if: github.event_name == 'workflow_dispatch'
with:
os-version: ubuntu-latest
ruby-version: "3.2"
test-tag: slow
os_version: ubuntu-latest
ruby_version: "3.2"
test_tag: slow
secrets: inherit
Loading