Daily Build #18
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: Daily Build | |
| on: | |
| schedule: | |
| - cron: '30 1 * * *' | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| packages: read | |
| jobs: | |
| # ───────────────────────────────────────────────────────────────────────── | |
| # Ballerina language server — multi-branch pack & test | |
| # ───────────────────────────────────────────────────────────────────────── | |
| ls-prepare-matrix: | |
| name: LS prepare matrix | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: packages/ballerina-language-server | |
| outputs: | |
| targets: ${{ steps.resolve-targets.outputs.targets }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Resolve target branches | |
| id: resolve-targets | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| latest_branch=$(git ls-remote --heads origin | awk -F'/' '/refs\/heads\/1\.[0-9]+\.x$/ { print $NF }' | sort -V | tail -n 1) | |
| if [ -z "${latest_branch}" ]; then | |
| echo "No 1.x.x release branch found on origin; building from main only." >&2 | |
| fi | |
| timestamp=$(date '+%Y%m%d-%H%M%S') | |
| targets='[]' | |
| branches="main" | |
| if [ -n "${latest_branch}" ]; then | |
| branches="main ${latest_branch}" | |
| fi | |
| for branch in ${branches}; do | |
| git fetch --depth=1 origin "${branch}:refs/remotes/origin/${branch}" | |
| branch_version=$(git show "origin/${branch}:packages/ballerina-language-server/gradle.properties" | awk -F= '$1 == "version" { gsub(/^[[:space:]]+|[[:space:]]+$/, "", $2); gsub(/\r/, "", $2); print $2; exit }') | |
| if [ -z "${branch_version}" ]; then | |
| echo "Unable to resolve version from gradle.properties for ${branch}" >&2 | |
| exit 1 | |
| fi | |
| build_version="${branch_version}-${timestamp}" | |
| targets=$(jq -c \ | |
| --arg branch "${branch}" \ | |
| --arg version "${build_version}" \ | |
| '. + [{branch: $branch, version: $version}]' <<< "${targets}") | |
| done | |
| echo "targets=${targets}" >> "${GITHUB_OUTPUT}" | |
| ls-ubuntu-pack: | |
| name: LS Ubuntu pack (${{ matrix.branch }}) | |
| needs: ls-prepare-matrix | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| concurrency: | |
| group: ls-ubuntu-pack-${{ matrix.branch }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| working-directory: packages/ballerina-language-server | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.ls-prepare-matrix.outputs.targets) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21.0.3 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4 | |
| - name: Set Up Ballerina | |
| uses: ballerina-platform/setup-ballerina@97fd67111e3c3ecdfafff96fc24d95ad909ab299 # v1.1.4 | |
| with: | |
| version: 2201.13.3 | |
| - name: Cache Ballerina dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: /home/runner/.ballerina/repositories/ | |
| key: ${{ runner.os }}-ballerina-${{ matrix.branch }}-${{ hashFiles('**/gradle.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ballerina-${{ matrix.branch }}- | |
| - name: Pack with Gradle | |
| env: | |
| packageUser: ${{ github.actor }} | |
| packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./gradlew -Pversion=${{ matrix.version }} pack -x check | |
| - name: Upload daily build jar | |
| uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 | |
| with: | |
| path: packages/ballerina-language-server/build/ballerina-language-server-${{ matrix.version }}.jar | |
| if-no-files-found: error | |
| ls-ubuntu-test: | |
| name: LS Ubuntu test (${{ matrix.branch }}) | |
| needs: | |
| - ls-prepare-matrix | |
| - ls-ubuntu-pack | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 60 | |
| concurrency: | |
| group: ls-ubuntu-test-${{ matrix.branch }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| working-directory: packages/ballerina-language-server | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.ls-prepare-matrix.outputs.targets) }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21.0.3 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4 | |
| - name: Set Up Ballerina | |
| uses: ballerina-platform/setup-ballerina@97fd67111e3c3ecdfafff96fc24d95ad909ab299 # v1.1.4 | |
| with: | |
| version: 2201.13.3 | |
| - name: Cache Ballerina dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: /home/runner/.ballerina/repositories/ | |
| key: ${{ runner.os }}-ballerina-${{ matrix.branch }}-${{ hashFiles('**/gradle.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ballerina-${{ matrix.branch }}- | |
| - name: Test with Gradle | |
| env: | |
| packageUser: ${{ github.actor }} | |
| packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./gradlew -Pversion=${{ matrix.version }} test | |
| ls-windows-build: | |
| name: LS Windows build (${{ matrix.branch }}) | |
| needs: ls-prepare-matrix | |
| runs-on: windows-latest | |
| timeout-minutes: 60 | |
| concurrency: | |
| group: ls-windows-build-${{ matrix.branch }}-${{ github.ref_name }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| working-directory: packages/ballerina-language-server | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.ls-prepare-matrix.outputs.targets) }} | |
| steps: | |
| - name: Enable long paths for Git | |
| shell: bash | |
| run: git config --system core.longpaths true | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21.0.3 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4 | |
| - name: Set Up Ballerina | |
| uses: ballerina-platform/setup-ballerina@97fd67111e3c3ecdfafff96fc24d95ad909ab299 # v1.1.4 | |
| with: | |
| version: 2201.13.3 | |
| - name: Cache Ballerina dependencies | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: C:\Users\runneradmin\.ballerina\repositories\ | |
| key: ${{ runner.os }}-ballerina-${{ matrix.branch }}-${{ hashFiles('**/gradle.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-ballerina-${{ matrix.branch }}- | |
| - name: Build with Gradle | |
| shell: cmd | |
| env: | |
| packageUser: ${{ github.actor }} | |
| packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./gradlew.bat -Pversion=${{ matrix.version }} build | |
| # ───────────────────────────────────────────────────────────────────────── | |
| # Language server — Trivy vulnerability scan | |
| # ───────────────────────────────────────────────────────────────────────── | |
| ls-trivy: | |
| name: LS Trivy scan (${{ matrix.branch }}) | |
| needs: ls-prepare-matrix | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: ${{ fromJson(needs.ls-prepare-matrix.outputs.targets) }} | |
| defaults: | |
| run: | |
| working-directory: packages/ballerina-language-server | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| ref: ${{ matrix.branch }} | |
| persist-credentials: false | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 21.0.3 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4 | |
| - name: Generate SBOM | |
| env: | |
| packageUser: ${{ github.actor }} | |
| packagePAT: ${{ secrets.GITHUB_TOKEN }} | |
| run: ./gradlew cyclonedxBom | |
| - name: Run Trivy vulnerability scanner | |
| uses: aquasecurity/trivy-action@57a97c7e7821a5776cebc9bb87c984fa69cba8f1 # 0.35.0 | |
| with: | |
| scan-type: 'sbom' | |
| scan-ref: 'packages/ballerina-language-server/build/sbom.json' | |
| format: 'table' | |
| timeout: '10m0s' | |
| exit-code: '1' | |
| # ───────────────────────────────────────────────────────────────────────── | |
| # Ballerina VSCode extension — build VSIX + tests | |
| # ───────────────────────────────────────────────────────────────────────── | |
| Build: | |
| name: Extension build | |
| uses: ./.github/workflows/build.yml | |
| secrets: inherit | |
| with: | |
| ballerina: true | |
| runTests: true | |
| runBalE2ETests: true | |
| # ───────────────────────────────────────────────────────────────────────── | |
| # Notifications | |
| # ───────────────────────────────────────────────────────────────────────── | |
| NotifySuccess: | |
| name: Notify (success) | |
| needs: | |
| - ls-ubuntu-pack | |
| - ls-ubuntu-test | |
| - ls-windows-build | |
| - ls-trivy | |
| - Build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Restore build | |
| uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4 | |
| with: | |
| name: ExtBuild | |
| path: ./ | |
| - name: Set up workspace | |
| run: | | |
| unzip build.zip | |
| rm build.zip | |
| - name: Notification - Ballerina | |
| uses: ./.github/actions/dailyBuildNotification | |
| with: | |
| title: Ballerina | |
| fileName: ballerina | |
| chatAPI: ${{ secrets.BI_TEAM_CHAT_API }} | |
| NotifyFailure: | |
| name: Notify (failure) | |
| needs: | |
| - ls-ubuntu-pack | |
| - ls-ubuntu-test | |
| - ls-windows-build | |
| - ls-trivy | |
| - Build | |
| if: ${{ always() && contains(needs.*.result, 'failure') && github.repository == 'wso2/ballerina-vscode' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 | |
| with: | |
| persist-credentials: false | |
| - name: "Failure Notification" | |
| uses: ./.github/actions/failure-notification | |
| with: | |
| title: "Daily Build Failed" | |
| run_id: ${{ github.run_id }} | |
| chat_api: ${{ secrets.EDITOR_TEAM_CHAT_API }} | |
| repository: ${{ github.repository }} |