From efa33d699a240c3ade1203f62ea2d58b9a4ff189 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 15 Feb 2020 18:15:38 +0100 Subject: [PATCH 1/4] Add workflow --- .github/workflows/build.yml | 173 ++++++++++++++++++++++++++++++++++++ Gemfile | 6 ++ 2 files changed, 179 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 Gemfile diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..8656589 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,173 @@ +name: JRuby Dev Builds +on: + push: + branches: # TODO + - '*' # TODO + tags: + - '*' + schedule: + - cron: '0 19 * * *' +jobs: + release: + if: false # TODO + name: Create GitHub Release + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 0 + if: github.event_name == 'schedule' + - name: Create tag + id: create_tag + run: | + if [[ "${{ github.event_name }}" == "schedule" ]]; then + tag=builds-$(date +%Y%m%d-%H%M%S) + else + tag=$(basename "${{ github.ref }}") + fi + echo "::set-output name=tag::$tag" + - 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 + - name: Create artifact files + run: | + mkdir info + echo "${{ steps.create_tag.outputs.tag }}" > info/tag + echo "${{ steps.create_release.outputs.id }}" > info/release_id + echo "${{ steps.create_release.outputs.upload_url }}" > info/upload_url + - uses: actions/upload-artifact@v1 + with: + name: info + path: info + + build: + # needs: [release] + strategy: + fail-fast: false + matrix: + os: [ windows-latest ] # [ ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + steps: + # - uses: actions/download-artifact@v1 + # with: + # name: info + # - name: Set upload_url + # id: upload_info + # run: | + # upload_url=$(cat info/upload_url) + # echo "::set-output name=upload_url::$upload_url" + + # Build + - uses: actions/checkout@v2 + # - name: Setup system ruby + # 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" + tar tf jruby-head.tar.gz | grep exe + mkdir -p ~/.rubies + tar xf jruby-head.tar.gz -C ~/.rubies + cd ~/.rubies + ls -l + ls -l jruby-*/bin + mv jruby-* jruby-head + ls -l jruby-head/bin + file jruby-head/bin/jruby.exe + ls -l jruby-head/bin/jruby.exe + - name: Add ruby alias + if: "!startsWith(matrix.os, 'windows')" + run: | + cd ~/.rubies/jruby-head/bin + ln -s jruby ruby + - name: Add ruby alias (Windows) + if: startsWith(matrix.os, 'windows') + shell: bash + run: | + cd ~/.rubies/jruby-head/bin + ls -l + # 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 + - name: Install Bundler if needed + shell: bash + run: | + if [ ! -e ~/.rubies/jruby-head/bin/bundle ]; then + export PATH="$HOME/.rubies/jruby-head/bin:$PATH" + gem install bundler -v '~> 1' --no-document + fi + + - name: Create archive + run: tar czf jruby-head-${{ matrix.os }}.tar.gz -C ~/.rubies jruby-head + + # Test + - run: echo "::add-path::$HOME/.rubies/jruby-head/bin" + - run: ruby --version + - run: gem --version + - run: rake --version + - run: ruby -ropen-uri -e 'puts 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: Subprocess test + run: ruby -e 'p RbConfig::CONFIG["CPPFLAGS"]; def Warning.warn(s); raise s; end; system RbConfig.ruby, "-e", "p :OK"' + + - name: Upload Built Ruby + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.upload_info.outputs.upload_url }} + asset_path: jruby-head-${{ matrix.os }}.tar.gz + asset_name: jruby-head-${{ matrix.os }}.tar.gz + asset_content_type: application/gzip + + metadata: + name: Publish Release + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + ref: metadata + fetch-depth: 0 + - uses: actions/download-artifact@v1 + with: + name: info + - name: Set publish_info + id: publish_info + run: | + tag=$(cat info/tag) + release_id=$(cat info/release_id) + echo "::set-output name=tag::$tag" + echo "::set-output name=release_id::$release_id" + - uses: eregon/publish-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + release_id: ${{ steps.publish_info.outputs.release_id }} + - run: | + echo "${{ steps.publish_info.outputs.tag }}" > latest_build.tag + git config user.name "GitHub Actions" + git config user.email automated@automated.org + git commit -a -m 'Update latest_build.tag' + git push + - uses: eregon/keep-last-n-releases@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + n: 3 + last_tag_file: latest_build.tag diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..0012c31 --- /dev/null +++ b/Gemfile @@ -0,0 +1,6 @@ +# Used for testing +source 'https://rubygems.org' + +gem "rake" +gem "path" +gem "json", "2.2.0" From 087b36d787dcc26277f55e34c078c52e97ffc3e0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 15 Feb 2020 19:25:21 +0100 Subject: [PATCH 2/4] exclude --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8656589..17be48e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,7 +78,7 @@ jobs: curl --fail -L -o jruby-head.tar.gz "$url" tar tf jruby-head.tar.gz | grep exe mkdir -p ~/.rubies - tar xf jruby-head.tar.gz -C ~/.rubies + tar xf jruby-head.tar.gz --exclude='*/bin/jruby' -C ~/.rubies cd ~/.rubies ls -l ls -l jruby-*/bin From ec864a90b69a123ea55f051c326f4c7b21e9852f Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 15 Feb 2020 20:05:15 +0100 Subject: [PATCH 3/4] Revert "exclude" This reverts commit 087b36d787dcc26277f55e34c078c52e97ffc3e0. --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 17be48e..8656589 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -78,7 +78,7 @@ jobs: curl --fail -L -o jruby-head.tar.gz "$url" tar tf jruby-head.tar.gz | grep exe mkdir -p ~/.rubies - tar xf jruby-head.tar.gz --exclude='*/bin/jruby' -C ~/.rubies + tar xf jruby-head.tar.gz -C ~/.rubies cd ~/.rubies ls -l ls -l jruby-*/bin From cca284a47f695b6b3416107f7c6388ac739ae087 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 15 Feb 2020 20:06:01 +0100 Subject: [PATCH 4/4] try --- .github/workflows/build.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8656589..594bcb8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -75,11 +75,9 @@ jobs: run: | url=$(ruby find-jruby-head-url.rb) echo "$url" - curl --fail -L -o jruby-head.tar.gz "$url" - tar tf jruby-head.tar.gz | grep exe - mkdir -p ~/.rubies - tar xf jruby-head.tar.gz -C ~/.rubies - cd ~/.rubies + curl --fail -L -o archive.tar.gz "$url" + tar tf archive.tar.gz | grep exe + tar xf archive.tar.gz ls -l ls -l jruby-*/bin mv jruby-* jruby-head