Skip to content

Commit 05289d3

Browse files
authored
chore(ci): move platform steps to release (#5587)
* refactor: move platform steps build -> release * fixup! refactor: move platform steps build -> release * refactor: download npm package * refactor: upload release-packages to draft * refactor: remove draft step * refactor: e2e rely on build now * refactor: use npm package in e2e * fix: update release workflow * fixup: update cache key * fixup: checkout submodules in e2e steps * fixup: try install in release dir * fix: copy node to release package * docs: add notes about test for terminal * fixup * try cp instead * try this * fixup: clean it all up * fixup: update names * fixup: add proxy back * fixup: add comment
1 parent 3264187 commit 05289d3

File tree

3 files changed

+249
-257
lines changed

3 files changed

+249
-257
lines changed

.github/workflows/build.yaml

+31-252
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ jobs:
127127
run: yarn lint:ts
128128

129129
build:
130-
name: Build
130+
name: Build code-server
131131
runs-on: ubuntu-latest
132132
timeout-minutes: 30
133133
env:
@@ -223,6 +223,7 @@ jobs:
223223
path: ./package.tar.gz
224224

225225
npm:
226+
name: Publish npm package
226227
# the npm-package gets uploaded as an artifact in Build
227228
# so we need that to complete before this runs
228229
needs: build
@@ -274,18 +275,11 @@ jobs:
274275
npm install -g @coder/code-server-pr@${{ github.event.number }}
275276
```
276277
277-
# TODO: cache building yarn --production
278-
# possibly 2m30s of savings(?)
279-
# this requires refactoring our release scripts
280-
package-linux-amd64:
281-
name: x86-64 Linux build
278+
test-e2e:
279+
name: Run e2e tests
282280
needs: build
283281
runs-on: ubuntu-latest
284282
timeout-minutes: 15
285-
container: "centos:7"
286-
env:
287-
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
288-
289283
steps:
290284
- name: Checkout repo
291285
uses: actions/checkout@v3
@@ -295,36 +289,6 @@ jobs:
295289
with:
296290
node-version: "16"
297291

298-
- name: Install development tools
299-
run: |
300-
yum install -y epel-release centos-release-scl make
301-
yum install -y devtoolset-9-{make,gcc,gcc-c++} jq rsync python3
302-
303-
- name: Install nfpm and envsubst
304-
run: |
305-
mkdir -p ~/.local/bin
306-
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
307-
curl -sSfL https://github.com/a8m/envsubst/releases/download/v1.1.0/envsubst-`uname -s`-`uname -m` -o envsubst
308-
chmod +x envsubst
309-
mv envsubst ~/.local/bin
310-
echo "$HOME/.local/bin" >> $GITHUB_PATH
311-
312-
- name: Install yarn
313-
run: npm install -g yarn
314-
315-
- name: Download npm package
316-
uses: actions/download-artifact@v3
317-
with:
318-
name: npm-package
319-
320-
- name: Decompress npm package
321-
run: tar -xzf package.tar.gz
322-
323-
# NOTE: && here is deliberate - GitHub puts each line in its own `.sh`
324-
# file when running inside a docker container.
325-
- name: Build standalone release
326-
run: source scl_source enable devtoolset-9 && yarn release:standalone
327-
328292
- name: Fetch dependencies from cache
329293
id: cache-node-modules
330294
uses: actions/cache@v3
@@ -334,134 +298,6 @@ jobs:
334298
restore-keys: |
335299
yarn-build-
336300
337-
- name: Install test dependencies
338-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
339-
run: SKIP_SUBMODULE_DEPS=1 yarn --frozen-lockfile
340-
341-
- name: Run integration tests on standalone release
342-
run: yarn test:integration
343-
344-
- name: Upload coverage report to Codecov
345-
uses: codecov/codecov-action@v3
346-
with:
347-
token: ${{ secrets.CODECOV_TOKEN }}
348-
if: success()
349-
350-
- name: Build packages with nfpm
351-
run: yarn package
352-
353-
- name: Upload release artifacts
354-
uses: actions/upload-artifact@v3
355-
with:
356-
name: release-packages
357-
path: ./release-packages
358-
359-
# NOTE@oxy:
360-
# We use Ubuntu 16.04 here, so that our build is more compatible
361-
# with older libc versions. We used to (Q1'20) use CentOS 7 here,
362-
# but it has a full update EOL of Q4'20 and a 'critical security'
363-
# update EOL of 2024. We're dropping full support a few years before
364-
# the final EOL, but I don't believe CentOS 7 has a large arm64 userbase.
365-
# It is not feasible to cross-compile with CentOS.
366-
367-
# Cross-compile notes: To compile native dependencies for arm64,
368-
# we install the aarch64/armv7l cross toolchain and then set it as the default
369-
# compiler/linker/etc. with the AR/CC/CXX/LINK environment variables.
370-
# qemu-user-static on ubuntu-16.04 currently doesn't run Node correctly,
371-
# so we just build with "native"/x86_64 node, then download arm64/armv7l node
372-
# and then put it in our release. We can't smoke test the cross build this way,
373-
# but this means we don't need to maintain a self-hosted runner!
374-
375-
# NOTE@jsjoeio:
376-
# We used to use 16.04 until GitHub deprecated it on September 20, 2021
377-
# See here: https://github.com/actions/virtual-environments/pull/3862/files
378-
package-linux-cross:
379-
name: Linux cross-compile builds
380-
needs: build
381-
runs-on: ubuntu-18.04
382-
timeout-minutes: 15
383-
strategy:
384-
matrix:
385-
include:
386-
- prefix: aarch64-linux-gnu
387-
arch: arm64
388-
- prefix: arm-linux-gnueabihf
389-
arch: armv7l
390-
391-
env:
392-
AR: ${{ format('{0}-ar', matrix.prefix) }}
393-
CC: ${{ format('{0}-gcc', matrix.prefix) }}
394-
CXX: ${{ format('{0}-g++', matrix.prefix) }}
395-
LINK: ${{ format('{0}-g++', matrix.prefix) }}
396-
NPM_CONFIG_ARCH: ${{ matrix.arch }}
397-
NODE_VERSION: v16.13.0
398-
399-
steps:
400-
- name: Checkout repo
401-
uses: actions/checkout@v3
402-
403-
- name: Install Node.js v16
404-
uses: actions/setup-node@v3
405-
with:
406-
node-version: "16"
407-
408-
- name: Install nfpm
409-
run: |
410-
mkdir -p ~/.local/bin
411-
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
412-
echo "$HOME/.local/bin" >> $GITHUB_PATH
413-
414-
- name: Install cross-compiler
415-
run: sudo apt update && sudo apt install $PACKAGE
416-
env:
417-
PACKAGE: ${{ format('g++-{0}', matrix.prefix) }}
418-
419-
- name: Download npm package
420-
uses: actions/download-artifact@v3
421-
with:
422-
name: npm-package
423-
424-
- name: Decompress npm package
425-
run: tar -xzf package.tar.gz
426-
427-
- name: Build standalone release
428-
run: yarn release:standalone
429-
430-
- name: Replace node with cross-compile equivalent
431-
run: |
432-
wget https://nodejs.org/dist/${NODE_VERSION}/node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz
433-
tar -xf node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}.tar.xz node-${NODE_VERSION}-linux-${NPM_CONFIG_ARCH}/bin/node --strip-components=2
434-
mv ./node ./release-standalone/lib/node
435-
436-
- name: Build packages with nfpm
437-
run: yarn package ${NPM_CONFIG_ARCH}
438-
439-
- name: Upload release artifacts
440-
uses: actions/upload-artifact@v3
441-
with:
442-
name: release-packages
443-
path: ./release-packages
444-
445-
package-macos-amd64:
446-
name: x86-64 macOS build
447-
needs: build
448-
runs-on: macos-latest
449-
timeout-minutes: 15
450-
steps:
451-
- name: Checkout repo
452-
uses: actions/checkout@v3
453-
454-
- name: Install Node.js v16
455-
uses: actions/setup-node@v3
456-
with:
457-
node-version: "16"
458-
459-
- name: Install nfpm
460-
run: |
461-
mkdir -p ~/.local/bin
462-
curl -sSfL https://github.com/goreleaser/nfpm/releases/download/v2.3.1/nfpm_2.3.1_`uname -s`_`uname -m`.tar.gz | tar -C ~/.local/bin -zxv nfpm
463-
echo "$HOME/.local/bin" >> $GITHUB_PATH
464-
465301
- name: Download npm package
466302
uses: actions/download-artifact@v3
467303
with:
@@ -470,72 +306,8 @@ jobs:
470306
- name: Decompress npm package
471307
run: tar -xzf package.tar.gz
472308

473-
- name: Build standalone release
474-
run: yarn release:standalone
475-
476-
- name: Fetch dependencies from cache
477-
id: cache-node-modules
478-
uses: actions/cache@v3
479-
with:
480-
path: "**/node_modules"
481-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
482-
restore-keys: |
483-
yarn-build-
484-
485-
- name: Install test dependencies
486-
if: steps.cache-node-modules.outputs.cache-hit != 'true'
487-
run: SKIP_SUBMODULE_DEPS=1 yarn install
488-
489-
- name: Run native module tests on standalone release
490-
run: yarn test:native
491-
492-
- name: Build packages with nfpm
493-
run: yarn package
494-
495-
- name: Upload release artifacts
496-
uses: actions/upload-artifact@v3
497-
with:
498-
name: release-packages
499-
path: ./release-packages
500-
501-
test-e2e:
502-
name: End-to-end tests
503-
needs: package-linux-amd64
504-
runs-on: ubuntu-latest
505-
timeout-minutes: 15
506-
env:
507-
# Since we build code-server we might as well run tests from the release
508-
# since VS Code will load faster due to the bundling.
509-
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
510-
steps:
511-
- name: Checkout repo
512-
uses: actions/checkout@v3
513-
514-
- name: Install Node.js v16
515-
uses: actions/setup-node@v3
516-
with:
517-
node-version: "16"
518-
519-
- name: Fetch dependencies from cache
520-
id: cache-node-modules
521-
uses: actions/cache@v3
522-
with:
523-
path: "**/node_modules"
524-
key: yarn-build-${{ hashFiles('**/yarn.lock') }}
525-
restore-keys: |
526-
yarn-build-
527-
528-
- name: Download release packages
529-
uses: actions/download-artifact@v3
530-
with:
531-
name: release-packages
532-
path: ./release-packages
533-
534-
- name: Untar code-server release
535-
run: |
536-
cd release-packages
537-
tar -xzf code-server*-linux-amd64.tar.gz
538-
mv code-server*-linux-amd64 code-server-linux-amd64
309+
- name: Install release package dependencies
310+
run: cd release && yarn install
539311

540312
- name: Install dependencies
541313
if: steps.cache-node-modules.outputs.cache-hit != 'true'
@@ -546,8 +318,14 @@ jobs:
546318
./test/node_modules/.bin/playwright install-deps
547319
./test/node_modules/.bin/playwright install
548320
321+
# TODO@jsjoeio - this is temp. We need to do an actual fix
322+
- name: Copy node binary to release
323+
run: |
324+
ln -s $(which node) ./release/lib/node
325+
ln -s $(which node) ./release/node
326+
549327
- name: Run end-to-end tests
550-
run: yarn test:e2e --global-timeout 840000
328+
run: CODE_SERVER_TEST_ENTRY=./release yarn test:e2e --global-timeout 840000
551329

552330
- name: Upload test artifacts
553331
if: always()
@@ -557,17 +335,13 @@ jobs:
557335
path: ./test/test-results
558336

559337
- name: Remove release packages and test artifacts
560-
run: rm -rf ./release-packages ./test/test-results
338+
run: rm -rf ./release ./test/test-results
561339

562340
test-e2e-proxy:
563-
name: End-to-end tests behind proxy
564-
needs: package-linux-amd64
341+
name: Run e2e tests behind proxy
342+
needs: build
565343
runs-on: ubuntu-latest
566344
timeout-minutes: 25
567-
env:
568-
# Since we build code-server we might as well run tests from the release
569-
# since VS Code will load faster due to the bundling.
570-
CODE_SERVER_TEST_ENTRY: "./release-packages/code-server-linux-amd64"
571345
steps:
572346
- name: Checkout repo
573347
uses: actions/checkout@v3
@@ -586,17 +360,16 @@ jobs:
586360
restore-keys: |
587361
yarn-build-
588362
589-
- name: Download release packages
363+
- name: Download npm package
590364
uses: actions/download-artifact@v3
591365
with:
592-
name: release-packages
593-
path: ./release-packages
366+
name: npm-package
594367

595-
- name: Untar code-server release
596-
run: |
597-
cd release-packages
598-
tar -xzf code-server*-linux-amd64.tar.gz
599-
mv code-server*-linux-amd64 code-server-linux-amd64
368+
- name: Decompress npm package
369+
run: tar -xzf package.tar.gz
370+
371+
- name: Install release package dependencies
372+
run: cd release && yarn install
600373

601374
- name: Install dependencies
602375
if: steps.cache-node-modules.outputs.cache-hit != 'true'
@@ -627,8 +400,14 @@ jobs:
627400
- name: Start Caddy
628401
run: sudo ~/.cache/caddy/caddy start --config ./ci/Caddyfile
629402

403+
# TODO@jsjoeio - this is temp. We need to do an actual fix
404+
- name: Copy node binary to release
405+
run: |
406+
ln -s $(which node) ./release/lib/node
407+
ln -s $(which node) ./release/node
408+
630409
- name: Run end-to-end tests
631-
run: yarn test:e2e:proxy
410+
run: CODE_SERVER_TEST_ENTRY=./release yarn test:e2e:proxy --global-timeout 840000
632411

633412
- name: Stop Caddy
634413
if: always()
@@ -642,4 +421,4 @@ jobs:
642421
path: ./test/test-results
643422

644423
- name: Remove release packages and test artifacts
645-
run: rm -rf ./release-packages ./test/test-results
424+
run: rm -rf ./release ./test/test-results

0 commit comments

Comments
 (0)