Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/actions/ls-test/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: Run Ballerina LS tests
description: Sets up JDK, Gradle, and Ballerina, restores the dependency cache, and runs the language server gradle test suite. The repository must already be checked out.

inputs:
cache-branch:
description: Branch name used in the Ballerina dependency cache key
required: true
gradle-version:
description: Version passed to gradle as -Pversion (omitted when empty)
required: false
default: ''
package-user:
description: User for maven.pkg.github.com authentication
required: true
package-pat:
description: Token for maven.pkg.github.com authentication
required: true

runs:
using: composite
steps:
- name: Set up JDK 21
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'temurin'
java-version: 21.0.3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4

- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@97fd67111e3c3ecdfafff96fc24d95ad909ab299 # v1.1.4
with:
version: 2201.13.3

- name: Cache Ballerina dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: /home/runner/.ballerina/repositories/
key: ${{ runner.os }}-ballerina-${{ inputs.cache-branch }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-ballerina-${{ inputs.cache-branch }}-
${{ runner.os }}-ballerina-

- name: Test with Gradle
shell: bash
working-directory: packages/ballerina-language-server
env:
packageUser: ${{ inputs.package-user }}
packagePAT: ${{ inputs.package-pat }}
GRADLE_PROJECT_VERSION: ${{ inputs.gradle-version }}
run: |
if [ -n "$GRADLE_PROJECT_VERSION" ]; then
./gradlew -Pversion="$GRADLE_PROJECT_VERSION" test
else
./gradlew test
fi
22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ on:
type: boolean
required: false
default: false
runLSTests:
type: boolean
required: false
default: false
lsSource:
description: LS source — local (build from source) or download (fetch from release tag)
type: string
Expand Down Expand Up @@ -326,3 +330,21 @@ jobs:
path: |
packages/ballerina-extension/e2e-test/data/new-project/**
retention-days: 5

LSTest_Ballerina:
name: Run Ballerina LS tests
timeout-minutes: 60
if: ${{ inputs.runLSTests }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
persist-credentials: false

- name: Run LS tests
uses: ./.github/actions/ls-test
with:
cache-branch: ${{ github.ref_name }}
package-user: ${{ github.actor }}
package-pat: ${{ secrets.GITHUB_TOKEN }}
39 changes: 10 additions & 29 deletions .github/workflows/daily-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,6 @@ jobs:
concurrency:
group: ls-ubuntu-test-${{ matrix.branch }}-${{ github.ref_name }}
cancel-in-progress: true
defaults:
run:
working-directory: packages/ballerina-language-server
strategy:
fail-fast: false
matrix:
Expand All @@ -145,33 +142,15 @@ jobs:
ref: ${{ matrix.branch }}
persist-credentials: false

- name: Set up JDK 21
uses: actions/setup-java@c1e323688fd81a25caa38c78aa6df2d33d3e20d9 # v4
with:
distribution: 'temurin'
java-version: 21.0.3

- name: Setup Gradle
uses: gradle/actions/setup-gradle@ed408507eac070d1f99cc633dbcf757c94c7933a # v4

- name: Set Up Ballerina
uses: ballerina-platform/setup-ballerina@97fd67111e3c3ecdfafff96fc24d95ad909ab299 # v1.1.4
# Resolved from the matrix.branch checkout — the action file must
# also exist on release branches in the matrix.
- name: Run LS tests
uses: ./.github/actions/ls-test
with:
version: 2201.13.3

- name: Cache Ballerina dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: /home/runner/.ballerina/repositories/
key: ${{ runner.os }}-ballerina-${{ matrix.branch }}-${{ hashFiles('**/gradle.properties') }}
restore-keys: |
${{ runner.os }}-ballerina-${{ matrix.branch }}-

- name: Test with Gradle
env:
packageUser: ${{ github.actor }}
packagePAT: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew -Pversion=${{ matrix.version }} test
cache-branch: ${{ matrix.branch }}
gradle-version: ${{ matrix.version }}
package-user: ${{ github.actor }}
package-pat: ${{ secrets.GITHUB_TOKEN }}

ls-windows-build:
name: LS Windows build (${{ matrix.branch }})
Expand All @@ -191,6 +170,8 @@ jobs:
steps:
- name: Enable long paths for Git
shell: bash
# Override the job default working-directory — it does not exist before checkout.
working-directory: ${{ github.workspace }}
run: git config --system core.longpaths true

- name: Checkout repository
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,4 @@ jobs:
with:
runOnAWS: ${{ contains(github.event.pull_request.labels.*.name, 'Runner/AWS') }}
runBalE2ETests: ${{ contains(github.event.pull_request.labels.*.name, 'Checks/Run Ballerina UI Tests') || github.base_ref == 'stable/ballerina' }}
runLSTests: ${{ contains(github.event.pull_request.labels.*.name, 'Checks/Run LS Tests') }}
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ public void test(Path config) throws IOException {
String packageName = getStringValue(artifactsResponse, "packageName");
String moduleName = getStringValue(artifactsResponse, "moduleName");

if (!artifact.equals(testConfig.output()) || !Objects.equals(packageName, testConfig.packageName()) ||
!Objects.equals(moduleName, testConfig.moduleName())) {
if (!isJsonPermutation(artifact, testConfig.output())
|| !Objects.equals(packageName, testConfig.packageName())
|| !Objects.equals(moduleName, testConfig.moduleName())) {
TestConfig updatedConfig = new TestConfig(testConfig.description(), testConfig.source(), packageName,
moduleName, artifact);
// updateConfig(configJsonPath, updatedConfig);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,11 @@ private JsonElement normalize(JsonElement element, String path) {
if (path.endsWith("filePath") && element.isJsonPrimitive()) {
return new JsonPrimitive(element.getAsString().replace('\\', '/'));
}
if (path.endsWith("icon") && element.isJsonPrimitive()) {
// Package icon URLs embed the package version, which drifts with the
// distribution used in CI; ignore the version when comparing.
return new JsonPrimitive(element.getAsString().replaceAll("_\\d+(\\.\\d+)*\\.png$", ".png"));
}
return element;
}

Expand Down
Loading