Skip to content

Install gperf for mingw as well #1631

Install gperf for mingw as well

Install gperf for mingw as well #1631

Workflow file for this run

name: build
on:
push:
pull_request:
schedule:
- cron: '10 3 * * *'
jobs:
ruby-versions:
uses: ruby/actions/.github/workflows/ruby_versions.yml@master
with:
engine: cruby-truffleruby
min_version: 2.6
build:
if: ${{ startsWith(github.repository, 'ruby/') || github.event_name != 'schedule' }}
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 ]
exclude:
- ruby: head
os: windows-latest
- ruby: truffleruby # need truffleruby 24.2+
os: ubuntu-latest
- ruby: truffleruby # need truffleruby 24.2+
os: macos-latest
- ruby: truffleruby
os: windows-latest
- ruby: truffleruby-head
os: windows-latest
include:
- ruby: mingw
os: windows-latest
- ruby: mswin
os: windows-2022
runs-on: ${{ matrix.os }}
steps:
- 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
- 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: msys2 {0} # Use MSYS2 shell for objdump and consistent PATH
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_DIR_PLATFORM="x64-mingw-ucrt"
SO_PATH="${GITHUB_WORKSPACE}/lib/${RUBY_VERSION_OUTPUT}/${SO_DIR_PLATFORM}/date_core.so"
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