Skip to content

Commit 1760e78

Browse files
committed
Separate Maven and Gradle test workflows
1 parent b068feb commit 1760e78

3 files changed

Lines changed: 60 additions & 40 deletions

File tree

.github/workflows/run-regression-tests.yml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ jobs:
1414
runtime: [ linux, mac ]
1515
# Removing windows as a standard run flavor runtime: [ linux, mac, windows ]
1616
targetVSCode: [previous, latest ]
17+
buildTool: [maven, gradle]
1718
# As Vscode 1.79 and 1.78 are the only support version for current release, running test with only latest,previous
1819
#Enable it in future for multiple releases as applicable targetVSCode: [ previousMinusOne, previous, latest ]
1920
include:
@@ -26,7 +27,7 @@ jobs:
2627
# - runtime: windows
2728
# os: windows-latest
2829

29-
name: Build Plugin
30+
name: Test ${{ matrix.runtime }} - ${{ matrix.buildTool }} - VSCode ${{ matrix.targetVSCode }}
3031
runs-on: ${{ matrix.os }}
3132

3233
steps:
@@ -44,24 +45,24 @@ jobs:
4445

4546
# Archive artifacts
4647
- name: Archive artifacts
47-
if: runner.os == 'linux' && matrix.targetVSCode == 'latest'
48+
if: runner.os == 'linux' && matrix.targetVSCode == 'latest' && matrix.buildTool == 'maven'
4849
uses: actions/upload-artifact@v4.3.4
4950
with:
5051
name: liberty-tools-vscode-${{ github.sha }}
5152
path: ./**/*.vsix
5253
if-no-files-found: warn
5354
retention-days: 7
5455

55-
# Build the plugin.
56-
- name: 'Test: RunTests'
57-
run: bash ./src/test/resources/ci/scripts/exec.sh TEST ${{ matrix.targetVSCode }}
56+
# Run tests for specific build tool
57+
- name: 'Test: Run ${{ matrix.buildTool }} Tests'
58+
run: bash ./src/test/resources/ci/scripts/exec.sh TEST ${{ matrix.targetVSCode }} ${{ matrix.buildTool }}
5859

5960
# Archive screenshots
6061
- name: Archive screenshots
6162
if: always()
6263
uses: actions/upload-artifact@v4.3.4
6364
with:
64-
name: liberty-run-tests-screenshots-${{ runner.os }}-${{ matrix.targetVSCode }}
65-
path: ./screenshots/*.png
65+
name: liberty-tools-vscode-${{ matrix.runtime }}-${{ matrix.buildTool }}-${{ matrix.targetVSCode }}-tests-screenshots
66+
path: ./screenshots/${{ matrix.buildTool }}/*.png
6667
if-no-files-found: warn
6768
retention-days: 7

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,8 +251,8 @@
251251
"buildLcls": "gulp buildLemminxLiberty buildLibertyServer",
252252
"buildJakarta": "gulp buildJakartaJdt buildJakartaLs",
253253
"test": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/*.js' --code_settings src/test/resources/settings.json",
254-
"test-mac-maven": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/M*.js' --code_settings src/test/resources/settings.json",
255-
"test-mac-gradle": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/G*.js' --code_settings src/test/resources/settings.json"
254+
"test-maven": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/M*.js' --code_settings src/test/resources/settings.json",
255+
"test-gradle": "npm run test-compile && extest setup-and-run -o .vscode/settings.json 'out/test/G*.js' --code_settings src/test/resources/settings.json"
256256
},
257257
"devDependencies": {
258258
"@types/chai": "^4.3.4",

src/test/resources/ci/scripts/exec.sh

Lines changed: 50 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22

33
############################################################################
4-
# Copyright (c) 2022, 2025 IBM Corporation and others.
4+
# Copyright (c) 2022, 2026 IBM Corporation and others.
55
#
66
# This program and the accompanying materials are made available under the
77
# terms of the Eclipse Public License v. 2.0 which is available at
@@ -14,12 +14,15 @@
1414
############################################################################
1515
set -Ex
1616

17-
#BUILD OR TEST TO EXECUTE
17+
#Execute BUILD or TEST
1818
TYPE=$1
1919

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
2121
VSCODE_VERSION_TO_RUN=$2
2222

23+
#Build tool to test (maven or gradle)
24+
BUILD_TOOL=${3:-gradle}
25+
2326
# Current time.
2427
currentTime=(date +"%Y/%m/%d-%H:%M:%S:%3N")
2528

@@ -48,49 +51,65 @@ main() {
4851

4952
#Initialisation step
5053
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
5863
#Start Display and Docker-Daemon
5964
startDisplayAndDocker
6065

6166
mvn package
6267
docker build --pull -f ./Dockerfile -t inventory-dev-mode .
63-
fi
68+
fi
69+
cd -
70+
fi
6471

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
6677

6778
if [ $VSCODE_VERSION_TO_RUN == "latest" ]; then
6879
# 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
7691
updateExitStatus
77-
else
78-
npm run test -- -u
92+
elif [ "$BUILD_TOOL" = "maven" ]; then
93+
npm run test-maven -- -u
7994
updateExitStatus
8095
fi
8196
else
8297
# Run the plugin's install goal against the target vscode version
8398
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
94113
fi
95114
fi
96115
fi

0 commit comments

Comments
 (0)