Skip to content

Install gperf for mingw as well #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft
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
53 changes: 49 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
name: build (${{ matrix.ruby }} / ${{ matrix.os }})
needs: ruby-versions
strategy:
fail-fast: false
matrix:
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
os: [ ubuntu-latest, macos-latest, windows-latest ]
Expand All @@ -42,10 +43,54 @@ jobs:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
if: matrix.os != 'windows-latest'
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true # 'bundle install' and cache
- run: choco install gperf
if: ${{ matrix.ruby == 'mswin' }}
- name: Run test
run: bundle exec rake compile test
- name: Install gperf for MinGW/UCRT builds
uses: ruby/setup-ruby-pkgs@v1
if: matrix.os == 'windows-latest'
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
mingw: gperf _upgrade_
- name: Compile extension
run: bundle exec rake compile
- name: Diagnose DLLs (mingw on windows-latest)
if: matrix.os == 'windows-latest'
shell: bash
run: |
echo "--- Ruby Version --- "
ruby -v
echo "--- Finding date_core.so --- "
# Construct the path based on Rakefile logic: lib/RUBY_VERSION/platform/date_core.so
# RUBY_VERSION e.g., 3.3.8; platform e.g., x64-mingw-ucrt
RUBY_VERSION_OUTPUT=$(ruby -e 'print RUBY_VERSION')
# For mingw builds, ext.platform from Rake::ExtensionTask usually becomes something like x64-mingw-ucrt
# We'll use the platform string directly from the error message if it matches RUBY_VERSION_OUTPUT
SO_PATH=("${GITHUB_WORKSPACE}/lib/${RUBY_VERSION_OUTPUT}"/*/date_core.so)
SO_PATH="${SO_PATH[0]}"

echo "Checking for .so file at: $SO_PATH"
if [ ! -f "$SO_PATH" ]; then
echo "ERROR: date_core.so not found at $SO_PATH"
echo "Listing content of ${{ github.workspace }}/lib/${RUBY_VERSION_OUTPUT}/ to debug:"
ls -R "${{ github.workspace }}/lib/${RUBY_VERSION_OUTPUT}/"
exit 1
fi
echo "Found .so file: $SO_PATH"
echo "--- objdump -p output (DLL dependencies) --- "
objdump -p "$SO_PATH" | grep "DLL Name"
echo "--- PATH variable --- "
echo "$PATH"
# Prepare for artifact upload by copying to a predictable name
cp "$SO_PATH" ./date_core.so.diagnostic
- name: Upload diagnostic .so (mingw on windows-latest)
if: matrix.os == 'windows-latest'
uses: actions/upload-artifact@v4
with:
name: date_core_mingw_ucrt_${{ matrix.ruby }}.so
path: ./date_core.so.diagnostic
if-no-files-found: error
- name: Run test (execute tests)
run: bundle exec rake test