TruffleRuby Dev Builds #2877
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: TruffleRuby Dev Builds | |
| on: | |
| workflow_dispatch: | |
| push: | |
| tags: | |
| - '*' | |
| schedule: | |
| - cron: '0 8 * * *' | |
| jobs: | |
| prepare: | |
| name: Check if the latest truffleruby commit is already built | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_build: ${{ steps.check_commit.outputs.result }} | |
| commit: ${{ steps.latest_commit.outputs.commit }} | |
| steps: | |
| - name: Clone truffleruby | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: oracle/truffleruby | |
| path: truffleruby | |
| - name: Set latest_commit | |
| id: latest_commit | |
| working-directory: truffleruby | |
| run: echo "commit=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| - name: Check if latest commit already built | |
| uses: actions/github-script@v8 | |
| id: check_commit | |
| with: | |
| script: | | |
| const latestDevCommit = "${{ steps.latest_commit.outputs.commit }}" | |
| const { owner, repo } = context.repo | |
| let { data: release } = await github.rest.repos.getLatestRelease({ owner, repo }) | |
| const latestReleaseCommit = release.body.split('@')[1] | |
| console.log(`Latest release commit: ${latestReleaseCommit}`) | |
| console.log(`Latest truffleruby commit: ${latestDevCommit}`) | |
| if (latestReleaseCommit === latestDevCommit) { | |
| return 'false' | |
| } else { | |
| return 'true' | |
| } | |
| result-encoding: string | |
| build: | |
| needs: [prepare] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ macos-14 ] | |
| name: [ '+graalvm-head' ] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Clone truffleruby | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: oracle/truffleruby | |
| ref: ${{ needs.prepare.outputs.commit }} | |
| - name: Set platform | |
| id: platform | |
| run: | | |
| platform=${{ matrix.os }} | |
| platform=${platform/macos-13/macos-latest} | |
| platform=${platform/macos-14/macos-13-arm64} | |
| platform=${platform/%-arm/-arm64} | |
| echo "old_platform=$platform" >> $GITHUB_OUTPUT | |
| platform=${{ matrix.os }} | |
| platform=${platform/macos-13/darwin-x64} | |
| platform=${platform/macos-14/darwin-arm64} | |
| platform=${platform/%.04/.04-x64} | |
| platform=${platform/%.04-arm/.04-arm64} | |
| echo "platform=$platform" >> $GITHUB_OUTPUT | |
| # Build | |
| - name: Setup system ruby | |
| uses: ruby/setup-ruby@master | |
| with: | |
| ruby-version: 3.2 | |
| - name: Setup system python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.10' | |
| - run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV | |
| if: startsWith(matrix.os, 'macos') | |
| - run: sudo apt-get install -y --no-install-recommends libyaml-dev | |
| if: startsWith(matrix.os, 'ubuntu') | |
| - name: Download Oracle GraalVM | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: '25' | |
| distribution: 'graalvm' | |
| set-java-home: 'false' | |
| - name: Set BOOTSTRAP_GRAALVM | |
| run: echo "BOOTSTRAP_GRAALVM=$GRAALVM_HOME" >> $GITHUB_ENV | |
| - name: Setup jt | |
| run: echo "$PWD/bin" >> $GITHUB_PATH | |
| - name: Clone Graal | |
| run: jt sforceimports | |
| - name: Install JVMCI | |
| run: | | |
| jt install jvmci | |
| echo "JAVA_HOME=$(jt install jvmci)" >> $GITHUB_ENV | |
| - name: Install mx | |
| run: jt mx --version | |
| - run: free -m | |
| if: startsWith(matrix.os, 'ubuntu') | |
| - name: Build TruffleRuby (native) | |
| run: jt build --env native --extra-image-builder-argument=rubyvm:-J-XX:MaxRAMPercentage=100 | |
| if: matrix.name == '-head' | |
| - name: Build TruffleRuby (jvm) | |
| run: jt build --env jvm-ce | |
| if: matrix.name == '+graalvm-head' | |
| - run: mkdir -p ~/.rubies | |
| - run: mv $(jt -u native ruby-home) ~/.rubies/truffleruby${{ matrix.name }} | |
| if: matrix.name == '-head' | |
| - run: mv $(jt -u jvm-ce ruby-home) ~/.rubies/truffleruby${{ matrix.name }} | |
| if: matrix.name == '+graalvm-head' | |
| - name: Create archive | |
| run: tar czf truffleruby${{ matrix.name }}-${{ steps.platform.outputs.platform }}.tar.gz -C ~/.rubies truffleruby${{ matrix.name }} | |
| - name: Setup SSH session | |
| uses: mxschmitt/action-tmate@v3 | |
| with: | |
| limit-access-to-actor: true | |
| - name: Basic test | |
| run: ~/.rubies/truffleruby${{ matrix.name }}/bin/ruby --version | |
| - name: OpenSSL test | |
| run: ~/.rubies/truffleruby${{ matrix.name }}/bin/ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }' |