-
Notifications
You must be signed in to change notification settings - Fork 56
167 lines (164 loc) · 5.25 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
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