Skip to content

TruffleRuby Dev Builds #2110

TruffleRuby Dev Builds

TruffleRuby Dev Builds #2110

Workflow file for this run

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@v3
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@v6
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
release:
name: Create GitHub Release
needs: [prepare]
if: needs.prepare.outputs.should_build == 'true'
runs-on: ubuntu-latest
outputs:
tag: ${{ steps.tag.outputs.tag }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
if: github.event_name != 'push'
- name: Set tag name
id: tag
run: |
if [[ "${{ github.event_name }}" != "push" ]]; then
tag=v$(date +%Y%m%d.%H%M%S)
else
tag=$(basename "${{ github.ref }}")
fi
echo "tag=$tag" >> $GITHUB_OUTPUT
- name: Create Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
tag="${{ steps.tag.outputs.tag }}"
body="oracle/truffleruby@${{ needs.prepare.outputs.commit }}"
gh release create --draft "$tag" --title "$tag" --notes "$body"
build:
needs: [prepare, release]
strategy:
fail-fast: false
matrix:
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, macos-arm-oss ]
runs-on: ${{ matrix.os }}
steps:
- name: Clone truffleruby
uses: actions/checkout@v3
with:
repository: oracle/truffleruby
ref: ${{ needs.prepare.outputs.commit }}
- name: Set platform
id: platform
run: |
platform=${{ matrix.os }}
platform=${platform/macos-11/macos-latest}
platform=${platform/macos-arm-oss/macos-13-arm64}
echo "platform=$platform" >> $GITHUB_OUTPUT
# Build
- name: Setup system ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: 2.6
- name: Setup system python
uses: actions/setup-python@v3
with:
python-version: '3.10'
- run: echo "SDKROOT=$(xcrun --show-sdk-path)" >> $GITHUB_ENV
if: startsWith(matrix.os, 'macos')
- name: Install JVMCI
run: |
tool/jt.rb install jvmci
echo "JAVA_HOME=$(tool/jt.rb install jvmci)" >> $GITHUB_ENV
- name: Install mx
run: tool/jt.rb mx --version
- name: Clone Graal
uses: actions/checkout@v3
with:
repository: oracle/graal
path: graal
fetch-depth: 0
- run: mv graal ..
- run: tool/jt.rb mx sforceimports
- run: free -m
if: startsWith(matrix.os, 'ubuntu-')
- name: Build TruffleRuby
run: tool/jt.rb build --env native
- run: mkdir -p ~/.rubies
- run: mv $(tool/jt.rb mx --env native standalone-home ruby) ~/.rubies/truffleruby-head
- name: Create archive
run: tar czf truffleruby-head-${{ steps.platform.outputs.platform }}.tar.gz -C ~/.rubies truffleruby-head
- name: Basic test
run: ~/.rubies/truffleruby-head/bin/ruby --version
- name: OpenSSL test
run: ~/.rubies/truffleruby-head/bin/ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }'
- name: Upload Built Ruby
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh release upload "${{ needs.release.outputs.tag }}" "truffleruby-head-${{ steps.platform.outputs.platform }}.tar.gz"
publish:
name: Publish Release
needs: [release, build]
runs-on: ubuntu-latest
steps:
- name: Publish Release
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: gh release edit "${{ needs.release.outputs.tag }}" --draft=false
- uses: eregon/keep-last-n-releases@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
n: 7
remove_tags_without_release: true