-
Notifications
You must be signed in to change notification settings - Fork 70
325 lines (293 loc) · 11.6 KB
/
release.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
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
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
name: Release OpenVSCode Server
on:
workflow_dispatch:
inputs:
commit:
description: 'Commit to release'
required: true
quality:
description: 'Quality'
required: true
type: choice
options:
- insider
- stable
default: insider
uploadRelease:
description: 'Create GitHub and DockerHub Release'
type: boolean
required: true
workflow_run:
workflows: ["OpenVSCode Server Rebase"]
types: [completed]
env:
QUALITY: ${{ github.event.inputs.quality || 'insider' }}
RELEASE_COMMIT: ${{ github.event.inputs.commit || 'main' }}
jobs:
build:
runs-on: ubuntu-latest
# support only linux for now
strategy:
fail-fast: true
matrix:
include:
- vscode_arch: x64
npm_arch: x64
deps_container: gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64
- vscode_arch: arm64
npm_arch: arm64
deps_container: gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-arm64
- vscode_arch: armhf
npm_arch: arm
name: Build linux-${{ matrix.vscode_arch }}
outputs:
release_commit: ${{ steps.bundle_tar.outputs.release_commit }}
version: ${{ steps.bundle_tar.outputs.version }}
quality: ${{ steps.bundle_tar.outputs.quality }}
env:
OS_NAME: 'linux'
VSCODE_ARCH: ${{ matrix.vscode_arch }}
NPM_REGISTRY: 'https://registry.npmjs.org'
steps:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- uses: actions/checkout@v4
with:
repository: ${{ github.repository_owner }}/openvscode-server
ref: ${{ env.RELEASE_COMMIT }}
fetch-depth: 20
path: openvscode-server
token: ${{ secrets.VSCODE_GITHUB_TOKEN }}
- uses: actions/setup-node@v4
with:
node-version-file: ./openvscode-server/.nvmrc
- name: Setup system services
working-directory: ./openvscode-server
run: |
set -e
# Start X server
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get update
./build/azure-pipelines/linux/apt-retry.sh sudo apt-get install -y pkg-config \
dbus \
xvfb \
libgtk-3-0 \
libxkbfile-dev \
libkrb5-dev \
libgbm1 \
rpm
sudo cp build/azure-pipelines/linux/xvfb.init /etc/init.d/xvfb
sudo chmod +x /etc/init.d/xvfb
sudo update-rc.d xvfb defaults
sudo service xvfb start
# Start dbus session
sudo mkdir -p /var/run/dbus
DBUS_LAUNCH_RESULT=$(sudo dbus-daemon --config-file=/usr/share/dbus-1/system.conf --print-address)
- name: Compute node modules cache key
working-directory: ./openvscode-server
id: nodeModulesCacheKey
run: |
mkdir -p .build
echo "value=$(node build/azure-pipelines/common/computeNodeModulesCacheKey.js linux ${{ matrix.vscode_arch }})" >> $GITHUB_OUTPUT
- name: Cache node modules
id: cacheNodeModules
uses: actions/cache@v4
with:
path: "openvscode-server/**/node_modules"
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }}
- name: Get npm cache directory path
working-directory: ./openvscode-server
id: npmCacheDirPath
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
run: echo "dir=$(npm config get cache)" >> $GITHUB_OUTPUT
- name: Cache npm directory
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
uses: actions/cache@v4
with:
path: ${{ steps.npmCacheDirPath.outputs.dir }}
key: ${{ runner.os }}-npmCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }}
restore-keys: ${{ runner.os }}-npmCacheDir-
- name: Override gnu target for arm64 and arm
working-directory: ./openvscode-server
if: matrix.vscode_arch == 'arm64' || matrix.vscode_arch == 'armhf'
run: |
set -e
includes=$(cat << 'EOF'
{
"target_defaults": {
"conditions": [
["OS=='linux'", {
'cflags_cc!': [ '-std=gnu++20' ],
'cflags_cc': [ '-std=gnu++2a' ],
}]
]
}
}
EOF
)
if [ ! -d "$HOME/.gyp" ]; then
mkdir -p "$HOME/.gyp"
fi
echo "$includes" > "$HOME/.gyp/include.gypi"
- name: Execute npm
working-directory: ./openvscode-server
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }}
env:
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
npm_config_arch: ${{ matrix.npm_arch }}
VSCODE_REMOTE_DEPENDENCIES_CONTAINER_NAME: ${{ matrix.deps_container }}
VSCODE_HOST_MOUNT: ${{ github.workspace }}/openvscode-server
run: |
set -e
npm config set registry "$NPM_REGISTRY"
cd ./build
for i in {1..5}; do # try 5 times
npm ci && break
if [ $i -eq 5 ]; then
echo "Npm install failed too many times" >&2
exit 1
fi
echo "Npm install failed $i, trying again..."
done
cd ..
export VSCODE_SYSROOT_PREFIX='-glibc-2.17'
source ./build/azure-pipelines/linux/setup-env.sh --skip-sysroot
for i in {1..5}; do # try 5 times
npm ci && break
if [ $i -eq 5 ]; then
echo "Npm install failed too many times" >&2
exit 1
fi
echo "Npm install failed $i, trying again..."
done
- name: Update product.json
working-directory: ./openvscode-server
run: |
set -e
nameShort=$(jq --raw-output '.nameShort' product.json)
nameLong=$(jq --raw-output '.nameLong' product.json)
if [ "$QUALITY" = "insider" ]; then
nameShort="$nameShort - Insiders"
nameLong="$nameLong - Insiders"
fi
setQuality="setpath([\"quality\"]; \"$QUALITY\")"
setNameShort="setpath([\"nameShort\"]; \"$nameShort\")"
setNameLong="setpath([\"nameLong\"]; \"$nameLong\")"
jqCommands="${setQuality} | ${setNameShort} | ${setNameLong}"
cat product.json | jq "${jqCommands}" > product.json.tmp
mv product.json.tmp product.json
jq '{quality,nameLong,nameShort}' product.json
- name: Prepare for distribution
working-directory: ./openvscode-server
run: |
set -e
base_commit_msg="code web server initial commit"
base_commit=$(git log --pretty="%H" --max-count=1 --grep "${base_commit_msg}")
if [ -z "$base_commit" ]; then
echo "Could not find base commit"
exit 1
fi
distro_commit=$(git rev-parse "${base_commit}"~)
echo "distro_commit: ${distro_commit}"
VSCODE_DISTRO_COMMIT="${distro_commit}" \
npm run gulp vscode-reh-web-linux-${{ matrix.vscode_arch }}-min
env:
DISABLE_V8_COMPILE_CACHE: 1
- name: Download playwright
if: matrix.vscode_arch == 'x64'
working-directory: ./openvscode-server
run: |
npm run playwright-install
- name: Build integration tests
if: matrix.vscode_arch == 'x64'
working-directory: ./openvscode-server
run: |
set -e
npm run gulp \
compile-extension:configuration-editing \
compile-extension:css-language-features-server \
compile-extension:emmet \
compile-extension:git \
compile-extension:github-authentication \
compile-extension:html-language-features-server \
compile-extension:ipynb \
compile-extension:notebook-renderers \
compile-extension:json-language-features-server \
compile-extension:markdown-language-features \
compile-extension-media \
compile-extension:microsoft-authentication \
compile-extension:typescript-language-features \
compile-extension:vscode-api-tests \
compile-extension:vscode-colorize-tests \
compile-extension:vscode-test-resolver
- name: Compile Integration Tests
if: matrix.vscode_arch == 'x64'
working-directory: ./openvscode-server/test/integration/browser
run: npm run compile
- name: Compile Smoke Tests
if: matrix.vscode_arch == 'x64'
working-directory: ./openvscode-server/test/smoke
run: npm run compile
- name: Run integration tests
if: matrix.vscode_arch == 'x64'
working-directory: ./openvscode-server
run: |
set -e
VSCODE_REMOTE_SERVER_PATH="$GITHUB_WORKSPACE/vscode-reh-web-linux-${{ matrix.vscode_arch }}" \
./scripts/test-web-integration.sh --browser chromium
- name: Run smoke tests
if: matrix.vscode_arch == 'x64'
working-directory: ./openvscode-server
run: |
set -e
VSCODE_REMOTE_SERVER_PATH="$GITHUB_WORKSPACE/vscode-reh-web-linux-${{ matrix.vscode_arch }}" \
npm run smoketest-no-compile -- --web --tracing --headless --electronArgs="--disable-dev-shm-usage"
- name: Bundle tarfile
id: bundle_tar
run: |
set -e
version=$(node -p -e "require('./openvscode-server/package.json').version")
release_commit=$(git -C openvscode-server rev-parse "${RELEASE_COMMIT}")
quality_name=$([ "$QUALITY" = "insider" ] && echo "-insiders" || echo "")
name="openvscode-server${quality_name}-v${version}-linux-${{ matrix.vscode_arch }}"
mv vscode-reh-web-linux-${{ matrix.vscode_arch }} ${name}
tar -czf ${name}.tar.gz ${name}
echo "release_commit=${release_commit}" >> $GITHUB_OUTPUT
echo "version=${version}" >> $GITHUB_OUTPUT
echo "quality=${QUALITY}" >> $GITHUB_OUTPUT
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: linux-${{ matrix.vscode_arch }}
path: openvscode-server-*.tar.gz
- name: Get previous job's status
id: lastrun
uses: filiptronicek/get-last-job-status@main
- name: Slack Notification
if: ${{ (success() && steps.lastrun.outputs.status == 'failed') || failure() }}
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
SLACK_COLOR: ${{ job.status }}
github-release:
needs: build
if: github.event.inputs.uploadRelease == 'true' || github.event.workflow_run.conclusion == 'success'
uses: ./.github/workflows/github-release.yml
with:
release_commit: ${{ needs.build.outputs.release_commit }}
version: ${{ needs.build.outputs.version }}
stable: ${{ needs.build.outputs.quality == 'stable' }}
secrets:
VSCODE_GITHUB_TOKEN: ${{ secrets.VSCODE_GITHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}
docker-release:
needs: [github-release, build]
if: github.event.inputs.uploadRelease == 'true' || github.event.workflow_run.conclusion == 'success'
uses: ./.github/workflows/docker-release.yml
with:
version: ${{ needs.build.outputs.version }}
stable: ${{ needs.build.outputs.quality == 'stable' }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}