Release OpenVSCode Server #783
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-dependencies: | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.image }} | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- vscode_arch: x64 | |
npm_arch: x64 | |
image: gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-x64 | |
# - vscode_arch: arm64 | |
# npm_arch: arm64 | |
# image: gitpod/openvscode-server-linux-build-agent:centos7-devtoolset8-arm64 | |
name: Build native dependencies linux | |
if: github.event.inputs.commit || github.event.workflow_run.conclusion == 'success' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
repository: ${{ github.repository_owner }}/openvscode-server | |
ref: ${{ env.RELEASE_COMMIT }} | |
token: ${{ secrets.VSCODE_GITHUB_TOKEN }} | |
- name: Execute yarn | |
run: | | |
set -e | |
export npm_config_arch=${{ matrix.npm_arch }} | |
yarn --cwd remote --frozen-lockfile --network-timeout 180000 | |
- name: Compress node_modules output | |
run: | | |
set -e | |
tar -cz --ignore-failed-read -f reh_node_modules-${{ matrix.vscode_arch }}.tar.gz -C ./remote node_modules | |
- name: Upload compiled dependencies | |
uses: actions/upload-artifact@v3 | |
with: | |
name: reh_node_modules-${{ matrix.vscode_arch }} | |
path: reh_node_modules-${{ matrix.vscode_arch }}.tar.gz | |
build: | |
runs-on: ubuntu-latest | |
container: | |
image: ${{ matrix.image }} | |
env: | |
OS_NAME: 'linux' | |
VSCODE_ARCH: ${{ matrix.vscode_arch }} | |
# support only linux for now | |
strategy: | |
fail-fast: true | |
matrix: | |
include: | |
- vscode_arch: x64 | |
npm_arch: x64 | |
image: gitpod/openvscode-server-linux-build-agent:bionic-x64 | |
- vscode_arch: arm64 | |
npm_arch: arm64 | |
image: gitpod/openvscode-server-linux-build-agent:bionic-arm64 | |
- vscode_arch: armhf | |
npm_arch: arm | |
image: gitpod/openvscode-server-linux-build-agent:bionic-armhf | |
name: Build linux-${{ matrix.vscode_arch }} | |
needs: build-dependencies | |
outputs: | |
release_commit: ${{ steps.bundle_tar.outputs.release_commit }} | |
version: ${{ steps.bundle_tar.outputs.version }} | |
quality: ${{ steps.bundle_tar.outputs.quality }} | |
steps: | |
- uses: actions/checkout@v3 | |
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@v3 | |
with: | |
node-version: 18 | |
- name: Install Yarn | |
run: npm install -g yarn | |
- name: Compute node modules cache key | |
working-directory: ./openvscode-server | |
id: nodeModulesCacheKey | |
run: echo "value=$(node build/azure-pipelines/common/computeNodeModulesCacheKey.js ${{ matrix.vscode_arch }})" >> $GITHUB_OUTPUT | |
- name: Cache node modules | |
id: cacheNodeModules | |
uses: actions/cache@v3 | |
with: | |
path: "openvscode-server/**/node_modules" | |
key: ${{ runner.os }}-cacheNodeModulesLinux-${{ steps.nodeModulesCacheKey.outputs.value }} | |
- name: Get yarn cache directory path | |
working-directory: ./openvscode-server | |
id: yarnCacheDirPath | |
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} | |
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: Cache yarn directory | |
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.yarnCacheDirPath.outputs.dir }} | |
key: ${{ runner.os }}-yarnCacheDir-${{ steps.nodeModulesCacheKey.outputs.value }} | |
restore-keys: ${{ runner.os }}-yarnCacheDir- | |
- name: Execute yarn | |
working-directory: ./openvscode-server | |
if: ${{ steps.cacheNodeModules.outputs.cache-hit != 'true' }} | |
env: | |
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1 | |
ELECTRON_SKIP_BINARY_DOWNLOAD: 1 | |
run: | | |
set -e | |
export npm_config_arch=${{ matrix.npm_arch }} | |
yarn --frozen-lockfile --network-timeout 180000 | |
- name: Download server build dependencies | |
if: matrix.vscode_arch == 'x64' | |
uses: actions/download-artifact@v3 | |
with: | |
name: reh_node_modules-x64 | |
path: ./openvscode-server | |
- name: Extract server node_modules output | |
if: matrix.vscode_arch == 'x64' | |
working-directory: ./openvscode-server | |
run: | | |
set -e | |
rm -rf remote/node_modules | |
tar -xzf reh_node_modules-x64.tar.gz --directory ./remote | |
- 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}" \ | |
yarn gulp vscode-reh-web-linux-${{ matrix.vscode_arch }}-min | |
- name: Download playwright | |
if: matrix.vscode_arch == 'x64' | |
working-directory: ./openvscode-server | |
run: | | |
yarn playwright-install | |
- name: Build integration tests | |
if: matrix.vscode_arch == 'x64' | |
working-directory: ./openvscode-server | |
run: | | |
set -e | |
yarn gulp \ | |
compile-extension:configuration-editing \ | |
compile-extension:vscode-api-tests \ | |
compile-extension:markdown-language-features \ | |
compile-extension:typescript-language-features \ | |
compile-extension:emmet \ | |
compile-extension:git \ | |
compile-extension:ipynb \ | |
compile-extension-media | |
- name: Compile test suites | |
if: matrix.vscode_arch == 'x64' | |
working-directory: ./openvscode-server | |
run: | | |
set -e | |
yarn --cwd test/smoke compile | |
yarn --cwd test/integration/browser 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 }}" \ | |
yarn smoketest-no-compile --web --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@v3 | |
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 }} |