diff options
Diffstat (limited to '.github/workflows/crosscompile.yml')
| -rw-r--r-- | .github/workflows/crosscompile.yml | 123 |
1 files changed, 123 insertions, 0 deletions
diff --git a/.github/workflows/crosscompile.yml b/.github/workflows/crosscompile.yml new file mode 100644 index 0000000000..4c28516e25 --- /dev/null +++ b/.github/workflows/crosscompile.yml @@ -0,0 +1,123 @@ +name: Cross compile +on: + push: + paths-ignore: + - 'doc/**' + - '**/man/*' + - '**.md' + - '**.rdoc' + - '**/.document' + - '.*.yml' + pull_request: + # Do not use paths-ignore for required status checks + # https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks + merge_group: + +concurrency: + group: ${{ github.workflow }} / ${{ startsWith(github.event_name, 'pull') && github.ref_name || github.sha }} + cancel-in-progress: ${{ startsWith(github.event_name, 'pull') }} + +permissions: + contents: read + +jobs: + make: + name: make (${{ matrix.host }} host on ${{ matrix.build }}) + strategy: + matrix: + include: + - host: aarch64-linux-gnu + arch: arm64 + build: x86_64-linux-gnu + runs-on: ubuntu-24.04 + file_arch: ARM aarch64 + - host: x86_64-linux-gnu + arch: amd64 + build: aarch64-linux-gnu + runs-on: ubuntu-24.04-arm + file_arch: x86-64 + fail-fast: false + + env: + GITPULLOPTIONS: --no-tags origin ${{ github.ref }} + + runs-on: ${{ matrix.runs-on }} + + if: >- + ${{!(false + || contains(github.event.head_commit.message, '[DOC]') + || contains(github.event.pull_request.title, '[DOC]') + || contains(github.event.pull_request.labels.*.name, 'Documentation') + || (github.event.pull_request.user.login == 'dependabot[bot]') + )}} + + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + sparse-checkout-cone-mode: false + sparse-checkout: /.github + persist-credentials: false + + - uses: ./.github/actions/setup/directories + with: + srcdir: src + builddir: build + makeup: true + + - name: Setup cross-compilation toolchain sources + run: | + native_arch=$(dpkg --print-architecture) + # Restrict existing sources to native arch + sudo sed -i '/^Architectures:/d' /etc/apt/sources.list.d/ubuntu.sources + sudo sed -i "/^Types:/a Architectures: ${native_arch}" /etc/apt/sources.list.d/ubuntu.sources + # Add cross-arch sources + if [ "${{ matrix.arch }}" = "arm64" ]; then + cross_uri="http://ports.ubuntu.com/" + else + cross_uri="http://archive.ubuntu.com/ubuntu/" + fi + printf '%s\n' \ + "Types: deb" \ + "URIs: ${cross_uri}" \ + "Suites: noble noble-updates noble-security" \ + "Components: main universe" \ + "Architectures: ${{ matrix.arch }}" \ + | sudo tee /etc/apt/sources.list.d/cross-${{ matrix.arch }}.sources + + - uses: ./.github/actions/setup/ubuntu + with: + arch: ${{ matrix.arch }} + + - uses: ./.github/actions/setup/baseruby + id: baseruby + with: + srcdir: src + + - name: Run configure + run: >- + ../src/configure -C --disable-install-doc + --prefix=/usr + --build=${{ matrix.build }} + --host=${{ matrix.host }} + --with-baseruby="$baseruby" + env: + baseruby: ${{ steps.baseruby.outputs.ruby }} + + - run: make + + - run: make install DESTDIR=$PWD/install + + - name: Verify cross-compiled binary + run: | + file install/usr/bin/ruby + file install/usr/bin/ruby | grep -q '${{ matrix.file_arch }}' + + - uses: ./.github/actions/slack + with: + label: cross ${{ matrix.host }} + SLACK_WEBHOOK_URL: ${{ secrets.SIMPLER_ALERTS_URL }} # ruby-lang slack: ruby/simpler-alerts-bot + if: ${{ failure() }} + +defaults: + run: + working-directory: build |
