Skip to content

Commit

Permalink
Add full tests in release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
uvlad7 committed Oct 29, 2023
1 parent ac24f7a commit a54990f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,40 @@ jobs:
result="$(ruby "$GITHUB_WORKSPACE/actions/ruby_versions.rb" "$GITHUB_WORKSPACE/xml2json.gemspec")"
echo "result=$result" >> $GITHUB_OUTPUT
test:
runs-on: ${{ matrix.os }}
name: Test on ${{ matrix.os }} and Ruby ${{ matrix.ruby }}
needs: ci-data
strategy:
fail-fast: false
matrix:
os: [ "ubuntu-latest", "macos-latest", "windows-latest" ]
ruby: ${{ fromJSON(needs.ci-data.outputs.ruby_versions) }}
rust:
- "1.72.1"
include:
- os: windows-latest
ruby: mswin
rust: "1.72.1"

steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Ruby & Rust
uses: oxidize-rb/actions/setup-ruby-and-rust@v1
with:
ruby-version: ${{ matrix.ruby }}
rustup-toolchain: ${{ matrix.rust }}
bundler-cache: true
cargo-cache: true
rubygems: '3.4.14'
- name: Run the default task
run: bundle exec rake

cross-gem:
name: Compile native gem for ${{ matrix.platform }}
runs-on: ubuntu-latest
needs: ci-data
needs: [ci-data, test]
strategy:
fail-fast: false
matrix:
Expand All @@ -67,13 +97,13 @@ jobs:
id: cross-gem
with:
platform: ${{ matrix.platform }}
ruby-versions: ${{ needs.ci-data.outputs.ruby_versions }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.ruby_versions), ',') }}

- name: Test cross-compiled gem
uses: oxidize-rb/actions/test-gem-build@main
with:
platform: ${{ matrix.platform }}
ruby-versions: ${{ needs.ci-data.outputs.ruby_versions }}
ruby-versions: ${{ join(fromJSON(needs.ci-data.outputs.ruby_versions), ',') }}

- name: Upload artifact
uses: actions/upload-artifact@v3
Expand Down
2 changes: 1 addition & 1 deletion actions/ruby_versions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@

puts(JSON.parse(Net::HTTP.get(URI(RUBY_VERSIONS_URL))).map do |ver|
ver["cycle"] if gemspec.required_ruby_version.satisfied_by?(Gem::Version.new(ver["cycle"]))
end.compact.join(","))
end.compact.to_json)

0 comments on commit a54990f

Please sign in to comment.