refactor: Use ranges #780
This file contains 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) 2019 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: SonarCloud build | |
on: | |
pull_request: | |
branches: | |
- development | |
- master | |
push: | |
branches: | |
- development | |
- master | |
defaults: | |
run: | |
shell: sh | |
jobs: | |
sonarcloud-build: | |
name: SonarCloud build | |
runs-on: ubuntu-24.04 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: 11 | |
distribution: 'temurin' | |
- name: Requirements install | |
run: sudo apt-get update && sudo apt-get install ninja-build | |
- name: Configure | |
run: > | |
mkdir build && cd build && | |
cmake -DCMAKE_BUILD_TYPE=Debug | |
-DCMAKE_C_COMPILER=clang-18 | |
-DCMAKE_CXX_COMPILER=clang++-18 | |
-DCMAKE_CXX_FLAGS="-fprofile-instr-generate -fcoverage-mapping -mllvm -runtime-counter-relocation" | |
-DWITH_LIBCXX=Off | |
-DLANGUAGE_SERVER_BIN_SUBDIR=linux_x64 | |
../ | |
- name: Sonar build wrapper download | |
run: > | |
cd build && | |
curl -LsS https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip > build-wrapper-linux-x86.zip && | |
unzip build-wrapper-linux-x86.zip && | |
cp build-wrapper-linux-x86/* . | |
- name: Build | |
run: cd build && ./build-wrapper-linux-x86-64 --out-dir bw-output make -j 4 clean all | |
- name: Server Test | |
run: | | |
cd build/bin | |
LLVM_PROFILE_FILE="library.rawprof" ./library_test | |
LLVM_PROFILE_FILE="server.rawprof" ./server_test | |
LLVM_PROFILE_FILE="utils.rawprof" ./hlasm_utils_test | |
- name: Extension Test | |
run: cd clients/vscode-hlasmplugin && LLVM_PROFILE_FILE="%c$(pwd)/../../build/bin/language.rawprof" xvfb-run -a npx c8 --reporter=lcovonly --allowExternal --exclude='**/.vscode-test/**' --exclude='**/test/**' --exclude='**/build/**' npm test | |
- name: Merge raw profiles | |
run: cd build/bin && llvm-profdata-18 merge -o hlasm_profile language.rawprof library.rawprof server.rawprof utils.rawprof | |
- name: Generate lcov coverage | |
run: cd build/bin && llvm-cov-18 show -instr-profile hlasm_profile hlasm_language_server -object library_test -object server_test -object hlasm_utils_test > ../coverage.txt | |
- name: Pull request event info | |
if: github.event_name == 'pull_request' | |
run: | | |
mkdir pr-info | |
echo $(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") > pr-info/pr-number.txt | |
echo refs/pull/$(cat pr-info/pr-number.txt)/merge > pr-info/ref.txt | |
echo -Dsonar.pullrequest.key=$(jq --raw-output .pull_request.number "$GITHUB_EVENT_PATH") > pr-info/pr-number-arg.txt | |
echo -Dsonar.pullrequest.branch=${{ github.head_ref }} > pr-info/head-branch-arg.txt | |
- name: Push event info | |
if: github.event_name == 'push' | |
run: | | |
mkdir pr-info | |
echo ${{ github.event.ref }} > pr-info/ref.txt | |
echo -Dsonar.branch.name=${{ github.ref_name }} > pr-info/head-branch-arg.txt | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: bw-output | |
path: | | |
build/ | |
clients/vscode-hlasmplugin/coverage/lcov.info | |
pr-info/ | |
!build/bin/ | |
!build/build-wrapper* | |
!build/_deps/**/.git/ | |
!build/_deps/**/*.jar | |
!build/_deps/**/*.class | |
!build/lib/ | |
!build/**/CMakeFiles/ |