@@ -6,77 +6,17 @@ stages:
66 - build_and_test
77 - run_downstream_ci
88
9- .detect-branches :
10- # Version 2.
11- # Detects source and target branches. Checkout necessary branch for
12- # repository when run downstream pipeline is detected.
13- # ACI_SOURCE_BRANCH is set to source branch (merge request, pull)
14- # ACI_TARGET_BRANCH is set to target branch of merge request, or 'master'/'edge' for pull
15- # ACI_REPOSITORY_NAME_EDGE_SUFFIX is set to '-edge' when target repository is 'edge'
16- # ACI_ANOD_QUALIFIER is set to 'edge' when target repository is 'edge'
17- # ACI_SUBPROJECTS_ROOT is set to '/tmp' and may be overritten by script
18- - |
19- if [[ -n "$ACI_UPSTREAM_SOURCE_BRANCH" ]]; then
20- ACI_SOURCE_BRANCH="$ACI_UPSTREAM_SOURCE_BRANCH";
21- elif [[ -n "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ]]; then
22- ACI_SOURCE_BRANCH="$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME";
23- else
24- ACI_SOURCE_BRANCH="$CI_COMMIT_BRANCH";
25- fi;
26- if [[ -n "$ACI_UPSTREAM_TARGET_BRANCH" ]]; then
27- ACI_TARGET_BRANCH=$ACI_UPSTREAM_TARGET_BRANCH;
28- elif [[ -n "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]]; then
29- ACI_TARGET_BRANCH="$CI_MERGE_REQUEST_TARGET_BRANCH_NAME";
30- elif [[ "x$CI_COMMIT_BRANCH" == "xedge" ]]; then
31- ACI_TARGET_BRANCH="edge";
32- else
33- ACI_TARGET_BRANCH="master";
34- fi;
35- if [[ "$ACI_TARGET_BRANCH" == "edge" ]]; then
36- ACI_REPOSITORY_NAME_EDGE_SUFFIX="-edge";
37- ACI_ANOD_QUALIFIER="edge"
38- else
39- ACI_REPOSITORY_NAME_EDGE_SUFFIX="";
40- ACI_ANOD_QUALIFIER=""
41- fi
42- ACI_SUBPROJECTS_ROOT=/tmp
43- echo "Source branch: $ACI_SOURCE_BRANCH"
44- echo "Target branch: $ACI_TARGET_BRANCH"
45- echo "Name suffix: $ACI_REPOSITORY_NAME_EDGE_SUFFIX"
46- echo "Qualifier: $ACI_ANOD_QUALIFIER"
47- echo "Subprojects: $ACI_SUBPROJECTS_ROOT"
48-
49- # On downstream pipeline checkout the necessary branch
50- - if [[ "$CI_PIPELINE_SOURCE" == 'pipeline' ]]; then
51- if git -C "$CI_PROJECT_DIR" show-ref --quiet -- "$ACI_SOURCE_BRANCH"; then
52- git -C "$CI_PROJECT_DIR" checkout "$ACI_SOURCE_BRANCH";
53- elif git -C "$CI_PROJECT_DIR" ls-remote --exit-code -- origin "$ACI_SOURCE_BRANCH"; then
54- git -C "$CI_PROJECT_DIR" config remote.origin.fetch "+refs/heads/$ACI_SOURCE_BRANCH:refs/remotes/origin/$ACI_SOURCE_BRANCH";
55- git -C "$CI_PROJECT_DIR" remote update;
56- git -C "$CI_PROJECT_DIR" checkout "$ACI_SOURCE_BRANCH";
57- elif git -C "$CI_PROJECT_DIR" show-ref --quiet -- "$ACI_TARGET_BRANCH"; then
58- git -C "$CI_PROJECT_DIR" checkout "$ACI_TARGET_BRANCH";
59- elif git -C "$CI_PROJECT_DIR" ls-remote --exit-code -- origin "$ACI_TARGET_BRANCH"; then
60- git -C "$CI_PROJECT_DIR" config remote.origin.fetch "+refs/heads/$ACI_TARGET_BRANCH:refs/remotes/origin/$ACI_TARGET_BRANCH";
61- git -C "$CI_PROJECT_DIR" remote update;
62- git -C "$CI_PROJECT_DIR" checkout "$ACI_TARGET_BRANCH";
63- fi
64- fi
65-
66- .checkout-subproject :
67- # Version 1.
68- # Input variables:
69- # ACI_SUBPROJECTS_ROOT - root directory to checkout repositories.
70- # ACI_SUBPROJECT_REPOSITORY_URL_PATH - path component of the repository's URL.
71- # ACI_SUBPROJECT_NAME - name of the directory for subproject.
72- - |
73- git -C $ACI_SUBPROJECTS_ROOT clone $GIT_CLONE_BASE/$ACI_SUBPROJECT_REPOSITORY_URL_PATH $ACI_SUBPROJECT_NAME
74- if `git -C $ACI_SUBPROJECTS_ROOT -C $ACI_SUBPROJECT_NAME show-ref $ACI_SOURCE_BRANCH > /dev/null`; then
75- git -C $ACI_SUBPROJECTS_ROOT -C $ACI_SUBPROJECT_NAME checkout $ACI_SOURCE_BRANCH;
76- elif `git -C $ACI_SUBPROJECTS_ROOT -C $ACI_SUBPROJECT_NAME show-ref $ACI_TARGET_BRANCH > /dev/null`; then
77- git -C $ACI_SUBPROJECTS_ROOT -C $ACI_SUBPROJECT_NAME checkout $ACI_TARGET_BRANCH;
78- fi
79- anod vcs --sandbox-dir /it/wave --add-repo $ACI_SUBPROJECT_NAME $ACI_SUBPROJECTS_ROOT/$ACI_SUBPROJECT_NAME
9+ .basic-setup :
10+ # Temporary: clone the specific branch of ci-fragments
11+ # TODO: remove the next 4 lines when this version of ci-fragments is available in the image
12+ - cd /tmp
13+ - git clone $GIT_CLONE_BASE/eng/it/ci-fragments -b topic/generic_ci_phase_2 --depth 1
14+ - export PATH=/tmp/ci-fragments:$PATH
15+ - cd -
16+ # Use generic_anod_ci here.
17+ - generic_anod_ci --add-dep eng/fuzz/internal-fuzz-testsuite
18+ - cat /tmp/ci_env.sh
19+ - . /tmp/ci_env.sh
8020
8121# Build and test with ANOD
8222# TODO: add a build and test based on Alire in parallel to this.
@@ -93,61 +33,41 @@ build_and_test:
9333 - if : $CI_COMMIT_BRANCH == 'master' && $CI_COMMIT_TITLE =~ /Merge branch.*/
9434 - if : $CI_COMMIT_BRANCH == 'edge' && $CI_COMMIT_TITLE =~ /Merge branch.*/
9535 script :
96- - !reference [.detect-branches]
97-
98- - |
99- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/spawn.git
100- ACI_SUBPROJECT_NAME=spawn
101- - !reference [.checkout-subproject]
102-
103- - |
104- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/vss.git
105- ACI_SUBPROJECT_NAME=vss
106- - !reference [.checkout-subproject]
107-
108- - |
109- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/markdown.git
110- ACI_SUBPROJECT_NAME=markdown
111- - !reference [.checkout-subproject]
112-
113- - |
114- ACI_SUBPROJECT_REPOSITORY_URL_PATH=/eng/ide/gnatdoc.git
115- ACI_SUBPROJECT_NAME=gnatdoc$ACI_REPOSITORY_NAME_EDGE_SUFFIX
116- - !reference [.checkout-subproject]
36+ - !reference [.basic-setup]
11737
118- - if [[ "$ACI_TARGET_BRANCH" == "edge" ]]; then
119- BUILD_SPACE_SUFFIX="_edge";
120- fi
38+ # Build & test using anod
39+ - anod build als $ACI_TRACK_QUALIFIER --minimal
12140
122- - |
123- # Setup the 'anod vcs' for this repo
124- cd /it/wave
125- anod vcs --add-repo ada_language_server$ACI_REPOSITORY_NAME_EDGE_SUFFIX $CI_PROJECT_DIR
41+ # We pass --latest here because the vscode-extension will try to download
42+ # the Windows binary (it's a multi-platform extension), and this binary
43+ # might not be available right away.
44+ - anod build vscode-extension $ACI_TRACK_QUALIFIER --minimal --latest
45+ - anod test als $ACI_TRACK_QUALIFIER --minimal
12646
127- # Build & test using anod
128- cd /it/wave
129- - anod build als --qualifier=$ACI_ANOD_QUALIFIER --minimal
130- - anod build vscode-extension --qualifier=$ACI_ANOD_QUALIFIER --minimal
131- - anod test als --qualifier=$ACI_ANOD_QUALIFIER --minimal
47+ # 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
13250
133- # Process the report
51+ # Process the report
13452 - e3-testsuite-report
13553 --failure-exit-code 1
13654 --xunit-output $CI_PROJECT_DIR/xunit_output.xml
137- x86_64-linux/als${BUILD_SPACE_SUFFIX}-test /results/new/ || FAILED=true
55+ $SB_BASE /results/new/ || FAILED=true
13856
57+ # Build the lsif report
13958 - anod install lsif-ada
140- - ( eval `anod printenv lsif-ada`;
59+ - ( cd $ANOD_DEFAULT_SANDBOX_DIR ;
60+ eval `anod printenv lsif-ada`;
14161 eval `anod printenv stable-gnat`;
14262 eval `anod printenv ada_libfswatch`;
14363 eval `anod printenv stable-templates_parser`;
14464 eval `anod printenv stable-langkit_support`;
14565 eval `anod printenv stable-libgpr2 --qualifier=bare`;
14666 eval `anod printenv stable-libadalang`;
14767 eval `anod printenv stable-libadalang-tools`;
148- export GPR_PROJECT_PATH=/it/wave /x86_64-linux/als/src/subprojects/gnatdoc/gnat:$GPR_PROJECT_PATH;
149- export GPR_PROJECT_PATH=/it/wave /x86_64-linux/als/src/subprojects/VSS/gnat:$GPR_PROJECT_PATH;
150- cd /it/wave /x86_64-linux/als/src;
68+ export GPR_PROJECT_PATH=` pwd ` /x86_64-linux/als/src/subprojects/gnatdoc/gnat:$GPR_PROJECT_PATH;
69+ export GPR_PROJECT_PATH=` pwd ` /x86_64-linux/als/src/subprojects/VSS/gnat:$GPR_PROJECT_PATH;
70+ cd $ANOD_DEFAULT_SANDBOX_DIR /x86_64-linux/als/src;
15171 lsif-ada gnat/lsp_server.gpr > $CI_PROJECT_DIR/dump.lsif 2>/dev/null ||
15272 touch $CI_PROJECT_DIR/dump.lsif )
15373
0 commit comments