precompiled #388
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: precompiled | |
| concurrency: | |
| group: "${{github.workflow}}-${{github.ref}}" | |
| cancel-in-progress: true | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 8 * * 3" # At 08:00 on Wednesday # https://crontab.guru/#0_8_*_*_3 | |
| push: | |
| branches: | |
| - main | |
| - v*.*.x | |
| tags: | |
| - v*.*.* | |
| pull_request: | |
| types: [opened, synchronize] | |
| branches: | |
| - '*' | |
| paths: ["precompiled/**/*", ".github/workflows/precompiled.yml"] | |
| jobs: | |
| ruby_versions: | |
| outputs: | |
| # these are usually the same, but are different once we get to ruby release candidates | |
| setup_ruby: "['3.2', '3.3', '3.4', '4.0']" | |
| image_tag: "['3.2', '3.3', '3.4', '4.0']" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "generating rubies ..." | |
| rcd_image_version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| rcd_image_version: ${{steps.rcd_image_version.outputs.rcd_image_version}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134 | |
| with: | |
| working-directory: precompiled | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| bundler: latest | |
| - id: rcd_image_version | |
| run: bundle exec ruby -e 'require "rake_compiler_dock"; puts "rcd_image_version=#{RakeCompilerDock::IMAGE_VERSION}"' >> $GITHUB_OUTPUT | |
| working-directory: precompiled | |
| test: | |
| needs: ["ruby_versions"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| runs-on: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
| ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }} | |
| runs-on: ${{matrix.runs-on}} | |
| steps: | |
| # git crlf needed to apply patches cleanly on windows runners | |
| - name: configure git crlf | |
| if: matrix.runs-on == 'windows-latest' | |
| run: | | |
| git config --system core.autocrlf false | |
| git config --system core.eol lf | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134 | |
| with: | |
| working-directory: precompiled | |
| ruby-version: ${{matrix.ruby}} | |
| bundler-cache: true | |
| - uses: actions/cache@v4 | |
| with: | |
| path: precompiled/ports | |
| key: precompiled-ports-${{matrix.runs-on}}-${{hashFiles('precompiled/ext/precompiled/extconf.rb')}} | |
| - run: bundle exec rake compile test | |
| working-directory: precompiled | |
| generic-package: | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: precompiled/ports/archives | |
| key: archives-ubuntu-${{hashFiles('precompiled/ext/precompiled/extconf.rb')}} | |
| - uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134 | |
| with: | |
| working-directory: precompiled | |
| ruby-version: "3.4" | |
| bundler-cache: true | |
| - run: ./bin/test-gem-build gems ruby | |
| working-directory: precompiled | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: cruby-gem | |
| path: precompiled/gems | |
| retention-days: 1 | |
| generic-install: | |
| needs: ["generic-package", "ruby_versions"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: ["ubuntu-latest", "macos-15", "windows-latest"] | |
| ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }} | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134 | |
| with: | |
| working-directory: precompiled | |
| ruby-version: "${{ matrix.ruby }}" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cruby-gem | |
| path: precompiled/gems | |
| - run: ./bin/test-gem-install gems | |
| working-directory: precompiled | |
| shell: bash | |
| native-package: | |
| needs: ["rcd_image_version"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - "aarch64-linux-gnu" | |
| - "aarch64-linux-musl" | |
| - "arm-linux-gnu" | |
| - "arm-linux-musl" | |
| - "arm64-darwin" | |
| - "x64-mingw-ucrt" | |
| - "x86-linux-gnu" | |
| - "x86-linux-musl" | |
| - "x86_64-darwin" | |
| - "x86_64-linux-gnu" | |
| - "x86_64-linux-musl" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: precompiled/ports/archives | |
| key: archives-ubuntu-${{hashFiles('precompiled/ext/precompiled/extconf.rb')}} | |
| - run: | | |
| docker run --rm -v $PWD/precompiled:/precompiled -w /precompiled \ | |
| ghcr.io/rake-compiler/rake-compiler-dock-image:${{ needs.rcd_image_version.outputs.rcd_image_version }}-mri-${{ matrix.platform }} \ | |
| ./bin/test-gem-build gems ${{ matrix.platform }} | |
| - uses: actions/upload-artifact@v4 | |
| with: | |
| name: "cruby-${{ matrix.platform }}-gem" | |
| path: precompiled/gems | |
| retention-days: 1 | |
| linux-install: | |
| needs: ["native-package", "ruby_versions"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - "aarch64-linux-gnu" | |
| - "aarch64-linux-musl" | |
| - "arm-linux-gnu" | |
| - "arm-linux-musl" | |
| - "x86-linux-gnu" | |
| - "x86-linux-musl" | |
| - "x86_64-linux-gnu" | |
| - "x86_64-linux-musl" | |
| ruby: ${{ fromJSON(needs.ruby_versions.outputs.image_tag) }} | |
| include: | |
| - { runon: "ubuntu-latest", platform: x86_64-linux-gnu } | |
| # declare docker image for each platform | |
| - { runon: "ubuntu-latest", platform: aarch64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash &&" } | |
| - { runon: "ubuntu-latest", platform: arm-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash &&" } | |
| - { runon: "ubuntu-latest", platform: x86-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash &&" } | |
| - { runon: "ubuntu-latest", platform: x86_64-linux-musl, docker_tag: "-alpine", bootstrap: "apk add bash &&" } | |
| # declare docker platform for each platform | |
| - { runon: "ubuntu-24.04-arm", platform: aarch64-linux-gnu, docker_platform: "--platform=linux/arm64" } | |
| - { runon: "ubuntu-24.04-arm", platform: aarch64-linux-musl, docker_platform: "--platform=linux/arm64" } | |
| - { runon: "ubuntu-24.04-arm", platform: arm-linux-gnu, docker_platform: "--platform=linux/arm/v7" } | |
| - { runon: "ubuntu-24.04-arm", platform: arm-linux-musl, docker_platform: "--platform=linux/arm/v7" } | |
| - { runon: "ubuntu-latest", platform: x86-linux-gnu, docker_platform: "--platform=linux/386" } | |
| - { runon: "ubuntu-latest", platform: x86-linux-musl, docker_platform: "--platform=linux/386" } | |
| runs-on: ${{ matrix.runon }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cruby-${{ matrix.platform }}-gem | |
| path: precompiled/gems | |
| - run: | | |
| docker run --rm -v $PWD/precompiled:/precompiled -w /precompiled \ | |
| ${{ matrix.docker_platform }} ruby:${{ matrix.ruby }}${{ matrix.docker_tag }} \ | |
| sh -c " | |
| gem update --system && | |
| ${{ matrix.bootstrap }} | |
| ./bin/test-gem-install gems | |
| " | |
| darwin-install: | |
| needs: ["native-package", "ruby_versions"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - arm64-darwin | |
| - x86_64-darwin | |
| ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }} | |
| include: | |
| - { platform: arm64-darwin, os: macos-15 } | |
| - { platform: x86_64-darwin, os: macos-15-intel } | |
| runs-on: ${{matrix.os}} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134 | |
| with: | |
| ruby-version: "${{matrix.ruby}}" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cruby-${{matrix.platform}}-gem | |
| path: precompiled/gems | |
| - run: ./bin/test-gem-install gems | |
| working-directory: precompiled | |
| windows-install: | |
| needs: ["native-package", "ruby_versions"] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ruby: ${{ fromJSON(needs.ruby_versions.outputs.setup_ruby) }} | |
| runs-on: windows-2022 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: ruby/setup-ruby@d3e3bd032ad2222a8ac878bbccf2aba78864e134 | |
| with: | |
| ruby-version: "${{matrix.ruby}}" | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| name: cruby-x64-mingw-ucrt-gem | |
| path: precompiled/gems | |
| - run: ./bin/test-gem-install gems | |
| working-directory: precompiled |