Adopt new telemetry schema (#1418) #1882
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 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: "11" | |
architecture: x64 | |
- name: Use Node 16.14.2 | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 16.14.2 | |
- 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: Lint | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: lint | |
- name: Build & Analyse Gradle Server | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build -x test | |
env: | |
JAVA_HOME: "" | |
- name: Upload lib | |
uses: actions/upload-artifact@v2 | |
with: | |
name: lib | |
path: extension/lib | |
# 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: [16.14.2] | |
java-version: ["8", "11", "17", "19"] | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Use Node ${{ matrix.node-version }} | |
uses: actions/setup-node@v1 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- 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: Build Extension | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: extension:build | |
env: | |
NODE_OPTIONS: "--max-old-space-size=4096" | |
- name: Download lib | |
uses: actions/download-artifact@v2 | |
with: | |
name: lib | |
path: extension/lib | |
- 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: 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 |