diff --git a/.github/workflows/rspec-shared.yml b/.github/workflows/rspec-shared.yml index b9be9b80..722e9956 100644 --- a/.github/workflows/rspec-shared.yml +++ b/.github/workflows/rspec-shared.yml @@ -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: + 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, @@ -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 @@ -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 diff --git a/.github/workflows/rspec-specific.yml b/.github/workflows/rspec-specific.yml new file mode 100644 index 00000000..18c05a98 --- /dev/null +++ b/.github/workflows/rspec-specific.yml @@ -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 diff --git a/.github/workflows/rspec.yml b/.github/workflows/rspec.yml index fb87916d..0b8dfcd0 100644 --- a/.github/workflows/rspec.yml +++ b/.github/workflows/rspec.yml @@ -12,9 +12,9 @@ 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: @@ -22,7 +22,7 @@ jobs: 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