-
Notifications
You must be signed in to change notification settings - Fork 9
231 lines (202 loc) · 7.05 KB
/
build.yaml
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
name: Build and Deploy
on:
push:
branches:
- main
tags:
- 'v[0-9]+.*'
pull_request:
branches:
- '**'
permissions:
actions: read
contents: write
jobs:
normal-tests:
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- name: Assure different pom cache hit
run: echo " " >> rascal-lsp/pom.xml
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
cache-dependency-path: rascal-vscode-extension/package-lock.json
registry-url: 'https://registry.npmjs.org'
- name: Run java tests
working-directory: ./rascal-lsp
run: mvn -B '-Drascal.compile.skip' '-Drascal.tutor.skip' test -DargLine="-Xmx4G"
- name: VS Code tests
working-directory: ./rascal-vscode-extension
run: |
npm ci
npm run compile-tests
npm run normalTest
ui-test:
strategy:
matrix:
os: [buildjet-4vcpu-ubuntu-2204, windows-latest, macos-latest]
fail-fast: true
env:
CODE_VERSION: "1.82.3"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Assure different pom cache hit
run: echo " " >> rascal-lsp/pom.xml
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
cache-dependency-path: rascal-vscode-extension/package-lock.json
registry-url: 'https://registry.npmjs.org'
- name: Package & compile rascal-lsp
working-directory: ./rascal-lsp
run: mvn -B '-Drascal.compile.skip' '-Drascal.tutor.skip' -DskipTests clean package
- name: Package & compile extension
working-directory: ./rascal-vscode-extension
run: |
npm ci
npm run compile-tests
- name: Cache vscode downloads
id: cache-vscode
uses: actions/cache@v4
with:
path: ./rascal-vscode-extension/uitests
key: "vscode-${{matrix.os}}"
- name: "UI test (windows)"
if: matrix.os == 'windows-latest'
working-directory: ./rascal-vscode-extension
env:
DELAY_FACTOR: 10
_JAVA_OPTIONS: '-Xmx5G'
run: npx extest setup-and-run out/test/vscode-suite/*.test.js --storage uitests
- name: "UI test (mac)"
shell: bash
if: matrix.os == 'macos-latest'
working-directory: ./rascal-vscode-extension
env:
DELAY_FACTOR: 15
_JAVA_OPTIONS: '-Xmx5G'
run: npx extest setup-and-run out/test/vscode-suite/*.test.js --storage uitests
- name: "UI test (ubuntu)"
shell: bash
if: matrix.os == 'buildjet-4vcpu-ubuntu-2204'
working-directory: ./rascal-vscode-extension
env:
DELAY_FACTOR: 8
_JAVA_OPTIONS: '-Xmx5G' # we have 16gb of memory, make sure LSP, REPL & DSL-LSP can start
run: xvfb-run --auto-servernum --server-args='-screen 0 1920x1080x24' npx extest setup-and-run out/test/vscode-suite/*.test.js --storage uitests
- name: Upload Screenshots
uses: actions/upload-artifact@v4
if: failure()
with:
name: screenshots-${{ matrix.os }}
path: ./rascal-vscode-extension/uitests/**/screenshots/*.png
retention-days: 5
- name: "cleanup before cache"
shell: bash
if: always()
continue-on-error: true
run: rm -rf ./rascal-vscode-extension/uitests/screenshots
build:
needs: [ui-test, normal-tests]
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'
cache-dependency-path: rascal-vscode-extension/package-lock.json
registry-url: 'https://registry.npmjs.org'
- name: Package & compile rascal-lsp
working-directory: ./rascal-lsp
run: mvn -B clean verify -DskipTests
env:
MAVEN_OPTS: "-Xmx6G"
- name: Append build id if pre-release
working-directory: ./rascal-vscode-extension
run: sed -i "s/\\(\"version\":.*\\)\\-head/\\1-head$GITHUB_RUN_NUMBER/" package.json
- name: Package & compile extension
working-directory: ./rascal-vscode-extension
run: |
npm ci
npm run license-check
npm run esbuild
npm run lint
- name: package extension
working-directory: rascal-vscode-extension
run: |
npm run lsp4j:package
npx vsce package
- name: upload final vsix
uses: actions/upload-artifact@v4
with:
path: rascal-vscode-extension/*.vsix
retention-days: 20
- name: Publish release to Open VSX Registry
if: startsWith(github.ref, 'refs/tags/v')
uses: HaaLeo/publish-vscode-extension@v1
continue-on-error: true
id: publishToOpenVSX
with:
packagePath: ./rascal-vscode-extension
pat: ${{ secrets.OPEN_VSX_ACCESS }}
registryUrl: https://open-vsx.org
- name: Publish release to Visual Studio Marketplace
if: startsWith(github.ref, 'refs/tags/v')
uses: HaaLeo/publish-vscode-extension@v1
with:
packagePath: ./rascal-vscode-extension
pat: ${{ secrets.AZURE_USETHESOURCE_PAT }}
registryUrl: https://marketplace.visualstudio.com
extensionFile: ${{ steps.publishToOpenVSX.outputs.vsixPath }} # copy exact same vsix from the previous step
- name: Prepare Draft Release
uses: softprops/action-gh-release@v1
continue-on-error: true
if: startsWith(github.ref, 'refs/tags/v')
with:
draft: true
files: ${{ steps.publishToOpenVSX.outputs.vsixPath }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: rewrite package.json & readme for NPM package
working-directory: rascal-vscode-extension
run: |
node src/rewritePackageForNPMPublish.js
rm -rf assets/images/
rm assets/jars/rascal-core.jar
rm assets/jars/typepal.jar
rm -rf lib/test
rm -rf src/test
mv README-lib.md README.md
- name: Test compile for NPM
if: startsWith(github.ref, 'refs/tags/v') != true
working-directory: rascal-vscode-extension
run: npm run compile
- name: publish to NPM
if: startsWith(github.ref, 'refs/tags/v')
working-directory: rascal-vscode-extension
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npm publish --access=public