Sha256: 0d6638880e29a5efdf71821622753f033dcd4d3589a7653caab79d3095b84322

Contents?: true

Size: 1.88 KB

Versions: 2

Compression:

Stored size: 1.88 KB

Contents

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

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
cpflow-4.0.1 .github/workflows/rspec-shared.yml
cpflow-4.0.0 .github/workflows/rspec-shared.yml