| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you under the Apache License, Version 2.0 (the |
| # "License"); you may not use this file except in compliance |
| # with the License. You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, |
| # software distributed under the License is distributed on an |
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| # KIND, either express or implied. See the License for the |
| # specific language governing permissions and limitations |
| # under the License. |
| |
| # https://infra.apache.org/github-actions-policy.html |
| # actions: |
| # - github actions use the latest release within the locked major version |
| # - third party actions (geekyeggo/delete-artifact, test-summary/action and shivammathur/setup-ph) shall be locked to a hash |
| # - see https://github.com/apache/infrastructure-gha-allowlist-manager/blob/main/approved_patterns.yml |
| # - dependabot is active to keep them up to date |
| # |
| # this workflow can push the limit of the apache action runner policy, please use CI responsibly |
| |
| name: NetBeans VSCode |
| |
| on: |
| push: |
| branches: |
| - 'master' |
| - 'release*' |
| |
| pull_request: |
| # unlocked event is used as super secret restart button |
| types: [opened, synchronize, unlocked] |
| |
| # Allows you to run this workflow manually from the Actions tab in GitHub UI |
| # keep in mind this will have ALL tests enabled |
| workflow_dispatch: |
| |
| # cancel other PR workflow run in the same head-base group if it exists (e.g. during PR syncs) |
| # if this is not a PR run (no github.head_ref and github.base_ref defined), use an UID as group |
| concurrency: |
| group: ${{ github.head_ref || github.run_id }}-${{ github.base_ref }} |
| cancel-in-progress: true |
| |
| defaults: |
| run: |
| shell: bash |
| |
| env: |
| |
| # note to self: don't remove the minus again |
| OPTS: >- |
| -Dtest-unit-sys-prop.ignore.random.failures=true |
| |
| # what to build and test, see nbbuild/cluster.properties |
| CLUSTER_CONFIG: 'full' |
| |
| # default java distribution used by the setup-java action across jobs |
| # see https://github.com/actions/setup-java#supported-distributions |
| # CI requirements: |
| # - timely GA releases (no delays if possible) |
| # - EA builds must be available for the upcoming release (note: some vendors skip builds) |
| # - linux, win, mac (arm) |
| # - reliable / no extra sauce |
| DEFAULT_JAVA_DISTRIBUTION: 'temurin' |
| |
| # labels are mapped to env vars for pipeline customization. If this is not a PR, (almost) everything will run, but with a reduced matrix. |
| # note: env vars don't work in the job's 'if' field but do work within jobs ( https://github.com/actions/runner/issues/1189 ), the whole expression must be duplicated |
| |
| # labels for special commands: |
| # 'ci:all-tests' enables everything |
| # 'ci:no-build' disables the build job (and test jobs too) |
| # 'ci:dev-build' produces an artifact containing a runnable NetBeans zip distribution |
| |
| # 'VSCode Extension' label for building and testing the VSCode Extension |
| test_vscode_extension: ${{ contains(github.event.pull_request.labels.*.name, 'VSCode Extension') || contains(github.event.pull_request.labels.*.name, 'ci:all-tests') || github.event_name != 'pull_request' }} |
| |
| |
| jobs: |
| |
| # primary build job, most other jobs use the artifact produced here |
| # artifact is only produced once in the matrix |
| base-build: |
| name: Build VSCode on JDK ${{ matrix.java }} |
| if: contains(github.event.pull_request.labels.*.name, 'ci:no-build') == false |
| runs-on: ubuntu-latest |
| timeout-minutes: 40 |
| strategy: |
| matrix: |
| java: [ '17', '21' ] |
| exclude: |
| - java: ${{ github.event_name == 'pull_request' && 'nothing' || '21' }} |
| fail-fast: false |
| steps: |
| |
| - name: Set up JDK ${{ matrix.java }} |
| uses: actions/setup-java@v5 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: ${{ env.DEFAULT_JAVA_DISTRIBUTION }} |
| |
| - name: Checkout ${{ github.ref }} ( ${{ github.sha }} ) |
| uses: actions/checkout@v4 |
| with: |
| persist-credentials: false |
| submodules: true |
| show-progress: false |
| |
| - name: Caching dependencies |
| uses: actions/cache@v4 |
| with: |
| path: ~/.hgexternalcache |
| key: ${{ runner.os }}-${{ hashFiles('netbeans/*/external/binaries-list', 'netbeans/*/*/external/binaries-list') }} |
| restore-keys: ${{ runner.os }}- |
| |
| - name: Build NetBeans |
| run: ant $OPTS -quiet -Dcluster.config=$CLUSTER_CONFIG build-netbeans |
| |
| - name: Prepare Artifact |
| if: ${{ matrix.java == '17' }} |
| run: tar -I 'zstd -9 -T0' -cf /tmp/build.tar.zst --exclude ".git" . |
| |
| - name: Upload Workspace |
| if: ${{ (matrix.java == '17') && success() }} |
| uses: actions/upload-artifact@v4 |
| with: |
| name: build |
| path: /tmp/build.tar.zst |
| compression-level: 0 |
| retention-days: 2 |
| if-no-files-found: error |
| |
| - name: Create Dev Build |
| if: ${{ matrix.java == '17' && contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && success() }} |
| run: ant $OPTS -quiet -Dcluster.config=$CLUSTER_CONFIG zip-cluster-config |
| |
| - name: Upload Dev Build |
| if: ${{ matrix.java == '17' && contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && success() }} |
| uses: actions/upload-artifact@v4 |
| with: |
| name: dev-build_${{github.event.pull_request.number || github.run_id}} |
| path: nbbuild/NetBeans-*.zip |
| compression-level: 0 |
| retention-days: 7 |
| if-no-files-found: error |
| |
| |
| build-from-src-zip: |
| name: Build ${{ matrix.config }} from src.zip on JDK ${{ matrix.java }} |
| # equals env.test_platform == 'true' || test_vscode_extension == 'true' |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'Platform') || contains(github.event.pull_request.labels.*.name, 'VSCode Extension') || contains(github.event.pull_request.labels.*.name, 'ci:all-tests') || github.event_name != 'pull_request' }} |
| needs: base-build |
| runs-on: ubuntu-latest |
| timeout-minutes: 60 |
| strategy: |
| matrix: |
| java: [ '17' ] |
| config: [ 'release' ] |
| fail-fast: false |
| steps: |
| |
| - name: Set up JDK ${{ matrix.java }} |
| uses: actions/setup-java@v5 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: ${{ env.DEFAULT_JAVA_DISTRIBUTION }} |
| |
| - name: Download Build |
| uses: actions/download-artifact@v4 |
| with: |
| name: build |
| |
| - name: Extract |
| run: tar --zstd -xf build.tar.zst |
| |
| - name: Restoring Cache |
| uses: actions/cache/restore@v4 |
| with: |
| path: ~/.hgexternalcache |
| key: ${{ runner.os }}-${{ hashFiles('netbeans/*/external/binaries-list', 'netbeans/*/*/external/binaries-list') }} |
| restore-keys: ${{ runner.os }}- |
| |
| - name: Create ${{ matrix.config }}-src zip |
| run: ant $OPTS -quiet build-source-config -Dcluster.config=${{ matrix.config }} -Dmetabuild.branch=master -Dmetabuild.jsonurl=https://raw.githubusercontent.com/apache/netbeans-jenkins-lib/refs/heads/master/meta/netbeansvscode.json -Dmetabuild.RawVersion=dev |
| |
| - name: Extract ${{ matrix.config }}-src zip |
| run: | |
| mkdir tmpbuild && cd tmpbuild |
| unzip -qq ../build/${{ matrix.config }}-src* |
| |
| - name: Build from ${{ matrix.config }}-src zip |
| run: | |
| cd tmpbuild |
| ant $OPTS -quiet build-netbeans -Dcluster.config=${{ matrix.config }} |
| |
| # extra round for VSCodeExt which is built with 'release' config |
| - name: Set up node |
| if: ${{ (matrix.config == 'release') && success() }} |
| uses: actions/setup-node@v4 |
| with: |
| node-version: 20.18.1 |
| |
| - name: Build NBVSCodeExt from ${{ matrix.config }}-src zip |
| if: ${{ (matrix.config == 'release') && success() }} |
| run: | |
| cd tmpbuild |
| ant $OPTS -quiet build-vscode-ext -D3rdparty.modules=none |
| |
| |
| vscode-extension-test: |
| name: VSCode Extension Tests on JDK ${{ matrix.java }} |
| # equals env.test_vscode_extension == 'true' |
| # if: ${{ contains(github.event.pull_request.labels.*.name, 'VSCode Extension') || contains(github.event.pull_request.labels.*.name, 'ci:all-tests') || github.event_name != 'pull_request' }} |
| needs: base-build |
| runs-on: ubuntu-latest |
| timeout-minutes: 60 |
| strategy: |
| matrix: |
| java: [ '17' ] |
| fail-fast: false |
| |
| steps: |
| - name: Set up JDK ${{ matrix.java }} |
| uses: actions/setup-java@v5 |
| with: |
| java-version: ${{ matrix.java }} |
| distribution: ${{ env.DEFAULT_JAVA_DISTRIBUTION }} |
| |
| - name: Set up node |
| uses: actions/setup-node@v4 |
| with: |
| node-version: 20.18.1 |
| |
| - name: Setup Xvfb |
| run: | |
| echo "DISPLAY=:99.0" >> $GITHUB_ENV |
| Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & |
| |
| - name: Download Build |
| uses: actions/download-artifact@v4 |
| with: |
| name: build |
| |
| - name: Extract |
| run: tar --zstd -xf build.tar.zst |
| |
| - name: build-vscode-ext |
| run: | |
| ant $OPTS build-vscode-ext |
| |
| - name: test-vscode-ext |
| run: | |
| env "netbeans.extra.options=-J-Dnetbeans.logger.console=true" ant $OPTS test-vscode-ext |
| |
| |
| # cleanup job depends on everything so that it is forced to run last even if a long job fails early. |
| # 'paperwork' is left out intentionally, since it doesn't run unit tests (hopefully doesn't need restarts) |
| # and shouldn't prevent cleanup on validation failure - which might be common during dev time |
| cleanup: |
| name: Cleanup Workflow Artifacts |
| needs: |
| - base-build |
| - build-from-src-zip |
| - vscode-extension-test |
| |
| # cleanup if the primary build job succeeded and |
| # * nothing else failed (allows manual restarts) |
| # * the workflow got cancelled |
| if: ${{ always() && needs.base-build.result == 'success' && (!contains(needs.*.result, 'failure') || cancelled()) }} |
| runs-on: ubuntu-latest |
| timeout-minutes: 60 |
| steps: |
| |
| - name: Delete Workspace Artifact |
| uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 |
| with: |
| name: build |
| useGlob: false |
| |
| - name: Delete Dev Build Artifact |
| uses: geekyeggo/delete-artifact@f275313e70c08f6120db482d7a6b98377786765b # v5.1.0 |
| if: ${{ contains(github.event.pull_request.labels.*.name, 'ci:dev-build') && cancelled() }} |
| with: |
| name: dev-build_${{github.event.pull_request.number || github.run_id}} |
| useGlob: false |