GraalVM Check #36
This file contains hidden or 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: GraalVM Check | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| lang_tag: | |
| description: Branch/Release Tag of the Ballerina Lang | |
| required: true | |
| default: master | |
| lang_version: | |
| description: Ballerina Lang Version (If given ballerina lang build will be skipped) | |
| required: false | |
| default: '' | |
| native_image_options: | |
| description: Default native-image options | |
| required: false | |
| default: '' | |
| schedule: | |
| - cron: '30 18 * * *' | |
| pull_request: | |
| branches: | |
| - main | |
| types: [opened, synchronize, reopened, labeled, unlabeled] | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| ubuntu-build-with-bal-test-graalvm: | |
| name: Build with bal test graalvm on Ubuntu | |
| runs-on: ubuntu-22.04 | |
| if: (github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'wso2')) && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'Skip GraalVM Check')) | |
| steps: | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Checkout Ballerina Lang Repository | |
| if: ${{ github.event.inputs.lang_version == '' && github.event_name != 'pull_request' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'ballerina-platform/ballerina-lang' | |
| ref: ${{ github.event.inputs.lang_tag || 'master' }} | |
| - name: Set Ballerina Lang version | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| if ${{ github.event.inputs.lang_version != '' }}; then | |
| LANG_VERSION=${{ github.event.inputs.lang_version }} | |
| else | |
| VERSION=$(grep -w 'version' gradle.properties | cut -d= -f2 | sed -E 's/-(SNAPSHOT|[0-9]{8}-[0-9]{6}-[a-z0-9]+)$//') | |
| LANG_VERSION=$VERSION-NATIVE | |
| fi | |
| echo "BALLERINA_LANG_VERSION=$LANG_VERSION" >> $GITHUB_ENV | |
| echo "BALLERINA_LANG_VERSION: $LANG_VERSION" | |
| - name: Build Ballerina Lang | |
| if: ${{ github.event.inputs.lang_version == '' && github.event_name != 'pull_request' }} | |
| run: | | |
| perl -pi -e "s/^\s*version=.*/version=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties | |
| ./gradlew build -x test publishToMavenLocal --scan --no-daemon | |
| - name: Set up GraalVM | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: '21' | |
| distribution: 'graalvm-community' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| set-java-home: 'false' | |
| - name: Check GraalVM installation | |
| run: | | |
| echo "GRAALVM_HOME: ${{ env.GRAALVM_HOME }}" | |
| echo "JAVA_HOME: ${{ env.JAVA_HOME }}" | |
| native-image --version | |
| - name: Checkout Module Repository | |
| uses: actions/checkout@v4 | |
| - name: Set default native-image options | |
| if: ${{ github.event.inputs.native_image_options != '' }} | |
| run: | | |
| CURRENT_DIR=$(pwd) | |
| echo "NativeImageArgs = -J-Xmx7G ${{ github.event.inputs.native_image_options }}" > default_native.properties | |
| echo "NATIVE_IMAGE_CONFIG_FILE=$CURRENT_DIR/default_native.properties" >> $GITHUB_ENV | |
| echo "NATIVE_IMAGE_CONFIG_FILE: $CURRENT_DIR/default_native.properties" | |
| - name: Build with Gradle | |
| env: | |
| packageUser: ${{ github.actor }} | |
| packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
| CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
| CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
| REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | |
| run: | | |
| if ${{ github.event_name != 'pull_request' }}; then | |
| perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties | |
| fi | |
| ./gradlew build -PbalGraalVMTest | |
| windows-build-with-bal-test-graalvm: | |
| name: Build with bal test graalvm on Windows | |
| runs-on: windows-latest | |
| if: (github.event_name != 'schedule' || (github.event_name == 'schedule' && github.repository_owner == 'wso2')) && (github.event_name != 'pull_request' || !contains(github.event.pull_request.labels.*.name, 'Skip GraalVM Check')) | |
| steps: | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '21' | |
| - name: Git configure long path | |
| run: | | |
| git config --global core.longpaths true | |
| - name: Checkout Ballerina Lang Repository | |
| if: ${{ github.event.inputs.lang_version == '' && github.event_name != 'pull_request' }} | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: 'ballerina-platform/ballerina-lang' | |
| ref: ${{ github.event.inputs.lang_tag || 'master' }} | |
| - name: Set Ballerina Lang version | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: | | |
| if ("${{ github.event.inputs.lang_version }}" -eq "") { | |
| $properties = convertfrom-stringdata (get-content ./gradle.properties -raw) | |
| $LANG_VERSION = $properties.'version'.split("-",2)[0] + "-NATIVE" | |
| } else { | |
| $LANG_VERSION = "${{ github.event.inputs.lang_version }}" | |
| } | |
| "BALLERINA_LANG_VERSION=$LANG_VERSION" >> $env:GITHUB_ENV | |
| Write-Output "BALLERINA_LANG_VERSION: $LANG_VERSION" | |
| - name: Configure Pagefile | |
| if: ${{ github.event_name != 'pull_request' }} | |
| uses: al-cheb/configure-pagefile-action@v1.3 | |
| with: | |
| minimum-size: 10GB | |
| maximum-size: 16GB | |
| - name: Get configured pagefile base size | |
| if: ${{ github.event_name != 'pull_request' }} | |
| run: (Get-CimInstance Win32_PageFileUsage).AllocatedBaseSize | |
| - name: Build Ballerina Lang | |
| if: ${{ github.event.inputs.lang_version == '' && github.event_name != 'pull_request' }} | |
| run: | | |
| perl -pi -e "s/^\s*version=.*/version=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties | |
| ./gradlew.bat build -x test publishToMavenLocal --continue -x javadoc --stacktrace -scan --console=plain --no-daemon --no-parallel | |
| - name: Set up GraalVM | |
| uses: graalvm/setup-graalvm@v1 | |
| with: | |
| java-version: '21' | |
| distribution: 'graalvm-community' | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| set-java-home: 'false' | |
| - name: Check GraalVM installation | |
| run: | | |
| Write-Output GRAALVM_HOME: "${{ env.GRAALVM_HOME }}" | |
| Write-Output JAVA_HOME: "${{ env.JAVA_HOME }}" | |
| native-image --version | |
| git config --system core.longpaths true | |
| - name: Checkout Module Repository | |
| uses: actions/checkout@v4 | |
| - name: Set default native-image options | |
| if: ${{ github.event.inputs.native_image_options != '' }} | |
| run: | | |
| $CURRENT_DIR = (Get-Location).tostring() | |
| $DEFAULT_PROPS = $CURRENT_DIR + "\" + "default_native.properties" | |
| $create_file = New-Item $DEFAULT_PROPS | |
| Set-Content $DEFAULT_PROPS "NativeImageArgs = -J-Xmx7G ${{ github.event.inputs.native_image_options }}" | |
| "NATIVE_IMAGE_CONFIG_FILE=$DEFAULT_PROPS" >> $env:GITHUB_ENV | |
| Write-Output "NATIVE_IMAGE_CONFIG_FILE: $DEFAULT_PROPS" | |
| - name: Build with Gradle | |
| env: | |
| packageUser: ${{ github.actor }} | |
| packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
| CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
| CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
| REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }} | |
| run: | | |
| if ("${{ github.event_name }}" -ne "pull_request") { | |
| perl -pi -e "s/^\s*ballerinaLangVersion=.*/ballerinaLangVersion=${{ env.BALLERINA_LANG_VERSION }}/" gradle.properties | |
| } | |
| ./gradlew.bat build -PbalGraalVMTest -x test |