From 3df9da952de2b60620f791c6c31144594f2c90d8 Mon Sep 17 00:00:00 2001 From: Zakir Dzhamaliddinov Date: Sat, 20 Jul 2024 13:20:21 +0300 Subject: [PATCH 1/2] Add rspec-specific GitHub workflow --- .github/workflows/rspec-shared.yml | 7 +++++-- .github/workflows/rspec-specific.yml | 18 ++++++++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/rspec-specific.yml diff --git a/.github/workflows/rspec-shared.yml b/.github/workflows/rspec-shared.yml index b9be9b80..c786c2cf 100644 --- a/.github/workflows/rspec-shared.yml +++ b/.github/workflows/rspec-shared.yml @@ -10,7 +10,10 @@ on: required: true type: string test-tag: - required: true + required: false + type: string + spec_paths: + required: false type: string jobs: @@ -41,7 +44,7 @@ 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() diff --git a/.github/workflows/rspec-specific.yml b/.github/workflows/rspec-specific.yml new file mode 100644 index 00000000..0036f397 --- /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-tests: + 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 From 6ad601f450e5906339f158a5bf3c6b5c3ff611e5 Mon Sep 17 00:00:00 2001 From: Zakir Dzhamaliddinov Date: Tue, 23 Jul 2024 08:31:36 +0300 Subject: [PATCH 2/2] Review fixes 1. Replace `-` with `_` for inputs 2. Rename rspec-specific-tests to rspec-specific --- .github/workflows/rspec-shared.yml | 16 ++++++++-------- .github/workflows/rspec-specific.yml | 6 +++--- .github/workflows/rspec.yml | 12 ++++++------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/rspec-shared.yml b/.github/workflows/rspec-shared.yml index c786c2cf..722e9956 100644 --- a/.github/workflows/rspec-shared.yml +++ b/.github/workflows/rspec-shared.yml @@ -3,13 +3,13 @@ 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: + test_tag: required: false type: string spec_paths: @@ -18,7 +18,7 @@ on: 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, @@ -31,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 @@ -44,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 ${{ inputs.test-tag && format('--tag {0}', inputs.test-tag) }} ${{ inputs.spec_paths }} + 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 index 0036f397..18c05a98 100644 --- a/.github/workflows/rspec-specific.yml +++ b/.github/workflows/rspec-specific.yml @@ -8,11 +8,11 @@ on: required: true jobs: - rspec-specific-tests: + rspec-specific: name: RSpec (Specific) uses: ./.github/workflows/rspec-shared.yml with: - os-version: ubuntu-latest - ruby-version: "3.2" + 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