Skip to content

Commit 99222e0

Browse files
author
automatic-merge
committed
Merge remote branch 'origin/master' into edge
2 parents 0ee6991 + 826f551 commit 99222e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+602
-213
lines changed

.gitlab-ci.plan

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ def test_als_(qualifier={}):
1111
anod_test("als")
1212

1313

14+
def test_als_cov_(qualifier={}):
15+
with defaults(qualifier=qualifier | {"coverage": True}):
16+
# We don't install 'als' because in coverage mode, 'als' can't be installed and
17+
# has to be built instead.
18+
anod_test("als")
19+
20+
1421
def test_vscode_extension_(qualifier={}):
1522
with defaults(qualifier=qualifier):
1623
# Install the component built in the preceding CI build job
1724
anod_install("vscode-extension")
18-
anod_test("vscode-extension")
25+
anod_test("vscode-extension", qualifier=qualifier | {"coverage": True})
1926

2027

2128
def build_test_gs_(qualifier={}):
@@ -39,6 +46,10 @@ def test_als_edge():
3946
test_als_(edge_qualifier)
4047

4148

49+
def test_als_cov_edge():
50+
test_als_cov_(edge_qualifier)
51+
52+
4253
def test_vscode_extension_edge():
4354
test_vscode_extension_(edge_qualifier)
4455

.gitlab-ci.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ include:
2323
anod-args: run test_als_$ACI_TRACK
2424
image: systemgtk
2525

26+
# Testing of the ALS with coverage
27+
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
28+
inputs:
29+
job-name: als-cov
30+
anod-args: run test_als_cov_$ACI_TRACK
31+
image: systemgtk
32+
# This job needs to rebuild ALS in coverage mode, so it doesn't need to
33+
# depend on the build job. The following will get it to run in parallel
34+
# with the build job.
35+
needs: []
36+
stage: build
37+
2638
# Testing of the VSCode extension
2739
- component: $CI_SERVER_FQDN/eng/gitlab-templates/test@~latest
2840
inputs:
@@ -57,3 +69,104 @@ include:
5769
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
5870
when: manual
5971
allow_failure: true
72+
73+
als-cov:
74+
after_script:
75+
# Source the env prepared by generic_anod_ci
76+
- cat /tmp/ci_env.sh
77+
- . /tmp/ci_env.sh
78+
79+
- ALS_BUILD_SPACE=$(anod info test als $ACI_TRACK_QUALIFIER -Q coverage --show working_dir)
80+
- RESULTS_DIR=$ALS_BUILD_SPACE/results/new
81+
82+
# Include Anod logs
83+
- cp -rv $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
84+
85+
# Include coverage report
86+
- mkdir -v $CI_PROJECT_DIR/coverage
87+
88+
# save coverage results
89+
- cp -v $RESULTS_DIR/coverage-cobertura/cobertura.xml $CI_PROJECT_DIR/coverage
90+
- cp -vr $RESULTS_DIR/coverage-dhtml $CI_PROJECT_DIR/coverage/dhtml
91+
92+
# export to gitlab pages
93+
- |
94+
if [[ $CI_PIPELINE_SOURCE = "merge_request_event" ]]; then
95+
target_subdir=MRs/$CI_MERGE_REQUEST_IID
96+
else
97+
target_subdir=$CI_COMMIT_BRANCH
98+
fi
99+
100+
- target_subdir=$target_subdir/ada-coverage
101+
- publish-pages $CI_PROJECT_DIR/coverage/dhtml/ --target-subdir $target_subdir --expires 30
102+
- >
103+
echo "Coverage report: https://pages.gitlab.adacore-it.com/$CI_PROJECT_PATH/$target_subdir/index.html"
104+
105+
# display coverage stats for global reporting
106+
- echo_coverage_stats --coverage-file $RESULTS_DIR/coverage-xml/index.xml
107+
coverage: '/^Stmt Coverage:\s+(\d+\.\d+\%) \(\d+ \/ \d+\)$/'
108+
artifacts:
109+
when: always # Upload on errors too
110+
reports:
111+
junit: xunit-*.xml
112+
coverage_report:
113+
coverage_format: cobertura
114+
path: coverage/cobertura.xml
115+
paths:
116+
- anod-logs/
117+
# Also archive the report file for debugging the CI integration
118+
- coverage/cobertura.xml
119+
120+
vscode-extension:
121+
after_script:
122+
# Source the env prepared by generic_anod_ci
123+
- cat /tmp/ci_env.sh
124+
- . /tmp/ci_env.sh
125+
126+
- VSCODE_BUILD_SPACE=$(anod info test vscode-extension -Q coverage $ACI_TRACK_QUALIFIER --show working_dir)
127+
128+
# Include Anod logs
129+
- cp -rv $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
130+
131+
# Copy coverage reports
132+
- cp -rv $VSCODE_BUILD_SPACE/test/integration/vscode/ada/coverage $CI_PROJECT_DIR
133+
134+
# export to gitlab pages
135+
- |
136+
if [[ $CI_PIPELINE_SOURCE = "merge_request_event" ]]; then
137+
target_subdir=MRs/$CI_MERGE_REQUEST_IID
138+
else
139+
target_subdir=$CI_COMMIT_BRANCH
140+
fi
141+
- target_subdir=$target_subdir/ts-coverage
142+
- publish-pages $CI_PROJECT_DIR/coverage/ --target-subdir $target_subdir --expires 30
143+
- >
144+
echo "Coverage report: https://pages.gitlab.adacore-it.com/$CI_PROJECT_PATH/$target_subdir/index.html"
145+
146+
# Compute coverage percentage
147+
- line_rate=$(cat $CI_PROJECT_DIR/coverage/cobertura-coverage.xml | grep -o 'line-rate="\([^"]\+\)"' | head -1 | grep -o '[0-9.]\+')
148+
- line_perc=$(python -c "print($line_rate * 100)")
149+
- >
150+
echo "Line Coverage: $line_perc"
151+
152+
# The Cobertura report coming from the VS Code test infra has a <source>
153+
# element specifying the root path of all sources.
154+
#
155+
# This needs to be replaced with the CI_PROJECT_DIR in order for GitLab to
156+
# understand it.
157+
#
158+
# In this sed command we use '|' instead of '/' as a separator for the 's'
159+
# command to avoid interpreting path separators in the pattern and
160+
# replacement.
161+
- sed -e "s|$VSCODE_BUILD_SPACE/test|$CI_PROJECT_DIR|" -i $CI_PROJECT_DIR/coverage/cobertura-coverage.xml
162+
coverage: '/^Line Coverage:\s+(\d+\.\d+)$/'
163+
artifacts:
164+
when: always # Upload on errors too
165+
reports:
166+
junit: xunit-*.xml
167+
coverage_report:
168+
coverage_format: cobertura
169+
path: coverage/cobertura-coverage.xml
170+
paths:
171+
- anod-logs/
172+
- coverage/cobertura-coverage.xml

Makefile

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,9 +166,15 @@ endif
166166
@echo Now run:
167167
@echo code --extensionDevelopmentPath=`pwd`/integration/vscode/ada/ `pwd`
168168

169+
ifeq ($(COVERAGE),)
170+
NPM_TEST_ARGS?=
171+
else
172+
NPM_TEST_ARGS?=-- --coverage --coverage-reporter text-summary --coverage-reporter html --coverage-reporter cobertura --label 0
173+
endif
174+
169175
vscode-test:
170176
# Run the VS Code integration testsuite.
171-
cd integration/vscode/ada; MOCHA_ALS_UPDATE=$(MOCHA_ALS_UPDATE) LD_LIBRARY_PATH= npm run test
177+
cd integration/vscode/ada; MOCHA_ALS_UPDATE=$(MOCHA_ALS_UPDATE) LD_LIBRARY_PATH= npm run test $(NPM_TEST_ARGS)
172178

173179
vscode-package:
174180
cd integration/vscode/ada; LD_LIBRARY_PATH= $(VSCE) package

gnat/tester.gpr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ project Tester is
2727
package Compiler renames LSP_Client.Compiler;
2828

2929
package Binder is
30-
for Switches ("ada") use ("-E");
30+
for Switches ("ada") use ("-Es");
3131
end Binder;
3232

3333
end Tester;
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
import typescriptEslintEslintPlugin from "@typescript-eslint/eslint-plugin";
2+
import tsdoc from "eslint-plugin-tsdoc";
3+
import globals from "globals";
4+
import tsParser from "@typescript-eslint/parser";
5+
import path from "node:path";
6+
import { fileURLToPath } from "node:url";
7+
import js from "@eslint/js";
8+
import { FlatCompat } from "@eslint/eslintrc";
9+
10+
const __filename = fileURLToPath(import.meta.url);
11+
const __dirname = path.dirname(__filename);
12+
const compat = new FlatCompat({
13+
baseDirectory: __dirname,
14+
recommendedConfig: js.configs.recommended,
15+
allConfig: js.configs.all
16+
});
17+
18+
export default [{
19+
ignores: ["**/out", "**/*.d.ts"],
20+
}, ...compat.extends(
21+
"eslint:recommended",
22+
"plugin:@typescript-eslint/recommended",
23+
"plugin:@typescript-eslint/recommended-requiring-type-checking",
24+
"plugin:prettier/recommended",
25+
), {
26+
plugins: {
27+
"@typescript-eslint": typescriptEslintEslintPlugin,
28+
tsdoc,
29+
},
30+
31+
languageOptions: {
32+
globals: {
33+
...Object.fromEntries(Object.entries(globals.browser).map(([key]) => [key, "off"])),
34+
...globals.node,
35+
...globals.commonjs,
36+
},
37+
38+
parser: tsParser,
39+
ecmaVersion: 5,
40+
sourceType: "commonjs",
41+
42+
parserOptions: {
43+
ecmaFeatures: {
44+
jsx: true,
45+
},
46+
47+
project: "tsconfig.json",
48+
},
49+
},
50+
51+
rules: {
52+
"tsdoc/syntax": "warn",
53+
54+
"max-len": ["warn", {
55+
code: 100,
56+
ignoreUrls: true,
57+
}],
58+
59+
"@typescript-eslint/switch-exhaustiveness-check": "error",
60+
},
61+
}];

integration/vscode/ada/package-lock.json

Lines changed: 32 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration/vscode/ada/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,6 +997,8 @@
997997
]
998998
},
999999
"devDependencies": {
1000+
"@eslint/eslintrc": "^3.1.0",
1001+
"@eslint/js": "^9.10.0",
10001002
"@types/command-exists": "1.2.3",
10011003
"@types/mocha": "10.0.7",
10021004
"@types/node": "16.18.16",
@@ -1014,6 +1016,7 @@
10141016
"eslint-plugin-prettier": "5.2.1",
10151017
"eslint-plugin-tsdoc": "0.3.0",
10161018
"glob": "11.0.0",
1019+
"globals": "^15.9.0",
10171020
"mocha": "10.7.3",
10181021
"mocha-junit-reporter": "^2.2.1",
10191022
"npm-check-updates": "^17.1.0",
@@ -1024,7 +1027,7 @@
10241027
"vscode-tmgrammar-test": "0.1.3"
10251028
},
10261029
"scripts": {
1027-
"check-licenses": "npx license-checker-rseidelsohn --summary --onlyAllow \"0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;BlueOak-1.0.0;CC0-1.0;GPL-3.0;GPL-3.0-or-later;ISC;MIT;Python-2.0;Zlib;EPL-2.0\" --excludePackages \"@vscode/vsce-sign-linux-x64;@vscode/vsce-sign\"",
1030+
"check-licenses": "npx license-checker-rseidelsohn --summary --onlyAllow \"0BSD;Apache-2.0;BSD-2-Clause;BSD-3-Clause;BlueOak-1.0.0;CC0-1.0;GPL-3.0;GPL-3.0-or-later;ISC;MIT;Python-2.0;Zlib;EPL-2.0\" --excludePackages \"@vscode/vsce-sign-linux-x64;@vscode/vsce-sign-win32-x64;@vscode/vsce-sign\"",
10281031
"vscode:prepublish": "npm run esbuild-base -- --minify --sourcemap",
10291032
"esbuild-base": "esbuild ./src/extension.ts --bundle --outfile=out/src/extension.js --external:vscode --format=cjs --platform=node",
10301033
"compile": "node ./node_modules/typescript/bin/tsc",

integration/vscode/ada/src/AdaCodeLensProvider.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ export class AdaCodeLensProvider implements CodeLensProvider {
1818
onDidChangeCodeLenses?: Event<void> | undefined;
1919
provideCodeLenses(
2020
document: TextDocument,
21-
token?: CancellationToken
21+
token?: CancellationToken,
2222
): ProviderResult<CodeLens[]> {
2323
const symbols = commands.executeCommand<DocumentSymbol[]>(
2424
'vscode.executeDocumentSymbolProvider',
25-
document.uri
25+
document.uri,
2626
);
2727

2828
/**
@@ -34,7 +34,7 @@ export class AdaCodeLensProvider implements CodeLensProvider {
3434
(m) =>
3535
// Here we go through the Uri class to benefit from the normalization
3636
// of path casing on Windows. See Uri.fsPath documentation.
37-
Uri.file(m).fsPath == document.uri.fsPath
37+
Uri.file(m).fsPath == document.uri.fsPath,
3838
)
3939
) {
4040
// It's a main file, so let's offer Run and Debug actions on the main subprogram

0 commit comments

Comments
 (0)