From b34e4fae53e2f299c66004e638d57084d8bca8c4 Mon Sep 17 00:00:00 2001 From: Joeri Sykora Date: Thu, 15 Apr 2021 08:51:29 +0200 Subject: [PATCH] Add GitHub Action for releasing Gluon builds (#2) * github action for creating gluon releases * fix syntax error * fix syntax error * define jobs once * fix env variables * fix create distribution and correct macos label * fix paths * fix path to build * fix env vars usage * invoke commands in pwsh with iex * use mx.cmd on windows * use mx graalvm-home to locate distribution * debug pwsh * setup visual studio shell * retry zipping distribution * retry zip distribution * fix syntax error * fix artifact upload * fix archive name on darwin * try to use correct artifacts * remove debug * add darwin zip with /Contents/Home * cd to home dir and then zip --- .github/workflows/gluon_release.yml | 192 ++++++++++++++++++++++++++++ 1 file changed, 192 insertions(+) create mode 100644 .github/workflows/gluon_release.yml diff --git a/.github/workflows/gluon_release.yml b/.github/workflows/gluon_release.yml new file mode 100644 index 000000000000..e4a0cd4e3dc1 --- /dev/null +++ b/.github/workflows/gluon_release.yml @@ -0,0 +1,192 @@ +name: Gluon Release + +on: + push: + tags: + - '*' + +env: + RELEASE_VERSION: 21.1.0-dev + LANG: en_US.UTF-8 + JDK: "labsjdk-ce-11" + +jobs: + build-graalvm-linux: + runs-on: ubuntu-20.04 + env: + JAVA_HOME: ${{ github.workspace }}/jdk + MX_PATH: ${{ github.workspace }}/mx + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions/checkout@v2 + with: + repository: graalvm/mx.git + fetch-depth: 1 + ref: master + path: ${{ env.MX_PATH }} + - uses: actions/cache@v1 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - name: Get JDK + run: | + mkdir jdk-dl + ${MX_PATH}/mx fetch-jdk --java-distribution ${JDK} --to jdk-dl --alias ${JAVA_HOME} + - name: Build GraalVM + id: linux-build-graalvm + env: + DISABLE_LIBPOLYGLOT: true + DISABLE_POLYGLOT: true + FORCE_BASH_LAUNCHERS: false + LINKY_LAYOUT: "*.jar" + working-directory: ./vm + run: | + echo ${JAVA_HOME} + ${JAVA_HOME}/bin/java -version + ${MX_PATH}/mx --dy /substratevm build + GRAALVM_HOME=`${MX_PATH}/mx --dy /substratevm graalvm-home` + echo "::set-output name=graalvm-home-dir::$GRAALVM_HOME" + - name: Create distribution + working-directory: ./vm + run: | + cd ${{ steps.linux-build-graalvm.outputs.graalvm-home-dir }}/.. + mv `ls -1 | head -n1` graalvm-svm-linux-gluon-${RELEASE_VERSION} + zip -r ${{ github.workspace }}/vm/graalvm-svm-linux-gluon-${RELEASE_VERSION}.zip graalvm-svm-linux-gluon-${RELEASE_VERSION} + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-linux + path: | + vm/graalvm-svm-linux-gluon-${{ env.RELEASE_VERSION }}.zip + + build-graalvm-darwin: + runs-on: macos-10.15 + env: + JAVA_ROOT: ${{ github.workspace }}/jdk + JAVA_HOME: ${{ github.workspace }}/jdk/Contents/Home + MX_PATH: ${{ github.workspace }}/mx + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions/checkout@v2 + with: + repository: graalvm/mx.git + fetch-depth: 1 + ref: master + path: ${{ env.MX_PATH }} + - uses: actions/cache@v1 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - name: Get JDK + run: | + mkdir jdk-dl + ${MX_PATH}/mx fetch-jdk --java-distribution ${JDK} --to jdk-dl --alias ${JAVA_ROOT} + - name: Build GraalVM + id: darwin-build-graalvm + env: + DISABLE_LIBPOLYGLOT: true + DISABLE_POLYGLOT: true + FORCE_BASH_LAUNCHERS: false + LINKY_LAYOUT: "*.jar" + working-directory: ./vm + run: | + echo ${JAVA_HOME} + ${JAVA_HOME}/bin/java -version + ${MX_PATH}/mx --dy /substratevm build + GRAALVM_HOME=`${MX_PATH}/mx --dy /substratevm graalvm-home` + echo "::set-output name=graalvm-home-dir::$GRAALVM_HOME" + - name: Create distribution + working-directory: ./vm + run: | + cd ${{ steps.darwin-build-graalvm.outputs.graalvm-home-dir }}/../../.. + mv `ls -1 | head -n1` graalvm-svm-darwin-gluon-${RELEASE_VERSION} + zip -r ${{ github.workspace }}/vm/graalvm-svm-darwin-gluon-${RELEASE_VERSION}.zip graalvm-svm-darwin-gluon-${RELEASE_VERSION} + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-darwin + path: | + vm/graalvm-svm-darwin-gluon-${{ env.RELEASE_VERSION }}.zip + + build-graalvm-windows: + runs-on: windows-2019 + env: + JAVA_HOME: ${{ github.workspace }}\jdk + MX_PATH: ${{ github.workspace }}\mx + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions/checkout@v2 + with: + repository: graalvm/mx.git + fetch-depth: 1 + ref: master + path: ${{ env.MX_PATH }} + - uses: actions/cache@v1 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - name: Get JDK + run: | + mkdir jdk-dl + iex "$env:MX_PATH\mx.cmd fetch-jdk --java-distribution $env:JDK --to jdk-dl --alias $env:JAVA_HOME" + - name: Set up Visual Studio shell + uses: egor-tensin/vs-shell@v2 + with: + arch: x64 + - name: Build GraalVM + id: windows-build-graalvm + env: + DEFAULT_DYNAMIC_IMPORTS: /substratevm,/tools + EXCLUDE_COMPONENTS: nju,llp,dis,pbm,llmulrl + FORCE_BASH_LAUNCHERS: polyglot + SKIP_LIBRARIES: polyglot + working-directory: ./vm + run: | + echo $env:JAVA_HOME + iex "$env:JAVA_HOME\bin\java -version" + iex "$env:MX_PATH\mx.cmd build" + $GRAALVM_HOME = ((iex "$env:MX_PATH\mx.cmd graalvm-home") | Out-String).trim() + echo "::set-output name=graalvm-home-dir::$GRAALVM_HOME" + - name: Create distribution + working-directory: ./vm + run: | + move ${{ steps.windows-build-graalvm.outputs.graalvm-home-dir }} graalvm-svm-windows-gluon-$env:RELEASE_VERSION + Compress-Archive -Path graalvm-svm-windows-gluon-$env:RELEASE_VERSION -DestinationPath graalvm-svm-windows-gluon-$env:RELEASE_VERSION.zip + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-windows + path: | + vm/graalvm-svm-windows-gluon-${{ env.RELEASE_VERSION }}.zip + + create-release: + runs-on: ubuntu-20.04 + needs: + - build-graalvm-linux + - build-graalvm-darwin + - build-graalvm-windows + steps: + - uses: actions/checkout@v2 + with: + fetch-depth: 1 + - uses: actions/download-artifact@v2 + with: + path: artifacts + - name: Create release + uses: ncipollo/release-action@v1 + with: + name: GraalVM CE Gluon ${{ github.ref }} + body: | + This is a Gluon build of GraalVM. + Based on Gluon Graal commit: ${{ github.sha }} + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: "artifacts/graalvm-zip-linux/*.zip,artifacts/graalvm-zip-darwin/*.zip,artifacts/graalvm-zip-windows/*.zip"