mirror of
https://github.com/cdr/code-server.git
synced 2026-04-01 02:53:26 +02:00
* Allow setting the VS Code build target For the NPM package (and tests, at least for now), we will still use linux-x64, but this is going to allow using the platform build targets for our standalone releases so we can avoid having to copy all the packaging steps (like cleaning up modules). This does mean that the NPM package when installed will be missing those cleanup steps. Possibly we can try to break out the packaging step into a something that can be ran standalone (which will also require installing dev dependencies like gulp) but not sure how much work this would be. * Preserve dependencies for e2e tests To avoid having to install them again. Also moved an env block to the root of the job. * Refactor releases to use VS Code packaging Instead of building the linux-x64 package, stripping the modules, then installing them again, we build the correct target and use the modules as they are. This means we do not have to copy all the post-processing steps like the ones that delete unnecessary modules. For the NPM package we still publish the linux-x64 package (without modules of course). This means npm installations do not get that same post-processing. Another advantage of this is that we can run the release immediately without having to wait for the build step, or on a commit that no longer has a build artifact, since they all build individually now. We could try sharing the core-ci build step, but leaving that alone for now. I also converted the macOS jobs into a matrix. Deleted the CI readme because it was out of date and seemed to just repeat what should be described in the scripts anyway. Removed a section about Homebrew since we do not maintain that anymore. It looks like there is no need to symlink node_modules.asar anymore.
293 lines
9.1 KiB
YAML
293 lines
9.1 KiB
YAML
name: Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
|
|
# Cancel in-progress runs for pull requests when developers push
|
|
# additional changes, and serialize builds in branches.
|
|
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-concurrency-to-cancel-any-in-progress-job-or-run
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
|
|
|
|
jobs:
|
|
changes:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
ci: ${{ steps.filter.outputs.ci }}
|
|
code: ${{ steps.filter.outputs.code }}
|
|
deps: ${{ steps.filter.outputs.deps }}
|
|
docs: ${{ steps.filter.outputs.docs }}
|
|
helm: ${{ steps.filter.outputs.helm }}
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
|
|
id: filter
|
|
with:
|
|
filters: |
|
|
ci:
|
|
- ".github/**"
|
|
- "ci/**"
|
|
docs:
|
|
- "docs/**"
|
|
- "README.md"
|
|
- "CHANGELOG.md"
|
|
helm:
|
|
- "ci/helm-chart/**"
|
|
code:
|
|
- "src/**"
|
|
- "test/**"
|
|
deps:
|
|
- "lib/**"
|
|
- "patches/**"
|
|
- "package-lock.json"
|
|
- "test/package-lock.json"
|
|
- id: debug
|
|
run: |
|
|
echo "${{ toJSON(steps.filter )}}"
|
|
|
|
prettier:
|
|
name: Run prettier check
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- run: npx prettier --check .
|
|
|
|
doctoc:
|
|
name: Doctoc markdown files
|
|
runs-on: ubuntu-22.04
|
|
needs: changes
|
|
if: needs.changes.outputs.docs == 'true'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- run: npm run doctoc
|
|
|
|
lint-helm:
|
|
name: Lint Helm chart
|
|
runs-on: ubuntu-22.04
|
|
needs: changes
|
|
if: needs.changes.outputs.helm == 'true'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: azure/setup-helm@1a275c3b69536ee54be43f2070a358922e12c8d4 # v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
- run: helm plugin install https://github.com/instrumenta/helm-kubeval
|
|
- run: helm kubeval ci/helm-chart
|
|
|
|
lint-ts:
|
|
name: Lint TypeScript files
|
|
runs-on: ubuntu-22.04
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- run: npm run lint:ts
|
|
|
|
lint-actions:
|
|
name: Lint GitHub Actions
|
|
runs-on: ubuntu-latest
|
|
needs: changes
|
|
if: needs.changes.outputs.ci == 'true'
|
|
steps:
|
|
- name: Checkout repo
|
|
uses: actions/checkout@v6
|
|
- name: Check workflow files
|
|
run: |
|
|
bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) 1.7.9
|
|
./actionlint -color -shellcheck= -ignore "softprops/action-gh-release"
|
|
shell: bash
|
|
|
|
test-unit:
|
|
name: Run unit tests
|
|
runs-on: ubuntu-22.04
|
|
needs: changes
|
|
if: needs.changes.outputs.code == 'true'
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- run: npm run test:unit
|
|
- uses: codecov/codecov-action@1af58845a975a7985b0beb0cbe6fbbb71a41dbad # v5
|
|
if: success()
|
|
with:
|
|
token: ${{ secrets.CODECOV_TOKEN }}
|
|
|
|
build:
|
|
name: linux-x64
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
|
|
DISABLE_V8_COMPILE_CACHE: 1
|
|
VERSION: 0.0.0
|
|
VSCODE_TARGET: linux-x64
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
steps:
|
|
- run: sudo apt update && sudo apt install -y libkrb5-dev
|
|
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
|
|
with:
|
|
packages: quilt
|
|
version: 1.0
|
|
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
submodules: true
|
|
- run: quilt push -a
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- run: npm run build
|
|
# Get Code's git hash. When this changes it means the content is
|
|
# different and we need to rebuild.
|
|
- name: Get latest lib/vscode rev
|
|
id: vscode-rev
|
|
run: echo "rev=$(git rev-parse HEAD:./lib/vscode)" >> $GITHUB_OUTPUT
|
|
# We need to rebuild when we have a new version of Code, when any of the
|
|
# patches changed, or when the code-server version changes (since it gets
|
|
# embedded into the code). Use VSCODE_CACHE_VERSION to force a rebuild.
|
|
- name: Fetch prebuilt linux-x64 Code package from cache
|
|
id: cache-vscode
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: lib/vscode-reh-web-linux-x64
|
|
key: vscode-linux-x64-package-${{ secrets.VSCODE_CACHE_VERSION }}-${{ steps.vscode-rev.outputs.rev }}-${{ hashFiles('patches/*.diff', 'ci/build/build-vscode.sh') }}
|
|
- name: Build vscode
|
|
if: steps.cache-vscode.outputs.cache-hit != 'true'
|
|
run: |
|
|
pushd lib/vscode
|
|
npm ci
|
|
popd
|
|
npm run build:vscode
|
|
# Push up an artifact containing the linux-x64 release.
|
|
- run: KEEP_MODULES=1 npm run release
|
|
- run: tar -czf package.tar.gz release
|
|
- uses: actions/upload-artifact@v7
|
|
with:
|
|
name: linux-x64-package
|
|
path: ./package.tar.gz
|
|
|
|
test-e2e:
|
|
name: Run e2e tests
|
|
runs-on: ubuntu-22.04
|
|
needs: [changes, build]
|
|
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' || needs.changes.outputs.ci == 'true'
|
|
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- name: Install Playwright OS dependencies
|
|
run: |
|
|
./test/node_modules/.bin/playwright install-deps
|
|
./test/node_modules/.bin/playwright install
|
|
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: linux-x64-package
|
|
- run: tar -xzf package.tar.gz
|
|
|
|
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e
|
|
- uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: failed-test-videos
|
|
path: ./test/test-results
|
|
|
|
test-e2e-proxy:
|
|
name: Run e2e tests behind proxy
|
|
runs-on: ubuntu-22.04
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
needs: [changes, build]
|
|
if: needs.changes.outputs.code == 'true' || needs.changes.outputs.deps == 'true' || needs.changes.outputs.ci == 'true'
|
|
|
|
steps:
|
|
- name: Cache Caddy
|
|
uses: actions/cache@v4
|
|
id: caddy-cache
|
|
with:
|
|
path: |
|
|
~/.cache/caddy
|
|
key: cache-caddy-2.5.2
|
|
- name: Install Caddy
|
|
if: steps.caddy-cache.outputs.cache-hit != 'true'
|
|
run: |
|
|
gh release download v2.5.2 --repo caddyserver/caddy --pattern "caddy_2.5.2_linux_amd64.tar.gz"
|
|
mkdir -p ~/.cache/caddy
|
|
tar -xzf caddy_2.5.2_linux_amd64.tar.gz --directory ~/.cache/caddy
|
|
|
|
- uses: actions/checkout@v6
|
|
- uses: actions/setup-node@v6
|
|
with:
|
|
node-version-file: .node-version
|
|
cache: npm
|
|
cache-dependency-path: |
|
|
package-lock.json
|
|
test/package-lock.json
|
|
- run: SKIP_SUBMODULE_DEPS=1 npm ci
|
|
- name: Install Playwright OS dependencies
|
|
run: |
|
|
./test/node_modules/.bin/playwright install-deps
|
|
./test/node_modules/.bin/playwright install
|
|
|
|
- uses: actions/download-artifact@v8
|
|
with:
|
|
name: linux-x64-package
|
|
- run: tar -xzf package.tar.gz
|
|
|
|
- run: ~/.cache/caddy/caddy start --config ./ci/Caddyfile
|
|
- run: CODE_SERVER_TEST_ENTRY=./release npm run test:e2e:proxy
|
|
- run: ~/.cache/caddy/caddy stop --config ./ci/Caddyfile
|
|
if: always()
|
|
- uses: actions/upload-artifact@v7
|
|
if: always()
|
|
with:
|
|
name: failed-test-videos-proxy
|
|
path: ./test/test-results
|