JRuby Dev Builds #1318
This file contains 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: JRuby Dev Builds | |
on: | |
push: | |
tags: | |
- '*' | |
schedule: | |
- cron: '0 19 * * *' | |
jobs: | |
release: | |
name: Create GitHub Release | |
runs-on: ubuntu-latest | |
outputs: | |
release_id: ${{ steps.create_release.outputs.id }} | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
if: github.event_name == 'schedule' | |
- name: Create tag | |
id: create_tag | |
shell: bash | |
run: | | |
if [[ "${{ github.event_name }}" == "schedule" ]]; then | |
tag=v$(date +%Y%m%d.%H%M%S) | |
else | |
tag=$(basename "${{ github.ref }}") | |
fi | |
echo "tag=$tag" >> $GITHUB_OUTPUT | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.create_tag.outputs.tag }} | |
release_name: ${{ steps.create_tag.outputs.tag }} | |
draft: true | |
prerelease: false | |
build: | |
needs: [release] | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ ubuntu-20.04, ubuntu-22.04, macos-11, windows-2019 ] | |
runs-on: ${{ matrix.os }} | |
env: # https://github.com/jruby/jruby/issues/7182 | |
JAVA_OPTS: -Djdk.io.File.enableADS=true | |
steps: | |
- name: Set platform | |
id: platform | |
shell: bash | |
run: | | |
platform=${{ matrix.os }} | |
platform=${platform/macos-*/macos-latest} | |
platform=${platform/windows-*/windows-latest} | |
echo "platform=$platform" >> $GITHUB_OUTPUT | |
# Build | |
- uses: actions/checkout@v2 | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: 2.6 | |
- name: Download latest jruby nightly archive | |
shell: bash | |
run: | | |
url=$(ruby find-jruby-head-url.rb) | |
echo "$url" | |
curl --fail -L -o jruby-head.tar.gz "$url" | |
- uses: eregon/clean-path@v1 | |
with: | |
regexp: '\bruby\b' | |
- run: tar xf jruby-head.tar.gz | |
if: "!startsWith(matrix.os, 'windows')" | |
# Extracting must be done in the native shell: https://github.com/MSP-Greg/ruby-setup-ruby/issues/1 | |
# We need to use to use the system tar, the Git tar seems basically broken | |
- run: C:\windows\system32\tar.exe xf jruby-head.tar.gz | |
if: startsWith(matrix.os, 'windows') | |
- name: Rename to jruby-head | |
shell: bash | |
run: | | |
ls -l jruby-*-SNAPSHOT/bin | |
mv jruby-*-SNAPSHOT jruby-head | |
ls -l jruby-head/bin | |
- name: Add ruby alias | |
if: "!startsWith(matrix.os, 'windows')" | |
run: | | |
cd jruby-head/bin | |
ln -s jruby ruby | |
- name: Add ruby alias (Windows) | |
if: startsWith(matrix.os, 'windows') | |
shell: bash | |
run: | | |
cd jruby-head/bin | |
# Copy bash launcher, so 'ruby' works in bash | |
cp jruby ruby | |
# Create ruby.bat, so 'ruby' works in pwsh | |
echo -en "@ECHO OFF\r\n@\"%~dp0jruby.exe\" %*\r\n" > ruby.bat | |
ls -l | |
- name: Create archive | |
run: tar czf jruby-head-${{ steps.platform.outputs.platform }}.tar.gz jruby-head | |
# Test | |
- run: echo "$PWD/jruby-head/bin" >> $GITHUB_PATH | |
if: "!startsWith(matrix.os, 'windows')" | |
- run: echo "$($pwd.Path)\jruby-head\bin" | Out-File -FilePath $Env:GITHUB_PATH -Encoding utf8 -Append | |
if: startsWith(matrix.os, 'windows') | |
- run: which ruby | |
if: "!startsWith(matrix.os, 'windows')" | |
- run: where.exe ruby | |
if: startsWith(matrix.os, 'windows') | |
- run: echo $Env:Path | |
- run: ruby --version | |
- run: ruby -e 'raise unless RUBY_ENGINE == %{jruby}' | |
- run: gem --version | |
- run: rake --version | |
- run: ruby -ropen-uri -e 'puts URI.send(:open, %{https://rubygems.org/}) { |f| f.read(1024) }' | |
- run: gem install json:2.2.0 --no-document | |
- run: bundle --version | |
- run: bundle install | |
- run: bundle exec rake --version | |
- name: Upload Built Ruby | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.release.outputs.upload_url }} | |
asset_path: jruby-head-${{ steps.platform.outputs.platform }}.tar.gz | |
asset_name: jruby-head-${{ steps.platform.outputs.platform }}.tar.gz | |
asset_content_type: application/gzip | |
metadata: | |
name: Publish Release | |
needs: [release, build] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.release.outputs.release_id }} | |
- uses: eregon/keep-last-n-releases@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
n: 3 | |
remove_tags_without_release: true |