Skip to content

Commit b58781a

Browse files
committed
Merge branch 'mr/split_ci' into 'master'
Split the build and test phases See merge request eng/ide/ada_language_server!1474
2 parents bcaad08 + 627f64a commit b58781a

File tree

1 file changed

+92
-18
lines changed

1 file changed

+92
-18
lines changed

.gitlab-ci.yml

Lines changed: 92 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
stages:
2-
- build_and_test
2+
- build
3+
- test
34
- check
45
- run_downstream_ci
56

@@ -17,18 +18,41 @@ issue-check:
1718
- require_issue # launch the verification
1819

1920
.basic-setup:
20-
# Use generic_anod_ci here.
21+
# Basic invocation of generic_anod_ci.
2122
- generic_anod_ci
2223
- cat /tmp/ci_env.sh
2324
- . /tmp/ci_env.sh
2425

26+
.basic-test-setup:
27+
# Use of generic_anod_ci for the purposes of testing, assuming
28+
# the presence of a package containing the build.
29+
30+
# Unpack the built package
31+
- (cd /tmp && tar -xzf $CI_PROJECT_DIR/wave-build-export.tar.gz)
32+
# Make sure to remove the package, lest it be considered source by anod
33+
- rm $CI_PROJECT_DIR/wave-build-export.tar.gz
34+
35+
# Basic invocation of generic_anod_ci.
36+
- generic_anod_ci
37+
- cat /tmp/ci_env.sh
38+
- . /tmp/ci_env.sh
39+
40+
# Use the packaged components in our sandbox
41+
- anod-copy-components /tmp/wave-build-export $ANOD_DEFAULT_SANDBOX_DIR
42+
43+
# generic_anod_ci sets the resolver to "smart_resolver" - this conflicts
44+
# with our intention to use the pre-build package(s): use the "minimal"
45+
# resolver for this.
46+
- anod tune --minimal --plan /tmp/plans
47+
48+
2549
# Build and test with ANOD
2650
# TODO: add a build and test based on Alire in parallel to this.
27-
build_and_test:
51+
build:
2852
services:
2953
- image:systemgtk
3054
- cpu:8
31-
stage: build_and_test
55+
stage: build
3256
interruptible: true
3357
rules:
3458
- if: $CI_PIPELINE_SOURCE == 'push'
@@ -49,22 +73,37 @@ build_and_test:
4973
- anod build vscode-extension $ACI_TRACK_QUALIFIER --minimal --latest
5074
- echo -e "\e[0Ksection_end:`date +%s`:build_vscode\r\e[0K"
5175

76+
# Export the components and make a package out of them
77+
- anod-copy-components --standalone-export $ANOD_DEFAULT_SANDBOX_DIR /tmp/wave-build-export
78+
- (cd /tmp/ && tar -czf $CI_PROJECT_DIR/wave-build-export.tar.gz wave-build-export)
79+
80+
artifacts:
81+
when: on_success
82+
paths:
83+
- wave-build-export.tar.gz
84+
85+
86+
test-als:
87+
services:
88+
- image:systemgtk
89+
- cpu:8
90+
stage: test
91+
interruptible: true
92+
rules:
93+
- if: $CI_PIPELINE_SOURCE == 'push'
94+
when: never
95+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
96+
- if: $CI_PIPELINE_SOURCE == 'pipeline'
97+
script:
98+
- !reference [.basic-test-setup]
99+
52100
- echo -e "\e[0Ksection_start:`date +%s`:test_als[collapsed=true]\r\e[0Kanod test als"
53101
# Run ALS tests
54102
- anod test als $ACI_TRACK_QUALIFIER
55103

56-
# TODO: it would be nice to have a simpler way of getting this info
57-
- ALS_BUILD_SPACE_NAME=`anod eval als --primitive test build_space_name $ACI_TRACK_QUALIFIER | tr -d "'"`
58-
- ALS_BUILD_SPACE=$ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/$ALS_BUILD_SPACE_NAME
104+
- ALS_BUILD_SPACE=$(anod info test als $ACI_TRACK_QUALIFIER --show working_dir)
59105
- echo -e "\e[0Ksection_end:`date +%s`:test_als\r\e[0K"
60106

61-
- echo -e "\e[0Ksection_start:`date +%s`:test_vscode[collapsed=true]\r\e[0Kanod test vscode-extension"
62-
# Run VSCode tests
63-
- anod test vscode-extension --qualifier=$ACI_TRACK_QUALIFIER --minimal
64-
- VSCODE_BUILD_SPACE_NAME=`anod eval --primitive test --qualifier=$ACI_TRACK_QUALIFIER vscode-extension build_space_name | tr -d "'"`
65-
- VSCODE_BUILD_SPACE=$ANOD_DEFAULT_SANDBOX_DIR/x86_64-linux/$VSCODE_BUILD_SPACE_NAME
66-
- echo -e "\e[0Ksection_end:`date +%s`:test_vscode\r\e[0K"
67-
68107
# Job artifacts must be produced in the project directory, so we do it at
69108
# the end of the job to avoid changing Anod checkouts halfway through the
70109
# job and triggering useless rebuilds.
@@ -74,6 +113,44 @@ build_and_test:
74113
--failure-exit-code 1
75114
--xunit-output $CI_PROJECT_DIR/als_xunit_output.xml
76115
$ALS_BUILD_SPACE/results/new/ || FAILED=true
116+
# Include Anod logs
117+
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
118+
- echo -e "\e[0Ksection_end:`date +%s`:prepare_artifacts\r\e[0K"
119+
120+
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
121+
122+
artifacts:
123+
when: always # Upload on errors too
124+
reports:
125+
junit: [als_xunit_output.xml]
126+
paths:
127+
- anod-logs/
128+
129+
test-vscode-extension:
130+
services:
131+
- image:systemgtk
132+
- cpu:8
133+
stage: test
134+
interruptible: true
135+
rules:
136+
- if: $CI_PIPELINE_SOURCE == 'push'
137+
when: never
138+
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
139+
- if: $CI_PIPELINE_SOURCE == 'pipeline'
140+
script:
141+
- !reference [.basic-test-setup]
142+
143+
# Run VSCode extension tests
144+
- echo -e "\e[0Ksection_start:`date +%s`:test_vscode[collapsed=true]\r\e[0Kanod test vscode-extension"
145+
- anod test vscode-extension --qualifier=$ACI_TRACK_QUALIFIER --minimal
146+
147+
- VSCODE_BUILD_SPACE=$(anod info test vscode-extension $ACI_TRACK_QUALIFIER --show working_dir)
148+
- echo -e "\e[0Ksection_end:`date +%s`:test_vscode\r\e[0K"
149+
150+
# Job artifacts must be produced in the project directory, so we do it at
151+
# the end of the job to avoid changing Anod checkouts halfway through the
152+
# job and triggering useless rebuilds.
153+
- echo -e "\e[0Ksection_start:`date +%s`:prepare_artifacts[collapsed=true]\r\e[0KPrepare job artifacts"
77154
# Process the vscode-extension test report
78155
- e3-testsuite-report
79156
--failure-exit-code 1
@@ -83,15 +160,12 @@ build_and_test:
83160
- cp -r $ANOD_DEFAULT_SANDBOX_DIR/log $CI_PROJECT_DIR/anod-logs
84161
- echo -e "\e[0Ksection_end:`date +%s`:prepare_artifacts\r\e[0K"
85162

86-
- if [ ! -z ${FAILED+x} ]; then cat $CI_PROJECT_DIR/als_xunit_output.xml; fi
87-
- if [ ! -z ${FAILED+x} ]; then cat $CI_PROJECT_DIR/vscode_xunit_output.xml; fi
88-
89163
- if [ ! -z ${FAILED+x} ]; then echo "There was at least one testcase failure" && exit 1; fi
90164

91165
artifacts:
92166
when: always # Upload on errors too
93167
reports:
94-
junit: [als_xunit_output.xml, vscode_xunit_output.xml]
168+
junit: [vscode_xunit_output.xml]
95169
paths:
96170
- anod-logs/
97171

0 commit comments

Comments
 (0)