Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
43 changes: 43 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Test

on:
push:
pull_request:
workflow_dispatch:
Comment thread
Watson1978 marked this conversation as resolved.
Outdated

permissions:
contents: read

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
ruby-version: ['2.7', '3.0', '3.1', '3.2', '3.3', '3.4', '4.0']
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v6
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Replace libcurl.dll
if: runner.os == 'Windows'
run: |
# The `libcurl.dll` bundled with Ruby on Windows (MSYS2) has missing dependencies and cannot be loaded by `ethon` out of the box. (Ref: https://github.com/typhoeus/typhoeus/issues/720)
choco install curl --no-progress

$curlTools = "C:\ProgramData\chocolatey\lib\curl\tools"
$srcDll = Get-ChildItem -Path $curlTools -Filter "libcurl*.dll" -Recurse | Select-Object -First 1

$rubyBin = Split-Path (Get-Command ruby.exe).Source
$destDll = Join-Path $rubyBin "libcurl.dll"
Copy-Item -Path $srcDll.FullName -Destination $destDll -Force
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that this is a wrong fix.

MSYS2 ships libcurl-4.dll not libcurl.dll:

https://packages.msys2.org/packages/mingw-w64-ucrt-x86_64-curl

/ucrt64/bin/libcurl-4.dll

I confirmed that ruby -r ethon -e; works with the following patch without copying libcurl.dll:

diff --git a/lib/ethon/curls/settings.rb b/lib/ethon/curls/settings.rb
index 8c0161b..e878c1a 100644
--- a/lib/ethon/curls/settings.rb
+++ b/lib/ethon/curls/settings.rb
@@ -7,6 +7,9 @@ module Ethon
     callback :debug_callback, [:pointer, :debug_info_type, :pointer, :size_t, :pointer], :int
     callback :progress_callback, [:pointer, :long_long, :long_long, :long_long, :long_long], :int
     ffi_lib_flags :now, :global
-    ffi_lib ['libcurl', 'libcurl.so.4']
+    # 'libcurl-4' is for MSYS2. MSYS2 uses libcurl-4.dll not libcurl.dll.
+    # See also "Files:" in
+    # https://packages.msys2.org/packages/mingw-w64-ucrt-x86_64-curl .
+    ffi_lib ['libcurl', 'libcurl.so.4', 'libcurl-4']
   end
 end

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An issue has already been filed for a similar case.
typhoeus/ethon#270

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about removing this workaround and jobs on Windows until the issue is resolved?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sent a PR at typhoeus/ethon#271


- name: Run tests
run: bundle exec rake
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.