|
1 | 1 | #!/bin/bash |
2 | 2 |
|
3 | 3 | ############################################################################ |
4 | | -# Copyright (c) 2022, 2025 IBM Corporation and others. |
| 4 | +# Copyright (c) 2022, 2026 IBM Corporation and others. |
5 | 5 | # |
6 | 6 | # This program and the accompanying materials are made available under the |
7 | 7 | # terms of the Eclipse Public License v. 2.0 which is available at |
|
14 | 14 | ############################################################################ |
15 | 15 | set -Ex |
16 | 16 |
|
17 | | -#BUILD OR TEST TO EXECUTE |
| 17 | +#Execute BUILD or TEST |
18 | 18 | TYPE=$1 |
19 | 19 |
|
20 | | -#IF TEST TTYPE HEN RUN WITH VERSION OF VSCODE TO RUN TESTS 1.74.0, LATEST |
| 20 | +#Run with previous or latest version of VSCODE |
21 | 21 | VSCODE_VERSION_TO_RUN=$2 |
22 | 22 |
|
| 23 | +#Build tool to test (maven or gradle) |
| 24 | +BUILD_TOOL=${3:-gradle} |
| 25 | + |
23 | 26 | # Current time. |
24 | 27 | currentTime=(date +"%Y/%m/%d-%H:%M:%S:%3N") |
25 | 28 |
|
@@ -48,49 +51,65 @@ main() { |
48 | 51 |
|
49 | 52 | #Initialisation step |
50 | 53 | npm run test-compile |
51 | | - cd src/test/resources/maven/liberty-maven-test-wrapper-app |
52 | | - mvn liberty:start |
53 | | - mvn liberty:stop |
54 | | - |
55 | | - |
56 | | - #Docker test initialisation step |
57 | | - if [ $OS = "Linux" ]; then |
| 54 | + |
| 55 | + # Initialize Maven project if needed |
| 56 | + if [ "$BUILD_TOOL" = "maven" ]; then |
| 57 | + cd src/test/resources/maven/liberty-maven-test-wrapper-app |
| 58 | + mvn liberty:start |
| 59 | + mvn liberty:stop |
| 60 | + |
| 61 | + #Docker test initialisation step for Maven |
| 62 | + if [ $OS = "Linux" ]; then |
58 | 63 | #Start Display and Docker-Daemon |
59 | 64 | startDisplayAndDocker |
60 | 65 |
|
61 | 66 | mvn package |
62 | 67 | docker build --pull -f ./Dockerfile -t inventory-dev-mode . |
63 | | - fi |
| 68 | + fi |
| 69 | + cd - |
| 70 | + fi |
64 | 71 |
|
65 | | - cd - |
| 72 | + # Initialize Gradle project if needed |
| 73 | + if [ "$BUILD_TOOL" = "gradle" ]; then |
| 74 | + # Gradle initialization if needed (currently none required) |
| 75 | + : |
| 76 | + fi |
66 | 77 |
|
67 | 78 | if [ $VSCODE_VERSION_TO_RUN == "latest" ]; then |
68 | 79 | # Run the plugin's install goal against the latest vscode version |
69 | | - if [ $OS = "Darwin" ]; then |
70 | | - chown -R runner src/test/resources/maven |
71 | | - chown -R runner src/test/resources/gradle |
72 | | - # Gradle tests should be run before Maven tests because the after hook for copying the screeshots from temporary to a permananet location is written in the Maven tests so that the copying will be done at the end of every test cases. |
73 | | - npm run test-mac-gradle -- -u |
74 | | - updateExitStatus |
75 | | - npm run test-mac-maven -- -u |
| 80 | + if [ $OS = "Darwin" ]; then |
| 81 | + if [ "$BUILD_TOOL" = "maven" ]; then |
| 82 | + chown -R runner src/test/resources/maven |
| 83 | + fi |
| 84 | + if [ "$BUILD_TOOL" = "gradle" ]; then |
| 85 | + chown -R runner src/test/resources/gradle |
| 86 | + fi |
| 87 | + fi |
| 88 | + |
| 89 | + if [ "$BUILD_TOOL" = "gradle" ]; then |
| 90 | + npm run test-gradle -- -u |
76 | 91 | updateExitStatus |
77 | | - else |
78 | | - npm run test -- -u |
| 92 | + elif [ "$BUILD_TOOL" = "maven" ]; then |
| 93 | + npm run test-maven -- -u |
79 | 94 | updateExitStatus |
80 | 95 | fi |
81 | 96 | else |
82 | 97 | # Run the plugin's install goal against the target vscode version |
83 | 98 | if [ $OS = "Darwin" ]; then |
84 | | - chown -R runner src/test/resources/maven |
85 | | - chown -R runner src/test/resources/gradle |
86 | | - # Gradle tests should be run before Maven tests because the after hook for copying the screeshots from temporary to a permananet location is written in the Maven tests so that the copying will be done at the end of every test cases. |
87 | | - npm run test-mac-gradle -- -u -c $VSCODE_VERSION_TO_RUN |
88 | | - updateExitStatus |
89 | | - npm run test-mac-maven -- -u -c $VSCODE_VERSION_TO_RUN |
90 | | - updateExitStatus |
91 | | - else |
92 | | - npm run test -- -u -c $VSCODE_VERSION_TO_RUN |
93 | | - updateExitStatus |
| 99 | + if [ "$BUILD_TOOL" = "maven" ]; then |
| 100 | + chown -R runner src/test/resources/maven |
| 101 | + fi |
| 102 | + if [ "$BUILD_TOOL" = "gradle" ]; then |
| 103 | + chown -R runner src/test/resources/gradle |
| 104 | + fi |
| 105 | + fi |
| 106 | + |
| 107 | + if [ "$BUILD_TOOL" = "gradle" ]; then |
| 108 | + npm run test-gradle -- -u -c $VSCODE_VERSION_TO_RUN |
| 109 | + updateExitStatus |
| 110 | + elif [ "$BUILD_TOOL" = "maven" ]; then |
| 111 | + npm run test-maven -- -u -c $VSCODE_VERSION_TO_RUN |
| 112 | + updateExitStatus |
94 | 113 | fi |
95 | 114 | fi |
96 | 115 | fi |
|
0 commit comments