fix - Cannot see Delegate Test to Gradle option in VS Code (#1622) #2304
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Publish | |
on: | |
push: | |
branches: [main, develop] | |
pull_request: | |
branches: [main, develop] | |
jobs: | |
build-and-analyse: | |
name: Build & Analyse | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # required by sonarqube | |
- name: Use Java 17 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: "17" | |
architecture: x64 | |
- name: Use Node 18.20.4 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.20.4 | |
cache-dependency-path: extension/package-lock.json | |
cache: npm | |
- name: Cache npm cache directory | |
uses: actions/cache@v2 | |
with: | |
path: ~/.npm | |
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Checkout microsoft/build-server-for-gradle | |
uses: actions/checkout@v2 | |
with: | |
repository: microsoft/build-server-for-gradle | |
path: extension/build-server-for-gradle | |
- name: Build Jars | |
run: ../gradlew buildJars | |
working-directory: extension/ | |
- name: Lint | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: lint | |
- name: Build & Analyse Gradle Server | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
env: | |
JAVA_HOME: "" | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
- name: Upload lib | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib | |
path: | | |
extension/lib | |
extension/dist | |
extension/out | |
# Although the gradle build can run in all environments, we use the Java | |
# lib generated in the previous step for a better real-world test. | |
test-extension: | |
needs: [build-and-analyse] | |
name: "Test Java ${{ matrix.java-version }} - Node ${{ matrix.node-version }} - ${{ matrix.os }}" | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
node-version: [18.20.4] | |
java-version: ["17", "21"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache-dependency-path: extension/package-lock.json | |
cache: npm | |
- name: Use Java ${{ matrix.java-version }} | |
uses: actions/setup-java@v1 | |
with: | |
java-version: ${{ matrix.java-version }} | |
architecture: x64 | |
- name: Cache vscode | |
uses: actions/cache@v2 | |
with: | |
path: | | |
extension/.vscode-test | |
key: ${{ runner.os }}-vscode-${{ hashFiles('**/vscode-version.ts') }} | |
restore-keys: | | |
${{ runner.os }}-vscode- | |
- name: Download lib | |
uses: actions/download-artifact@v4 | |
with: | |
name: lib | |
path: extension/ | |
- name: Start Xvfb | |
run: | | |
Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & | |
if: matrix.os == 'ubuntu-latest' | |
- name: Set permissions | |
run: | | |
chmod +x extension/lib/gradle-server | |
unset npm_config_prefix | |
if: matrix.os != 'windows-latest' | |
- name: Test Gradle Language Server | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: gradle-language-server:test | |
env: | |
JAVA_HOME: "" | |
- name: Prepare gradle-groovy-custom-build-file | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
build-root-directory: extension/test-fixtures/gradle-groovy-custom-build-file | |
- name: Prepare gradle-groovy-default-build-file | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
build-root-directory: extension/test-fixtures/gradle-groovy-default-build-file | |
- name: Prepare gradle-kotlin-default-build-file | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build | |
build-root-directory: extension/test-fixtures/gradle-kotlin-default-build-file | |
- name: Install extension dependencies | |
working-directory: extension/ | |
run: npm ci | |
- name: Test extension | |
uses: gradle/gradle-build-action@v2 | |
continue-on-error: true | |
id: test | |
with: | |
arguments: testVsCode | |
env: | |
DISPLAY: ":99.0" | |
CI: "true" | |
- name: Retry test extension attempt 1 | |
uses: gradle/gradle-build-action@v2 | |
continue-on-error: true | |
if: steps.test.outcome=='failure' | |
id: retry1 | |
with: | |
arguments: testVsCode | |
env: | |
DISPLAY: ":99.0" | |
CI: "true" | |
- name: Retry test extension attempt 2 | |
uses: gradle/gradle-build-action@v2 | |
continue-on-error: true | |
if: steps.retry1.outcome=='failure' | |
id: retry2 | |
with: | |
arguments: testVsCode | |
env: | |
DISPLAY: ":99.0" | |
CI: "true" | |
- name: Set test extension status | |
if: ${{ steps.test.outcome=='failure' && steps.retry1.outcome=='failure' && steps.retry2.outcome=='failure' }} | |
run: | | |
echo "Tests failed" | |
exit 1 |