From be4651604c360b43bd802a8dadaa4bd2429a1e31 Mon Sep 17 00:00:00 2001 From: Antonis Berkakis Date: Thu, 4 Jun 2026 18:12:37 +0100 Subject: [PATCH] Fix release workflow for rb-sys mkmf build MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The native-gem cross-compile step used gem-compiler, which unpacks the source gem and runs its extconf.rb in isolation — without rb_sys on the load path. After the move to the rb-sys mkmf build, this fails with `cannot load such file -- rb_sys/mkmf`. Drop the precompiled-native-gem matrix and publish the source gem only. The native extension is compiled at install time, so no functionality is lost. --- .github/workflows/release.yml | 105 +++------------------------------- 1 file changed, 9 insertions(+), 96 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 034c9da..37b0f32 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -5,111 +5,24 @@ on: - "[0-9]*.[0-9]*.[0-9]*" jobs: - build_gem: - name: Build source gem + release: + name: Build source gem + create release runs-on: ubuntu-latest + permissions: + contents: write steps: - uses: actions/checkout@v4 - uses: ruby/setup-ruby-pkgs@v1 with: - ruby-version: 3.4 - - run: sudo apt-get update && sudo apt-get install -y libopencv-dev libvips + ruby-version: "3.4" - run: gem update --system - run: rake gem - - name: Upload source gem - uses: actions/upload-artifact@v4 - with: - name: libfacedetection.gem - path: pkg/*.gem - retention-days: 1 - - compile_native_gems: - name: Compile native gem - needs: build_gem - strategy: - matrix: - include: - - os: ubuntu-24.04 - platform: x86_64-linux - ruby: "3.4" - - os: ubuntu-24.04-arm - platform: aarch64-linux - ruby: "3.4" - - os: macos-latest - platform: arm64-darwin - ruby: "3.4" - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v4 - - - uses: ruby/setup-ruby-pkgs@v1 - with: - ruby-version: ${{ matrix.ruby }} - - - name: Install system dependencies on Linux - if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-latest-arm64' - run: sudo apt-get update && sudo apt-get install -y libopencv-dev libvips - - - name: Install system dependencies on macOS - if: matrix.os == 'macos-latest' - run: brew install opencv vips - - - name: Install gem-compiler - run: gem install gem-compiler - - - name: Download source gem - uses: actions/download-artifact@v4 - with: - name: libfacedetection.gem - path: pkg/ - - - name: Compile gem - run: | - SOURCE_GEM=$(ls pkg/*.gem | grep -v -- '-x86_64-linux\|aarch64-linux\|arm64-darwin') - gem compile $SOURCE_GEM --prune - - - name: Upload compiled gem - uses: actions/upload-artifact@v4 - with: - name: libfacedetection-${{ matrix.platform }}.gem - path: ./*.gem - retention-days: 1 - - release: - name: Create GitHub Release - needs: compile_native_gems - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Extract version - id: extract_version - run: | - VERSION=${GITHUB_REF#refs/tags/} - echo "GEM_VERSION=$VERSION" >> $GITHUB_ENV - - - name: Download all artifacts - uses: actions/download-artifact@v4 - with: - path: artifacts - - - name: Rename gem files with version - run: | - mkdir -p release_gems - for gem in artifacts/libfacedetection-*.gem/*.gem; do - platform=$(basename $gem | sed -E 's/libfacedetection-([^-]+-[^-]+)\.gem/\1/') - - # Construct the target filename: NAME-VERSION-PLATFORM.gem - target_filename="libfacedetection-${GEM_VERSION}-${platform}.gem" - target_path="release_gems/$target_filename" - mv "$gem" "$target_path" - done - # Move source gem to release_gems directory - mv artifacts/libfacedetection.gem/*.gem release_gems/libfacedetection-${GEM_VERSION}.gem - + run: echo "GEM_VERSION=${GITHUB_REF#refs/tags/}" >> "$GITHUB_ENV" - name: Create release uses: softprops/action-gh-release@v2 with: - tag_name: ${{ env.GEM_VERSION }} - files: release_gems/*.gem + tag_name: ${{ github.ref_name }} + name: libfacedetection ${{ env.GEM_VERSION }} + files: pkg/*.gem generate_release_notes: true