-
Notifications
You must be signed in to change notification settings - Fork 9
192 lines (168 loc) · 5.93 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
name: Build and Deploy
on:
push:
branches:
- main
tags:
- 'v[0-9]+.*'
pull_request:
branches:
- main
permissions:
actions: read
contents: write
jobs:
ui-test:
strategy:
matrix:
os: [buildjet-4vcpu-ubuntu-2204, windows-latest, macos-latest]
fail-fast: true
env:
CODE_VERSION: "1.75.1"
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
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' 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@v3
with:
path: ./rascal-vscode-extension/uitests
key: "vscode-${{matrix.os}}"
- name: "UI test (windows & mac)"
shell: bash
if: matrix.os != 'buildjet-4vcpu-ubuntu-2204'
working-directory: ./rascal-vscode-extension
env:
DELAY_FACTOR: ${{ matrix.os == 'windows' && '7' || '5' }}
_JAVA_OPTIONS: ${{ matrix.os == 'windows' && '-Xmx2G' || '-Xmx4G' }}
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: 5
_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@v3
if: failure()
with:
name: screenshots-${{ matrix.os }}
path: ./rascal-vscode-extension/uitests/**/screenshots/*.png
- name: "cleanup before cache"
shell: bash
if: always()
continue-on-error: true
run: rm -rf ./rascal-vscode-extension/uitests/screenshots
build:
needs: [ui-test]
runs-on: buildjet-2vcpu-ubuntu-2204
steps:
- uses: actions/checkout@v3
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'temurin'
cache: 'maven'
- name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
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
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 compile
npm run lint
npm run compile-tests
npm run normalTest
# disable vs-code test npm run test
- name: package extension
working-directory: rascal-vscode-extension
run: |
npm run lsp4j:package
npx vsce package
- name: upload final vsix
uses: actions/upload-artifact@v3
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
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/ # remove non open source assets
# remove non-used jars
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