diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e21f005cca..fab69eb0db 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,6 +14,7 @@ jobs: solidus_admin: uses: ./.github/workflows/test_solidus.yml with: + artifacts: true lib_name: admin coverage: true secrets: diff --git a/.github/workflows/test_solidus.yml b/.github/workflows/test_solidus.yml index c0d0f2254f..9e5dca2124 100644 --- a/.github/workflows/test_solidus.yml +++ b/.github/workflows/test_solidus.yml @@ -3,6 +3,10 @@ name: "Test Solidus" on: workflow_call: inputs: + artifacts: + description: "Whether to save test artifacts during the workflow run." + type: boolean + default: false lib_name: description: "The name of the Solidus library to test (e.g., core, backend, frontend)" type: string @@ -41,6 +45,7 @@ jobs: database: postgres storage: activestorage env: + ARTIFACTS_DIR: ${{ github.workspace }}/${{ inputs.lib_name }}/artifacts BUNDLE_WITHOUT: "lint release" COVERAGE_DIR: ${{ github.workspace }}/${{ inputs.lib_name }}/coverage DB: ${{ matrix.database }} @@ -120,3 +125,10 @@ jobs: slug: solidusio/solidus disable_search: true files: ${{ env.COVERAGE_DIR }}/coverage.xml + - name: Store test artifacts + uses: actions/upload-artifact@v7 + if: failure() && inputs.artifacts + with: + name: test-artifacts-${{ inputs.lib_name }}-${{ matrix.database }}-${{ matrix.storage }} + path: ${{ env.ARTIFACTS_DIR }} + if-no-files-found: ignore diff --git a/admin/spec/spec_helper.rb b/admin/spec/spec_helper.rb index 0bd65d5102..2ae8ef6a57 100644 --- a/admin/spec/spec_helper.rb +++ b/admin/spec/spec_helper.rb @@ -48,7 +48,7 @@ require "capybara-screenshot/rspec" require "spree/testing_support/capybara_driver" -Capybara.save_path = ENV["CIRCLE_ARTIFACTS"] if ENV["CIRCLE_ARTIFACTS"] +Capybara.save_path = ENV["ARTIFACTS_DIR"] if ENV["ARTIFACTS_DIR"] Capybara.exact = true Capybara.disable_animation = true Capybara.default_max_wait_time = ENV["DEFAULT_MAX_WAIT_TIME"].to_f if ENV["DEFAULT_MAX_WAIT_TIME"].present? diff --git a/backend/spec/spec_helper.rb b/backend/spec/spec_helper.rb index 7bc8f77c46..a1bcbf22d6 100644 --- a/backend/spec/spec_helper.rb +++ b/backend/spec/spec_helper.rb @@ -51,7 +51,7 @@ require "spree/testing_support/silence_deprecations" require "capybara-screenshot/rspec" -Capybara.save_path = ENV["CIRCLE_ARTIFACTS"] if ENV["CIRCLE_ARTIFACTS"] +Capybara.save_path = ENV["ARTIFACTS_DIR"] if ENV["ARTIFACTS_DIR"] Capybara.exact = true require "spree/testing_support/capybara_driver"