Add native gem precompilation support #4
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Test gems | |
| concurrency: | |
| group: "${{ github.workflow }}-${{ github.ref }}" | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - v* | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| uses: ./.github/workflows/build-gems.yml | |
| install_source_gem: | |
| needs: build | |
| name: "install source gem ${{ matrix.target.os }} ${{ matrix.target.ruby }}" | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| target: | |
| - { ruby: "2.7", os: "ubuntu-latest", gemfile: "2.7" } | |
| - { ruby: "3.0", os: "ubuntu-latest", gemfile: "3.0" } | |
| - { ruby: "3.1", os: "ubuntu-latest", gemfile: "3.1" } | |
| - { ruby: "3.2", os: "ubuntu-latest", gemfile: "3.2" } | |
| - { ruby: "3.3", os: "ubuntu-latest", gemfile: "3.3" } | |
| - { ruby: "3.4", os: "ubuntu-latest", gemfile: "3.4" } | |
| - { ruby: "4.0", os: "ubuntu-latest", gemfile: "4.0" } | |
| - { ruby: "head", os: "ubuntu-latest", gemfile: "4.1" } | |
| - { ruby: "jruby", os: "ubuntu-latest", gemfile: ".." } | |
| - { ruby: "truffleruby", os: "ubuntu-latest", gemfile: ".." } | |
| - { ruby: "2.7", os: "macos-latest", gemfile: "2.7" } | |
| - { ruby: "3.0", os: "macos-latest", gemfile: "3.0" } | |
| - { ruby: "3.1", os: "macos-latest", gemfile: "3.1" } | |
| - { ruby: "3.2", os: "macos-latest", gemfile: "3.2" } | |
| - { ruby: "3.3", os: "macos-latest", gemfile: "3.3" } | |
| - { ruby: "3.4", os: "macos-latest", gemfile: "3.4" } | |
| - { ruby: "4.0", os: "macos-latest", gemfile: "4.0" } | |
| - { ruby: "head", os: "macos-latest", gemfile: "4.1" } | |
| - { ruby: "jruby", os: "macos-latest", gemfile: ".." } | |
| - { ruby: "truffleruby", os: "macos-latest", gemfile: ".." } | |
| - { ruby: "2.7", os: "windows-latest", gemfile: "2.7" } | |
| - { ruby: "3.0", os: "windows-latest", gemfile: "3.0" } | |
| - { ruby: "3.1", os: "windows-latest", gemfile: "3.1" } | |
| - { ruby: "3.2", os: "windows-latest", gemfile: "3.2" } | |
| - { ruby: "3.3", os: "windows-latest", gemfile: "3.3" } | |
| - { ruby: "3.4", os: "windows-latest", gemfile: "3.4" } | |
| - { ruby: "4.0", os: "windows-latest", gemfile: "4.0" } | |
| - { ruby: "head", os: "windows-latest", gemfile: "4.1" } | |
| - { ruby: "jruby", os: "windows-latest", gemfile: ".." } | |
| env: | |
| BUNDLE_GEMFILE: gemfiles/${{ matrix.target.gemfile }}/Gemfile | |
| runs-on: ${{ matrix.target.os }} | |
| steps: | |
| - if: startsWith(matrix.target.os, 'windows') | |
| name: configure git crlf | |
| run: | | |
| git config --system core.autocrlf false | |
| git config --system core.eol lf | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 | |
| with: | |
| ruby-version: ${{ matrix.target.ruby }} | |
| bundler-cache: true | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: source-gem | |
| path: gems | |
| - run: ./.github/scripts/gem-install-test gems/*.gem | |
| shell: sh | |
| test_linux_native: | |
| name: "install native gem ${{ matrix.platform }} ${{ matrix.ruby }}" | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - aarch64-linux-gnu | |
| - aarch64-linux-musl | |
| - arm-linux-gnu | |
| - arm-linux-musl | |
| - x86_64-linux-gnu | |
| - x86_64-linux-musl | |
| ruby: ["3.3", "3.4", "4.0"] | |
| include: | |
| # musl platforms need alpine image and build-base | |
| - { platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base linux-headers yaml-dev &&" } | |
| - { platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base linux-headers yaml-dev &&" } | |
| - { platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add build-base linux-headers yaml-dev &&" } | |
| # docker platform for each platform | |
| - { platform: aarch64-linux-gnu, runner: ubuntu-24.04-arm, docker_platform: "--platform=linux/arm64" } | |
| - { platform: aarch64-linux-musl, runner: ubuntu-24.04-arm, docker_platform: "--platform=linux/arm64" } | |
| - { platform: arm-linux-gnu, runner: ubuntu-24.04-arm, docker_platform: "--platform=linux/arm/v7" } | |
| - { platform: arm-linux-musl, runner: ubuntu-24.04-arm, docker_platform: "--platform=linux/arm/v7" } | |
| runs-on: ${{ matrix.runner || 'ubuntu-latest' }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: cruby-${{ matrix.platform }}-gem | |
| path: gems | |
| - name: Install and test gem | |
| env: | |
| DOCKER_PLATFORM: ${{ matrix.docker_platform }} | |
| RUBY_VERSION: ${{ matrix.ruby }} | |
| DOCKER_TAG: ${{ matrix.docker_tag }} | |
| BOOTSTRAP: ${{ matrix.bootstrap }} | |
| run: | | |
| # shellcheck disable=SC2086 # DOCKER_PLATFORM intentionally word-splits (empty or "--platform=...") | |
| docker run --rm -v "$PWD:/work" -w /work \ | |
| ${DOCKER_PLATFORM} "ruby:${RUBY_VERSION}${DOCKER_TAG}" \ | |
| sh -c " | |
| ${BOOTSTRAP} | |
| ./.github/scripts/gem-install-test gems/*.gem | |
| " | |
| test_darwin_native: | |
| name: "install native gem ${{ matrix.platform }} ${{ matrix.ruby }}" | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [macos-15, macos-15-intel] | |
| ruby: ["3.3", "3.4", "4.0"] | |
| include: | |
| - os: macos-15 | |
| platform: arm64-darwin | |
| - os: macos-15-intel | |
| platform: x86_64-darwin | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 | |
| with: | |
| ruby-version: "${{ matrix.ruby }}" | |
| bundler-cache: true | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: cruby-${{ matrix.platform }}-gem | |
| path: gems | |
| - run: ./.github/scripts/gem-install-test gems/*.gem | |
| shell: sh | |
| test_windows_native: | |
| name: "install native gem ${{ matrix.platform }} ${{ matrix.ruby }}" | |
| needs: build | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: [x64-mingw-ucrt, aarch64-mingw-ucrt] | |
| ruby: ["3.3", "3.4", "4.0"] | |
| include: | |
| - { platform: x64-mingw-ucrt, os: windows-latest } | |
| - { platform: aarch64-mingw-ucrt, os: windows-11-arm } | |
| exclude: | |
| - { platform: aarch64-mingw-ucrt, ruby: "3.3" } | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: configure git crlf | |
| run: | | |
| git config --system core.autocrlf false | |
| git config --system core.eol lf | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ruby/setup-ruby@c4e5b1316158f92e3d49443a9d58b31d25ac0f8f # v1.306.0 | |
| with: | |
| ruby-version: "${{ matrix.ruby }}" | |
| bundler-cache: true | |
| - uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 | |
| with: | |
| name: cruby-${{ matrix.platform }}-gem | |
| path: gems | |
| - run: ./.github/scripts/gem-install-test gems/*.gem | |
| shell: sh |