Skip to content

Merge pull request #36 from fontist/rt-update-zlib-132 #47

Merge pull request #36 from fontist/rt-update-zlib-132

Merge pull request #36 from fontist/rt-update-zlib-132 #47

Workflow file for this run

name: test
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
concurrency:
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}'
cancel-in-progress: true
env:
BUNDLER_VER: latest
permissions:
contents: read
packages: write
jobs:
build:
name: Build gems
uses: ./.github/workflows/gem-build.yml
prepare:
name: Prepare test matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- id: set-matrix
run: |
# Read platforms.json and generate test matrix
# For each platform where test=true, create entries for each test_os and ruby version
# Use test_ruby_versions if specified, otherwise use default versions
MATRIX=$(jq -c '{
include: [
.platforms
| to_entries[]
| .value[]
| select(.test == true)
| .test_os as $test_os
| .platform as $platform
| (.test_ruby_versions // ["3.1", "3.2", "3.3", "3.4", "4.0"]) as $ruby_versions
| $test_os[]
| . as $os
| $ruby_versions[]
| {os: $os, platform: $platform, ruby: .}
]
}' .github/platforms.json)
echo "matrix=$MATRIX" >> $GITHUB_OUTPUT
test:
needs: [build, prepare]
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }}
steps:
- uses: actions/checkout@v6
with:
# We need spec/examples for test archives and .github/scripts for test script
sparse-checkout: |
spec/examples
.github/scripts
- uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler: ${{ env.BUNDLER_VER }}
# Download the pre-built gem artifact (not just the binary)
- uses: actions/download-artifact@v7
with:
name: ${{ github.run_number }}-${{ matrix.platform }}-pkg
path: pkg
# Unpack gem and display compiled libraries for debugging
- name: Inspect gem contents
shell: bash
run: |
cd pkg
gem unpack ffi-libarchive-binary-*.gem
echo "=== Platform: ${{ matrix.platform }} ==="
echo "=== Compiled libraries in gem ==="
ls */lib/ffi-libarchive-binary/*.dll */lib/ffi-libarchive-binary/*.so */lib/ffi-libarchive-binary/*.dylib 2>/dev/null || echo "No compiled libraries found in gem"
echo "=== Full lib directory contents ==="
ls -la */lib/ffi-libarchive-binary/ 2>/dev/null || echo "Directory not found"
# Install the native gem
- name: Install native gem
run: |
cd pkg
gem install ffi-libarchive-binary-*.gem
# Run tests against the installed gem - actually extract archives!
- name: Test installed gem
run: ruby .github/scripts/test_installed_gem.rb