Skip to content

Commit 8bf6f03

Browse files
committed
Add VSCode testing to GitLab CI
1 parent ff62bcf commit 8bf6f03

File tree

2 files changed

+42
-11
lines changed

2 files changed

+42
-11
lines changed

.gitlab-ci.yml

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ stages:
2222
# TODO: add a build and test based on Alire in parallel to this.
2323
build_and_test:
2424
services:
25-
- image:sandbox
25+
- image:systemgtk
2626
- cpu:8
2727
- mem:16
28+
- run_as_root:false
2829
stage: build_and_test
2930
interruptible: true
3031
rules:
@@ -35,25 +36,34 @@ build_and_test:
3536
script:
3637
- !reference [.basic-setup]
3738

38-
# Build & test using anod
39+
- echo -e "\e[0Ksection_start:`date +%s`:build_als[collapsed=true]\r\e[0Kanod build als"
3940
- anod build als $ACI_TRACK_QUALIFIER --minimal
41+
- echo -e "\e[0Ksection_end:`date +%s`:build_als\r\e[0K"
4042

43+
- echo -e "\e[0Ksection_start:`date +%s`:build_vscode[collapsed=true]\r\e[0Kanod build vscode-extension"
4144
# We pass --latest here because the vscode-extension will try to download
4245
# the Windows binary (it's a multi-platform extension), and this binary
4346
# might not be available right away.
4447
- anod build vscode-extension $ACI_TRACK_QUALIFIER --minimal --latest
48+
- echo -e "\e[0Ksection_end:`date +%s`:build_vscode\r\e[0K"
49+
50+
- echo -e "\e[0Ksection_start:`date +%s`:test_als[collapsed=true]\r\e[0Kanod test als"
51+
# Run ALS tests
4552
- anod test als $ACI_TRACK_QUALIFIER --minimal
4653

4754
# TODO: it would be nice to have a simpler way of getting this info
48-
- BUILD_SPACE=`anod eval als --primitive test build_space_name $ACI_TRACK_QUALIFIER | tr -d "'"`
49-
- SB_BASE=$ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/$BUILD_SPACE
55+
- ALS_BUILD_SPACE_NAME=`anod eval als --primitive test build_space_name $ACI_TRACK_QUALIFIER | tr -d "'"`
56+
- ALS_BUILD_SPACE=$ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/$ALS_BUILD_SPACE_NAME
57+
- echo -e "\e[0Ksection_end:`date +%s`:test_als\r\e[0K"
5058

51-
# Process the report
52-
- e3-testsuite-report
53-
--failure-exit-code 1
54-
--xunit-output $CI_PROJECT_DIR/xunit_output.xml
55-
$SB_BASE/results/new/ || FAILED=true
59+
- echo -e "\e[0Ksection_start:`date +%s`:test_vscode[collapsed=true]\r\e[0Kanod test vscode-extension"
60+
# Run VSCode tests
61+
- anod test vscode-extension --qualifier=$ACI_TRACK_QUALIFIER --minimal
62+
- VSCODE_BUILD_SPACE_NAME=`anod eval --primitive test --qualifier=$ACI_TRACK_QUALIFIER vscode-extension build_space_name | tr -d "'"`
63+
- VSCODE_BUILD_SPACE=$ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/$VSCODE_BUILD_SPACE_NAME
64+
- echo -e "\e[0Ksection_end:`date +%s`:test_vscode\r\e[0K"
5665

66+
- echo -e "\e[0Ksection_start:`date +%s`:lsif[collapsed=true]\r\e[0KBuild lsif report"
5767
# Build the lsif report
5868
- anod install lsif-ada
5969
- ( cd $ANOD_DEFAULT_SANDBOX_DIR ;
@@ -70,13 +80,32 @@ build_and_test:
7080
cd $ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/als/src;
7181
lsif-ada gnat/lsp_server.gpr > $CI_PROJECT_DIR/dump.lsif 2>/dev/null ||
7282
touch $CI_PROJECT_DIR/dump.lsif )
83+
- echo -e "\e[0Ksection_end:`date +%s`:lsif\r\e[0K"
84+
85+
# Job artifacts must be produced in the project directory, so we do it at
86+
# the end of the job to avoid changing Anod checkouts halfway through the
87+
# job and triggering useless rebuilds.
88+
- echo -e "\e[0Ksection_start:`date +%s`:prepare_artifacts[collapsed=true]\r\e[0KPrepare job artifacts"
89+
# Process the als test report
90+
- e3-testsuite-report
91+
--failure-exit-code 1
92+
--xunit-output $CI_PROJECT_DIR/als_xunit_output.xml
93+
$ALS_BUILD_SPACE/results/new/ || FAILED=true
94+
# Process the vscode-extension test report
95+
- e3-testsuite-report
96+
--failure-exit-code 1
97+
--xunit-output $CI_PROJECT_DIR/vscode_xunit_output.xml
98+
$VSCODE_BUILD_SPACE/results/new/ || FAILED=true
99+
# Include Anod logs
100+
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
101+
- echo -e "\e[0Ksection_end:`date +%s`:prepare_artifacts\r\e[0K"
73102

74103
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
75104

76105
artifacts:
77106
when: always # Upload on errors too
78107
reports:
79-
junit: xunit_output.xml
108+
junit: [als_xunit_output.xml, vscode_xunit_output.xml]
80109
lsif: dump.lsif
81110

82111
.run_ci_common: &run_ci_common

.vscode/settings.json.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,5 +58,7 @@
5858
"editor.detectIndentation": false,
5959
"files.trimFinalNewlines": true,
6060
"files.trimTrailingWhitespace": true
61-
}
61+
},
62+
// Allow GitLab-specific Yaml tags in .gitlab-ci.yml
63+
"yaml.customTags": ["!reference sequence"]
6264
}

0 commit comments

Comments
 (0)