From 989373e5f32aad835b8c0cd504d9c8cc08be8763 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Pereda?= Date: Tue, 7 Jun 2022 13:53:12 +0200 Subject: [PATCH] Add gluon jobs (#17) * Add release job and use tar.gz for mac and linux * Use Python 3.9 * don't use mx_python on Windows * Add self hosted runner for M1 * Don't set python for local runner * Add missing file * set correct JAVA_HOME * export explicitily * Fix linky_layout * remove linky_layout * Remove Linky_Layout * Remove Linky Layout Co-authored-by: jose.pereda --- .github/workflows/gluon_build_m1.yml | 98 +++++++++ .github/workflows/gluon_release.yml | 305 +++++++++++++++++++++++++++ 2 files changed, 403 insertions(+) create mode 100644 .github/workflows/gluon_build_m1.yml create mode 100644 .github/workflows/gluon_release.yml diff --git a/.github/workflows/gluon_build_m1.yml b/.github/workflows/gluon_build_m1.yml new file mode 100644 index 000000000000..53870d692c39 --- /dev/null +++ b/.github/workflows/gluon_build_m1.yml @@ -0,0 +1,98 @@ +# Builds GraalVM for Linux, Windows and macOS, wiht JDK 11 and 17, +# and replaces java static libraries on Linux 17 after building them with gcc 9.3 + +name: Gluon Release for M1 + +on: + push: + tags: + - '*' + +env: + LANG: en_US.UTF-8 + +jobs: + determine-version: + runs-on: ubuntu-20.04 + outputs: + simpleTag: ${{ steps.fetchSimpleTag.outputs.tag }} + version: ${{ steps.fetchVersion.outputs.version }} + steps: + - id: fetchSimpleTag + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - id: fetchVersion + run: echo ::set-output name=version::$(echo $GITHUB_REF | sed -E "s/.*(gluon-.*-(dev|Final)).*/\1/g") + + build-graalvm-darwin-m1: + needs: + - determine-version + runs-on: [self-hosted, macOS, X64] + defaults: + run: + shell: "/usr/bin/arch -arch arm64e /bin/bash -l {0}" + strategy: + matrix: + jdk: [11, 17] + env: + JDK: labsjdk-ce-${{ matrix.jdk }} + LABS_HOME: ${{ github.workspace }}/jdk + MX_PYTHON: python3.9 + MX_PATH: ${{ github.workspace }}/mx + GRAALVM_SVM: graalvm-svm-java${{ matrix.jdk }}-darwin-m1-${{ needs.determine-version.outputs.version }} + 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- + - uses: actions/setup-java@v2 + with: + distribution: 'temurin' + architecture: 'aarch64' + java-version: ${{ matrix.jdk }} + - name: Get JDK + run: | + mkdir jdk-dl + ${MX_PATH}/mx fetch-jdk --java-distribution ${JDK} --to jdk-dl --alias ${LABS_HOME} + - name: Build GraalVM + id: darwin-build-graalvm + env: + JAVA_HOME: ${{ env.LABS_HOME }}/Contents/Home + DISABLE_LIBPOLYGLOT: true + DISABLE_POLYGLOT: true + FORCE_BASH_LAUNCHERS: false + working-directory: ./vm + run: | + unset JAVA_HOME + export JAVA_HOME=${{ env.LABS_HOME }}/Contents/Home + export DISABLE_LIBPOLYGLOT=true + export DISABLE_POLYGLOT=true + export FORCE_BASH_LAUNCHERS=false + echo ${JAVA_HOME} + ${JAVA_HOME}/bin/java -version + echo >> GRAALVM-README.md && echo "TODO: use actual content" >> GRAALVM-README.md + ${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` ${{ env.GRAALVM_SVM }} + echo >> ${{ env.GRAALVM_SVM }}/Contents/Home/release && echo "VENDOR=Gluon" >> ${{ env.GRAALVM_SVM }}/Contents/Home/release + tar -czvf ${{ github.workspace }}/vm/${{ env.GRAALVM_SVM }}.tar.gz ${{ env.GRAALVM_SVM }} + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-darwin-m1 + path: | + vm/${{ env.GRAALVM_SVM }}.tar.gz diff --git a/.github/workflows/gluon_release.yml b/.github/workflows/gluon_release.yml new file mode 100644 index 000000000000..4f797d6a7c79 --- /dev/null +++ b/.github/workflows/gluon_release.yml @@ -0,0 +1,305 @@ +# Builds GraalVM for Linux, Windows and macOS, wiht JDK 11 and 17, +# and replaces java static libraries on Linux 17 after building them with gcc 9.3 + +name: Gluon Release + +on: + push: + tags: + - '*' + +env: + LANG: en_US.UTF-8 + JVMCI_VERSION: jvmci-22.1-b06 + +jobs: + determine-version: + runs-on: ubuntu-20.04 + outputs: + simpleTag: ${{ steps.fetchSimpleTag.outputs.tag }} + version: ${{ steps.fetchVersion.outputs.version }} + steps: + - id: fetchSimpleTag + run: echo ::set-output name=tag::${GITHUB_REF#refs/*/} + - id: fetchVersion + run: echo ::set-output name=version::$(echo $GITHUB_REF | sed -E "s/.*(gluon-.*-(dev|Final)).*/\1/g") + + build-labsjdk-static: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v2 + with: + repository: graalvm/labs-openjdk-17.git + fetch-depth: 1 + ref: ${{ env.JVMCI_VERSION }} + + - name: Update libraries Libraries + run: | + sudo apt update + sudo apt install libx11-dev libxext-dev libxrender-dev libxrandr-dev libxtst-dev libxt-dev libcups2-dev libasound2-dev + + - name: Build static libs + run: | + sh configure --with-conf-name=labsjdk --with-version-opt=${{ env.JVMCI_VERSION }} --with-native-debug-symbols=none --with-version-pre= '--with-vendor-name=GraalVM Community' --with-vendor-url=https://www.graalvm.org/ --with-vendor-bug-url=https://github.com/oracle/graal/issues --with-vendor-vm-bug-url=https://github.com/oracle/graal/issues + make CONF_NAME=labsjdk static-libs-image + + - name: Create zip + run: | + mkdir labsjdk-ce-17-${{ env.JVMCI_VERSION }}-static-libs + cp build/labsjdk/images/static-libs/lib/* labsjdk-ce-17-${{ env.JVMCI_VERSION }}-static-libs/ + zip -r labsjdk-17-static-libs-linux.zip labsjdk-ce-17-${{ env.JVMCI_VERSION }}-static-libs + + - name: Upload zip + uses: actions/upload-artifact@v2 + with: + name: labsjdk-17-static-libs-linux.zip + path: labsjdk-17-static-libs-linux.zip + retention-days: 1 + + build-graalvm-linux: + needs: + - determine-version + - build-labsjdk-static + runs-on: ubuntu-20.04 + strategy: + matrix: + jdk: [11, 17] + env: + JDK: labsjdk-ce-${{ matrix.jdk }} + LABS_HOME: ${{ github.workspace }}/jdk + MX_PYTHON: python3.9 + MX_PATH: ${{ github.workspace }}/mx + GRAALVM_SVM: graalvm-svm-java${{ matrix.jdk }}-linux-${{ needs.determine-version.outputs.version }} + 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 }} + - name: Setup python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + - uses: actions/cache@v1 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ matrix.jdk }} + - name: Get JDK + run: | + mkdir jdk-dl + ${MX_PATH}/mx fetch-jdk --java-distribution ${JDK} --to jdk-dl --alias ${LABS_HOME} + - name: Download labsjdk static zip + if: matrix.jdk == '17' + uses: actions/download-artifact@v2 + with: + name: labsjdk-17-static-libs-linux.zip + - name: Build GraalVM + id: linux-build-graalvm + env: + JAVA_HOME: ${{ env.LABS_HOME }} + DISABLE_LIBPOLYGLOT: true + DISABLE_POLYGLOT: true + FORCE_BASH_LAUNCHERS: false + 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` ${{ env.GRAALVM_SVM }} + if [[ ${{ matrix.jdk }} == "17" ]] + then + echo "Replace static libs under linux-amd64/glibc" + rm ${{ env.GRAALVM_SVM }}/lib/static/linux-amd64/glibc/*.a + unzip -j ${{ github.workspace }}/labsjdk-17-static-libs-linux.zip -d ${{ env.GRAALVM_SVM }}/lib/static/linux-amd64/glibc/ + fi + echo >> ${{ env.GRAALVM_SVM }}/release && echo "VENDOR=Gluon" >> ${{ env.GRAALVM_SVM }}/release + tar -czvf ${{ github.workspace }}/vm/${{ env.GRAALVM_SVM }}.tar.gz ${{ env.GRAALVM_SVM }} + + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-linux + path: | + vm/${{ env.GRAALVM_SVM }}.tar.gz + + build-graalvm-darwin: + needs: + - determine-version + runs-on: macos-10.15 + strategy: + matrix: + jdk: [11, 17] + env: + JDK: labsjdk-ce-${{ matrix.jdk }} + LABS_HOME: ${{ github.workspace }}/jdk + MX_PYTHON: python3.9 + MX_PATH: ${{ github.workspace }}/mx + GRAALVM_SVM: graalvm-svm-java${{ matrix.jdk }}-darwin-${{ needs.determine-version.outputs.version }} + 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 }} + - name: Setup python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + - uses: actions/cache@v1 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ matrix.jdk }} + - name: Get JDK + run: | + mkdir jdk-dl + ${MX_PATH}/mx fetch-jdk --java-distribution ${JDK} --to jdk-dl --alias ${LABS_HOME} + - name: Build GraalVM + id: darwin-build-graalvm + env: + JAVA_HOME: ${{ env.LABS_HOME }}/Contents/Home + DISABLE_LIBPOLYGLOT: true + DISABLE_POLYGLOT: true + FORCE_BASH_LAUNCHERS: false + 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` ${{ env.GRAALVM_SVM }} + echo >> ${{ env.GRAALVM_SVM }}/Contents/Home/release && echo "VENDOR=Gluon" >> ${{ env.GRAALVM_SVM }}/Contents/Home/release + tar -czvf ${{ github.workspace }}/vm/${{ env.GRAALVM_SVM }}.tar.gz ${{ env.GRAALVM_SVM }} + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-darwin + path: | + vm/${{ env.GRAALVM_SVM }}.tar.gz + + build-graalvm-windows: + needs: + - determine-version + runs-on: windows-2019 + strategy: + matrix: + jdk: [11, 17] + env: + JDK: labsjdk-ce-${{ matrix.jdk }} + LABS_HOME: ${{ github.workspace }}\jdk + MX_PATH: ${{ github.workspace }}\mx + GRAALVM_SVM: graalvm-svm-java${{ matrix.jdk }}-windows-${{ needs.determine-version.outputs.version }} + 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 }} + - name: Setup python + uses: actions/setup-python@v3 + with: + python-version: '3.9' + - uses: actions/cache@v1 + with: + path: ~/.mx + key: ${{ runner.os }}-mx-${{ hashFiles('**/suite.py') }} + restore-keys: ${{ runner.os }}-mx- + - uses: actions/setup-java@v2 + with: + distribution: 'temurin' + java-version: ${{ matrix.jdk }} + - name: Get JDK + run: | + mkdir jdk-dl + iex "$env:MX_PATH\mx.cmd fetch-jdk --java-distribution $env:JDK --to jdk-dl --alias $env:LABS_HOME" + - name: Set up Visual Studio shell + uses: egor-tensin/vs-shell@v2 + with: + arch: x64 + - name: Build GraalVM + id: windows-build-graalvm + env: + JAVA_HOME: ${{ env.LABS_HOME }} + 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 }} ${{ env.GRAALVM_SVM }} + echo '' >> ${{ env.GRAALVM_SVM }}/release && echo VENDOR=Gluon >> ${{ env.GRAALVM_SVM }}/release + Compress-Archive -Path ${{ env.GRAALVM_SVM }} -DestinationPath ${{ env.GRAALVM_SVM }}.zip + - name: Archive distribution + uses: actions/upload-artifact@v2 + with: + name: graalvm-zip-windows + path: | + vm/${{ env.GRAALVM_SVM }}.zip + + create-release: + runs-on: ubuntu-20.04 + needs: + - determine-version + - 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 name + id: create-release-name + run: echo ::set-output name=releaseName::$(echo ${{ needs.determine-version.outputs.simpleTag }} | sed "s/gluon-/Gluon /g") + - name: Create release + uses: ncipollo/release-action@v1 + with: + name: GraalVM CE ${{ steps.create-release-name.outputs.releaseName }} + body: | + This is a Gluon build of GraalVM. + Based on Gluon Graal commit: ${{ github.sha }} + token: ${{ secrets.GITHUB_TOKEN }} + artifacts: "artifacts/graalvm-zip-linux/*.tar.gz,artifacts/graalvm-zip-darwin/*.tar.gz,artifacts/graalvm-zip-windows/*.zip"