diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 752cac7..708978e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,34 @@ on: - "v*" jobs: + verify: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + ruby: ["3.2", "3.3", "3.4", "4.0"] + steps: + - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 + + - name: Set up Ruby ${{ matrix.ruby }} + uses: ruby/setup-ruby@003a5c4d8d6321bd302e38f6f0ec593f77f06600 # v1.319.0 + with: + ruby-version: ${{ matrix.ruby }} + bundler-cache: true + + - name: Run tests + run: bundle exec rake test + + - name: Build gem + run: gem build opencode-ruby.gemspec + + - name: Verify gem loads after install + run: | + gem install opencode-ruby-*.gem --no-document + ruby -ropencode-ruby -e 'puts Opencode::VERSION' + push: + needs: verify if: ${{ github.server_url == 'https://github.com' }} runs-on: ubuntu-latest permissions: diff --git a/README.md b/README.md index 99bfc01..92a03ea 100644 --- a/README.md +++ b/README.md @@ -202,7 +202,8 @@ Want every OpenCode endpoint auto-generated from the OpenAPI spec? Use [`opencod ## Compatibility - Ruby ≥ 3.2 -- Runtime dependency: `activesupport (>= 6.1)` — *not* Rails. ActiveSupport is a standalone helpers gem (`blank?`, `present?`, `presence`, `truncate`, etc.). +- Runtime dependency: `activesupport (>= 6.1, < 9.0)` — *not* Rails. ActiveSupport is a standalone helpers gem (`blank?`, `present?`, `presence`, `truncate`, etc.). +- Runtime dependency: `marcel (~> 1.0)` for artifact MIME type detection. OpenCode server compatibility is evidence-based, not an open-ended SemVer promise. OpenCode's HTTP, SSE, and runtime behavior can change independently diff --git a/test/readme_contract_test.rb b/test/readme_contract_test.rb index f112525..59474ac 100644 --- a/test/readme_contract_test.rb +++ b/test/readme_contract_test.rb @@ -16,4 +16,9 @@ class ReadmeContractTest < Minitest::Test assert_includes README, "not configured as of `0.0.1.alpha7`" assert_includes README, "does not currently guarantee publication" end + + def test_compatibility_documents_every_runtime_dependency + assert_includes README, "`activesupport (>= 6.1, < 9.0)`" + assert_includes README, "`marcel (~> 1.0)`" + end end diff --git a/test/release_workflow_test.rb b/test/release_workflow_test.rb index 723c13b..b34fb90 100644 --- a/test/release_workflow_test.rb +++ b/test/release_workflow_test.rb @@ -17,6 +17,10 @@ class ReleaseWorkflowTest < Minitest::Test workflow.fetch("jobs").fetch("push") end + def verify_job + workflow.fetch("jobs").fetch("verify") + end + def test_release_job_is_inert_on_non_github_runners assert_equal "${{ github.server_url == 'https://github.com' }}", push_job.fetch("if") end @@ -61,4 +65,15 @@ class ReleaseWorkflowTest < Minitest::Test assert_operator test_index, :<, publish_index assert_equal "bundle exec rake test", steps.fetch(test_index).fetch("run") end + + def test_release_verifies_the_supported_matrix_and_installed_gem_before_publish + assert_equal %w[3.2 3.3 3.4 4.0], verify_job.dig("strategy", "matrix", "ruby") + assert_equal "verify", push_job.fetch("needs") + + commands = verify_job.fetch("steps").filter_map { |step| step["run"] }.join("\n") + assert_includes commands, "bundle exec rake test" + assert_includes commands, "gem build opencode-ruby.gemspec" + assert_includes commands, "gem install opencode-ruby-*.gem --no-document" + assert_includes commands, "ruby -ropencode-ruby" + end end diff --git a/test/workflow_contract_test.rb b/test/workflow_contract_test.rb index 428d3ce..11a6cea 100644 --- a/test/workflow_contract_test.rb +++ b/test/workflow_contract_test.rb @@ -27,7 +27,7 @@ class WorkflowContractTest < Minitest::Test workflow_uses(workflow) end - assert_equal 5, action_uses.length + assert_equal 7, action_uses.length action_uses.each do |action_use| action, separator, revision = action_use.rpartition("@")