Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,37 @@ jobs:
- name: Run tests
run: bundle exec rake test

macos-tests:
name: macOS Tests (macos-latest, ${{ matrix.ruby }})
runs-on: macos-latest
env:
HTTPBIN_URL: https://httpbin.io
strategy:
fail-fast: false
matrix:
ruby: ['3.3', '3.4', '4.0']

steps:
- uses: actions/checkout@v7

- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true

- name: Install dependencies
run: bundle install

- name: Compile native extension
run: bundle exec rake compile

- name: Run tests
run: bundle exec rake test

windows-gnu-tests:
name: Windows Tests (windows-latest, ${{ matrix.ruby }})
runs-on: windows-latest
Expand Down
118 changes: 112 additions & 6 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
workflow_dispatch:
push:
tags: ["v*"]
pull_request:
paths-ignore:
- "docs/**"
- "benchmark/**"
- "examples/**"
- "*.md"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down Expand Up @@ -31,7 +37,7 @@ jobs:
path: pkg/*.gem
if-no-files-found: error

cross-compile:
native-linux:
name: Build native gem (${{ matrix.platform }})
runs-on: ubuntu-latest
strategy:
Expand All @@ -52,7 +58,7 @@ jobs:

- uses: actions/upload-artifact@v7
with:
name: cross-gem-${{ matrix.platform }}
name: native-gem-${{ matrix.platform }}
path: pkg/*.gem
if-no-files-found: error

Expand Down Expand Up @@ -125,9 +131,70 @@ jobs:
path: pkg/*arm64-darwin*.gem
if-no-files-found: error

native-windows:
name: Build native gem (x64-mingw-ucrt)
runs-on: windows-latest
steps:
- uses: actions/checkout@v7

- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-pc-windows-gnu

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.3"
bundler-cache: true

- name: Compile for Ruby 3.3
shell: pwsh
env:
RB_SYS_CARGO_PROFILE: release
run: |
./script/build_windows_gnu.ps1 -SkipBundleInstall
New-Item -ItemType Directory -Force "lib\wreq_ruby\3.3" | Out-Null
Copy-Item "lib\wreq_ruby\wreq_ruby.so" "lib\wreq_ruby\3.3\wreq_ruby.so" -Force

- uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true

- name: Compile for Ruby 3.4
shell: pwsh
env:
RB_SYS_CARGO_PROFILE: release
run: |
./script/build_windows_gnu.ps1 -SkipBundleInstall
New-Item -ItemType Directory -Force "lib\wreq_ruby\3.4" | Out-Null
Copy-Item "lib\wreq_ruby\wreq_ruby.so" "lib\wreq_ruby\3.4\wreq_ruby.so" -Force

- uses: ruby/setup-ruby@v1
with:
ruby-version: "4.0"
bundler-cache: true

- name: Compile for Ruby 4.0
shell: pwsh
env:
RB_SYS_CARGO_PROFILE: release
run: |
./script/build_windows_gnu.ps1 -SkipBundleInstall
New-Item -ItemType Directory -Force "lib\wreq_ruby\4.0" | Out-Null
Copy-Item "lib\wreq_ruby\wreq_ruby.so" "lib\wreq_ruby\4.0\wreq_ruby.so" -Force

- name: Build platform gem
run: ruby script/build_platform_gem.rb x64-mingw-ucrt

- uses: actions/upload-artifact@v7
with:
name: native-gem-x64-mingw-ucrt
path: pkg/*x64-mingw-ucrt*.gem
if-no-files-found: error

smoke-test:
name: Smoke test Linux (Ruby ${{ matrix.ruby }})
needs: [cross-compile]
needs: [native-linux]
runs-on: ubuntu-latest
strategy:
fail-fast: false
Expand All @@ -140,7 +207,7 @@ jobs:

- uses: actions/download-artifact@v8
with:
name: cross-gem-x86_64-linux
name: native-gem-x86_64-linux
path: pkg/

- name: Install native gem
Expand Down Expand Up @@ -173,9 +240,48 @@ jobs:
- name: Verify gem loads and prints version
run: ruby -rwreq -e "puts Wreq::VERSION"

smoke-test-windows:
name: Smoke test Windows (${{ matrix.platform }}, Ruby ${{ matrix.ruby }})
needs: [native-windows]
runs-on: windows-latest
strategy:
fail-fast: false
matrix:
include:
- platform: x64-mingw-ucrt
ruby: "3.3"
- platform: x64-mingw-ucrt
ruby: "3.4"
- platform: x64-mingw-ucrt
ruby: "4.0"
steps:
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}

- uses: actions/download-artifact@v8
with:
name: native-gem-${{ matrix.platform }}
path: pkg/

- name: Install native gem
run: gem install pkg/wreq-*-${{ matrix.platform }}.gem

- name: Verify gem loads and prints version
run: ruby -rwreq -e "puts Wreq::VERSION"

release:
name: Release
needs: [source-gem, cross-compile, native-darwin, smoke-test, smoke-test-darwin]
needs:
[
source-gem,
native-linux,
native-darwin,
native-windows,
smoke-test,
smoke-test-darwin,
smoke-test-windows,
]
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
permissions:
Expand All @@ -194,7 +300,7 @@ jobs:
- uses: actions/download-artifact@v8
with:
path: pkg/
pattern: "{cross-gem-*,native-gem-*,source-gem}"
pattern: "{native-gem-*,source-gem}"
merge-multiple: true

- name: List gems
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ gem "wreq"
```

Pre-compiled native gems are available for:

- Linux (x86_64, aarch64)
- macOS (arm64)
- Windows (x86_64)
Expand Down
Loading