feat: Code snipppets D-F (#2794) #331
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
# Copyright (c) 2023 Broadcom. | |
# The term "Broadcom" refers to Broadcom Inc. and/or its subsidiaries. | |
# | |
# This program and the accompanying materials are made | |
# available under the terms of the Eclipse Public License 2.0 | |
# which is available at https://www.eclipse.org/legal/epl-2.0/ | |
# | |
# SPDX-License-Identifier: EPL-2.0 | |
# | |
# Contributors: | |
# Broadcom, Inc. - initial API and implementation | |
name: build | |
env: | |
graalvm-version: '21' | |
on: | |
workflow_dispatch: | |
inputs: | |
skip_ui_tests: | |
description: "Skip UI tests" | |
required: true | |
default: 'false' | |
include_build_number: | |
description: "Include build number" | |
required: false | |
default: 'true' | |
pull_request: | |
branches: | |
- development | |
- master | |
push: | |
branches: | |
- development | |
- master | |
jobs: | |
checks: | |
name: Checks | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies for COBOL LS | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: npm ci | |
- name: Install & Build Analysis Package | |
working-directory: clients/analysis | |
run: | | |
npm ci | |
npm run compile | |
- name: Install & Build VS Code extension dialect API | |
working-directory: clients/cobol-dialect-api | |
run: | | |
npm ci | |
npm run compile | |
- name: Check code formatting for COBOL LS | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: npm run lint-format | |
- name: Check code quality for COBOL LS | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: npm run lint-quality | |
checks-server: | |
name: Checks server | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: axel-op/googlejavaformat-action@v4 | |
with: | |
args: "-i" | |
skip-commit: true | |
- name: Print diffs | |
run: git --no-pager diff --exit-code | |
zipSources: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install dependencies for COBOL LS Analysis module | |
working-directory: clients/analysis | |
run: NODE_ENV=production npm ci | |
- name: Install dependencies for COBOL LS API | |
working-directory: clients/cobol-dialect-api | |
run: NODE_ENV=production npm ci | |
- name: Install dependencies for COBOL LS | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: NODE_ENV=production npm ci | |
- name: Install dependencies for IDMS dialect | |
working-directory: clients/idms-dialect-support | |
run: NODE_ENV=production npm ci | |
- name: Install dependencies for DaCo dialect | |
working-directory: clients/daco-dialect-support | |
run: NODE_ENV=production npm ci | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: clients-for-bd-scan | |
path: clients/** | |
if-no-files-found: error | |
generateNativeConfig: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: ${{ env.graalvm-version }} | |
components: 'native-image' | |
distribution: 'graalvm-community' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
## uncomment me if you need native image job reports | |
# native-image-job-reports: 'true' | |
cache: 'maven' | |
- name: Generate assisted configuration for GraalVM native build | |
working-directory: server | |
run: mvn -e -B -Pnative -DskipNativeTests -Dagent=true -Dtest=\!PositiveTest -Dsurefire.failIfNoSpecifiedTests=false test | |
- name: Upload native build configuration | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: native-build-configuration | |
path: server/engine/target/native/agent-output/test/* | |
buildPlatformIndependedPart: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
cache: 'maven' | |
- name: Build Server and Dialects Jars | |
working-directory: server | |
run: mvn clean verify --no-transfer-progress | |
- name: Upload performance data | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: test-perfomance-data | |
path: server/engine/target/perf.csv | |
- name: Upload jar files | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jar | |
path: server/engine/target/server.jar | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Build Cobol Analysis Package Library | |
working-directory: clients/analysis | |
run: | | |
npm ci | |
npm run compile | |
- name: Upload Cobol Analysis Package Library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: analysis_lib | |
path: clients/analysis/* | |
- name: Build VS Code extension dialect API | |
working-directory: clients/cobol-dialect-api | |
run: | | |
npm ci | |
npm run compile | |
- name: Upload cobol dialect API library | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib | |
path: clients/cobol-dialect-api/lib/* | |
- name: Unit Test COBOL LS Analysis package | |
working-directory: clients/analysis | |
run: | | |
npm ci | |
npm run test | |
- name: Unit Test COBOL LS extension | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: | | |
npm ci | |
npm run test | |
- name: Package default COBOL LS vsix | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: | | |
npm ci | |
cp ../../server/engine/target/server.jar ./server/jar | |
npm run package | |
cp *.vsix ../../. | |
- name: Package IDMS vsix | |
working-directory: clients/idms-dialect-support | |
run: | | |
npm ci | |
cp ../../server/dialect-idms/target/dialect-idms.jar ./server/jar | |
npm run package | |
cp *.vsix ../../. | |
- name: Package DaCo vsix | |
working-directory: clients/daco-dialect-support | |
run: | | |
npm ci | |
cp ../../server/dialect-daco/target/dialect-daco.jar ./server/jar | |
npm run package | |
cp *.vsix ../../. | |
- name: Upload IDMS vsix | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: vsix-idms-dialect | |
path: 'cobol-language-support-for-idms*.vsix' | |
- name: Upload DaCo vsix | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: vsix-daco-dialect | |
path: 'cobol-language-support-for-daco*.vsix' | |
- name: Upload COBOL LS default vsix | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: vsix-cobol-ls-default | |
path: | | |
cobol-language-support-*.vsix | |
!cobol-language-support-for-*.vsix | |
- name: Run COBOL LS extension integration tests | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: | | |
cp ../../server/engine/target/server.jar ./server/jar | |
npm run build | |
xvfb-run -a npm exec c8 -- --reporter=lcovonly --allowExternal --exclude="**/test/**" --exclude=".vscode-test/**" --exclude=".vscode-test-web/**" -- npm run test:integration | |
- name: SonarCloud Scan | |
if: github.ref == 'refs/heads/development' | |
uses: sonarsource/sonarcloud-github-action@49e6cd3b187936a73b8280d59ffd9da69df63ec9 | |
env: | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
buildWeb: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Compile COBOL LS Analysis package | |
working-directory: clients/analysis | |
run: | | |
npm ci | |
npm run compile | |
- name: Unit Test COBOL LS Web extension | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: | | |
npm ci | |
npm run test:web | |
- name: Package COBOL LS vsix for Web | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: | | |
npm ci | |
npm run package:web | |
cp *.vsix ../../. | |
- name: Upload Web vsix | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: vsix-cobol-language-support-web | |
path: 'cobol-language-support-web*.vsix' | |
buildNative: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
arch: [x64, arm64] | |
include: | |
- os: ubuntu-latest | |
arch: x64 | |
container: alpine:3.17 | |
- os: macos-13 | |
arch: x64 | |
- os: macos-14 | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
needs: [generateNativeConfig] | |
steps: | |
# Generate environment variable | |
- shell: pwsh | |
if: matrix.os == 'windows-latest' | |
run: echo "target=win32-${{ matrix.arch }}" >> $env:GITHUB_ENV | |
- shell: sh | |
if: startsWith( matrix.os, 'macos') | |
run: echo "target=darwin-${{ matrix.arch }}" >> $GITHUB_ENV | |
- shell: sh | |
if: matrix.os == 'ubuntu-latest' | |
run: echo "target=linux-${{ matrix.arch }}" >> $GITHUB_ENV | |
# Setup envierment | |
# - name: switch xcode to 12.5.1 | |
# if: matrix.os == 'macos-11' | |
# run: | | |
# sudo xcode-select -s /Applications/Xcode_12.5.1.app/Contents/Developer | |
# xcodebuild -version | |
- uses: al-cheb/[email protected] | |
if: matrix.os == 'windows-latest' | |
with: | |
minimum-size: 16GB | |
maximum-size: 16GB | |
disk-root: "C:" | |
- uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64' | |
with: | |
java-version: ${{ env.graalvm-version }} | |
distribution: 'graalvm-community' | |
native-image-musl: 'true' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
## uncomment me if you need native image job reports | |
# native-image-job-reports: 'true' | |
cache: 'maven' | |
- uses: graalvm/setup-graalvm@v1 | |
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'x64' | |
with: | |
java-version: ${{ env.graalvm-version }} | |
distribution: 'graalvm-community' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
## uncomment me if you need native image job reports | |
# native-image-job-reports: 'true' | |
cache: 'maven' | |
- uses: ilammy/msvc-dev-cmd@v1 | |
if: matrix.os == 'windows-latest' | |
- name: Retrieve native build configurations | |
uses: actions/download-artifact@v4 | |
with: | |
name: native-build-configuration | |
path: native-build-configuration | |
- name: Verify musl setup | |
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64' | |
run: ./.github/scripts/verify_musl_setup.sh | |
shell: bash {0} | |
- name: Add graalVM configuration to server | |
run: | | |
cp -rp native-build-configuration/session-* server/engine/src/main/resources/META-INF/native-image/ | |
rm server/engine/src/main/resources/META-INF/native-image/session-*/jni-config.json | |
shell: bash | |
- name: Build with Maven | |
working-directory: server | |
if: matrix.os != 'ubuntu-latest' || matrix.arch != 'x64' | |
run: mvn -e -B -Pnative -DskipTests clean package | |
- name: Build with Maven for Linux | |
if: matrix.os == 'ubuntu-latest' && matrix.arch == 'x64' | |
working-directory: server | |
run: mvn -e -B -Plinux-native -DskipTests clean package | |
- name: Prepare windows artifacts | |
if: matrix.os == 'windows-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: staging-${{ env.target }} | |
path: | | |
server/engine/target/*.exe | |
server/engine/target/*.dll | |
server/engine/target/*.txt | |
if-no-files-found: error | |
- name: Prepare non-windows artifacts | |
if: matrix.os != 'windows-latest' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: staging-${{ env.target }} | |
path: server/engine/target/engine | |
if-no-files-found: error | |
packageNative: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest] | |
arch: [x64, arm64] | |
include: | |
- os: ubuntu-latest | |
arch: x64 | |
container: alpine:3.17 | |
- os: macos-13 | |
arch: x64 | |
- os: macos-14 | |
arch: arm64 | |
runs-on: ${{ matrix.os }} | |
needs: [buildNative,buildPlatformIndependedPart] | |
steps: | |
# Generate environment variable | |
- shell: pwsh | |
if: matrix.os == 'windows-latest' | |
run: echo "target=win32-${{ matrix.arch }}" >> $env:GITHUB_ENV | |
- shell: sh | |
if: startsWith( matrix.os, 'macos') | |
run: echo "target=darwin-${{ matrix.arch }}" >> $GITHUB_ENV | |
- shell: sh | |
if: matrix.os == 'ubuntu-latest' | |
run: echo "target=linux-${{ matrix.arch }}" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Retrieve native build | |
uses: actions/download-artifact@v4 | |
with: | |
name: staging-${{ env.target }} | |
path: staging/${{ env.target }} | |
- name: Retrieve server jars | |
uses: actions/download-artifact@v4 | |
with: | |
name: jar | |
path: jar | |
- name: Deploy server jar | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: cp ../../jar/server.jar ./server/jar | |
- name: Deploy windows executable | |
working-directory: clients/cobol-lsp-vscode-extension | |
if: startsWith( matrix.os, 'windows') | |
run: | | |
cp ../../staging/${{ env.target }}/engine.exe ./server/native | |
cp ./server/native/* ../../tests/native-executable-tests/server/windows/ | |
- name: Deploy macos executable | |
working-directory: clients/cobol-lsp-vscode-extension | |
if: startsWith( matrix.os, 'mac') | |
run: | | |
cp -p ../../staging/${{ env.target }}/engine ./server/native/server-mac | |
chmod +x ./server/native/server-mac | |
cp ./server/native/server-mac ../../tests/native-executable-tests/server/mac/ | |
- name: Deploy linux executable | |
working-directory: clients/cobol-lsp-vscode-extension | |
if: startsWith( matrix.os, 'ubuntu') | |
run: | | |
cp -p ../../staging/${{ env.target }}/engine ./server/native/server-linux | |
chmod +x ./server/native/server-linux | |
cp ./server/native/server-linux ../../tests/native-executable-tests/server/linux/ | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Download VS Code Analysis package | |
uses: actions/download-artifact@v4 | |
with: | |
name: analysis_lib | |
path: clients/analysis | |
- name: Download VS Code extension dialect API | |
uses: actions/download-artifact@v4 | |
with: | |
name: lib | |
path: clients/cobol-dialect-api | |
- name: update version with PR or build number | |
if: github.event_name == 'pull_request' || github.event.inputs.include_build_number == 'true' | |
working-directory: clients/cobol-lsp-vscode-extension | |
env: | |
BUILD_ID: ${{github.event_name == 'pull_request' && format('pr-{0}', github.event.pull_request.number) || github.run_number }} | |
run: | | |
node -e "const fs=require('fs');const fileName='./package.json';var content=require(fileName);content.version=content.version+'\+'+'${{ env.BUILD_ID }}';fs.writeFileSync(fileName,JSON.stringify(content,null,2));" | |
- name: Build COBOL LS extension | |
run: npm ci | |
working-directory: clients/cobol-lsp-vscode-extension | |
- name: Package COBOL LS vsix for ${{ env.target }} | |
working-directory: clients/cobol-lsp-vscode-extension | |
run: | | |
npm run package -- --target ${{ env.target }} | |
cp *.vsix ../../. | |
- uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: warn | |
name: vsix-cobol-language-support-${{ env.target }} | |
path: 'cobol-language-support*.vsix' | |
- name: Retrieve idms dialect | |
uses: actions/download-artifact@v4 | |
with: | |
name: vsix-idms-dialect | |
path: dialects-idms | |
- name: Restore idms jar and dist folder | |
run: | | |
unzip -j dialects-idms/*.vsix extension/dist/extension.js extension/dist/extension.js.map -d clients/idms-dialect-support/dist/ | |
unzip -j dialects-idms/*.vsix extension/server/jar/dialect-idms.jar -d clients/idms-dialect-support/server/jar | |
shell: bash | |
- name: Retrieve daco dialect | |
uses: actions/download-artifact@v4 | |
with: | |
name: vsix-daco-dialect | |
path: dialects-daco | |
- name: Restore daco jar and dist folder | |
run: | | |
unzip -j dialects-daco/*.vsix extension/dist/extension.js extension/dist/extension.js.map -d clients/daco-dialect-support/dist/ | |
unzip -j dialects-daco/*.vsix extension/server/jar/dialect-daco.jar -d clients/daco-dialect-support/server/jar | |
shell: bash | |
- name: Run extension unit tests | |
run: npm run test | |
working-directory: clients/cobol-lsp-vscode-extension | |
- name: Run integration tests | |
if: github.event.inputs.skip_ui_tests != 'true' | |
run: ${{ matrix.os == 'ubuntu-latest' && 'xvfb-run' || '' }} npm run test:integration -- --native | |
working-directory: clients/cobol-lsp-vscode-extension | |
- name: Run native executable test code | |
working-directory: tests/native-executable-tests | |
run: | | |
npm ci | |
npm run test |