Skip to content

Commit 5f47ece

Browse files
committed
Fix cross-compiled releases
Instead of doing our own thing, make use of VS Code's setup script.
1 parent 9dcb1d7 commit 5f47ece

File tree

1 file changed

+40
-61
lines changed

1 file changed

+40
-61
lines changed

.github/workflows/release.yaml

Lines changed: 40 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -19,65 +19,39 @@ concurrency:
1919

2020
jobs:
2121
package-linux:
22-
name: ${{ matrix.vscode_target }}
23-
runs-on: ubuntu-latest
24-
container: "python:3.8-slim-buster"
22+
name: ${{ format('linux-{0}', matrix.vscode_arch) }}
23+
runs-on: ubuntu-22.04
24+
2525
strategy:
2626
matrix:
2727
include:
28-
- prefix: x86_64-linux-gnu
29-
npm_arch: x64
30-
apt_arch: amd64
28+
- npm_arch: x64
29+
vscode_arch: x64
3130
package_arch: amd64
32-
vscode_target: linux-x64
33-
- prefix: aarch64-linux-gnu
34-
npm_arch: arm64
35-
apt_arch: arm64
31+
- npm_arch: arm64
32+
vscode_arch: arm64
3633
package_arch: arm64
37-
vscode_target: linux-arm64
38-
- prefix: arm-linux-gnueabihf
39-
npm_arch: armv7l
40-
apt_arch: armhf
34+
- npm_arch: arm
35+
vscode_arch: armhf
4136
package_arch: armv7l
42-
vscode_target: linux-armhf
4337

4438
env:
45-
AR: ${{ format('{0}-ar', matrix.prefix) }}
46-
AS: ${{ format('{0}-as', matrix.prefix) }}
47-
CC: ${{ format('{0}-gcc', matrix.prefix) }}
48-
CPP: ${{ format('{0}-cpp', matrix.prefix) }}
49-
CXX: ${{ format('{0}-g++', matrix.prefix) }}
50-
FC: ${{ format('{0}-gfortran', matrix.prefix) }}
51-
LD: ${{ format('{0}-ld', matrix.prefix) }}
52-
STRIP: ${{ format('{0}-strip', matrix.prefix) }}
53-
PKG_CONFIG_PATH: ${{ format('/usr/lib/{0}/pkgconfig', matrix.prefix) }}
54-
# Set cross-compiler package arch.
55-
APT_ARCH: ${{ matrix.apt_arch }}
56-
# For downloading the right Node.
57-
npm_config_arch: ${{ matrix.npm_arch }}
58-
# Overrides package architecture.
59-
ARCH: ${{ matrix.package_arch }}
60-
# Not building from source results in an x86_64 argon2, as if
61-
# npm_config_arch is being ignored.
62-
npm_config_build_from_source: true
63-
# Overrides VS Code gulp build target.
64-
VSCODE_TARGET: ${{ matrix.vscode_target }}
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
ELECTRON_SKIP_BINARY_DOWNLOAD: 1
41+
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: 1
6542
TAG: ${{ inputs.version || github.ref_name }}
43+
# Set release package name. TODO: Derive from other vars?
44+
ARCH: ${{ matrix.package_arch }}
45+
VSCODE_ARCH: ${{ matrix.vscode_arch }}
46+
npm_config_arch: ${{ matrix.npm_arch }}
47+
VSCODE_TARGET: ${{ format('linux-{0}', matrix.vscode_arch) }}
6648

6749
steps:
68-
- name: Install cross-compiler and system dependencies
69-
run: |
70-
sed -i 's/deb\.debian\.org/archive.debian.org/g' /etc/apt/sources.list
71-
dpkg --add-architecture $APT_ARCH
72-
apt update && apt install -y --no-install-recommends \
73-
crossbuild-essential-$APT_ARCH \
74-
libx11-dev:$APT_ARCH \
75-
libx11-xcb-dev:$APT_ARCH \
76-
libxkbfile-dev:$APT_ARCH \
77-
libsecret-1-dev:$APT_ARCH \
78-
libkrb5-dev:$APT_ARCH \
79-
ca-certificates \
80-
curl wget rsync gettext-base quilt git
50+
- run: sudo apt update && sudo apt install -y libkrb5-dev
51+
- uses: awalsh128/cache-apt-pkgs-action@2c09a5e66da6c8016428a2172bd76e5e4f14bb17 # latest
52+
with:
53+
packages: quilt
54+
version: 1.0
8155
- name: Install nfpm
8256
run: |
8357
mkdir -p ~/.local/bin
@@ -99,31 +73,35 @@ jobs:
9973
cache-dependency-path: |
10074
package-lock.json
10175
test/package-lock.json
102-
- run: npm ci
103-
- run: npm run build
104-
- run: npm run build:vscode
76+
77+
- name: Build
78+
run: |
79+
cd lib/vscode/build
80+
npm ci
81+
cd ..
82+
source ./build/azure-pipelines/linux/setup-env.sh
83+
# Run preinstall script before root dependencies are installed
84+
# so that v8 headers are patched correctly for native modules.
85+
node build/npm/preinstall.ts
86+
cd ../..
87+
npm ci
88+
npm run build
89+
npm run build:vscode
10590
10691
# Platform-agnostic NPM package.
10792
- run: npm run release
108-
if: ${{ matrix.vscode_target == 'linux-x64' }}
93+
if: ${{ matrix.vscode_arch == 'x64' }}
10994
- run: tar -czf package.tar.gz release
110-
if: ${{ matrix.vscode_target == 'linux-x64' }}
95+
if: ${{ matrix.vscode_arch == 'x64' }}
11196
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
112-
if: ${{ matrix.vscode_target == 'linux-x64' }}
97+
if: ${{ matrix.vscode_arch == 'x64' }}
11398
with:
11499
draft: true
115100
discussion_category_name: "📣 Announcements"
116101
files: package.tar.gz
117102

118103
# Platform-specific release.
119104
- run: KEEP_MODULES=1 npm run release
120-
- name: Replace node with cross-compile equivalent
121-
run: |
122-
node_version=$(node --version)
123-
wget https://nodejs.org/dist/${node_version}/node-${node_version}-linux-${npm_config_arch}.tar.xz
124-
tar -xf node-${node_version}-linux-${npm_config_arch}.tar.xz node-${node_version}-linux-${npm_config_arch}/bin/node --strip-components=2
125-
mv ./node ./release/lib/node
126-
127105
- run: npm run package
128106
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v1
129107
with:
@@ -173,6 +151,7 @@ jobs:
173151
cache-dependency-path: |
174152
package-lock.json
175153
test/package-lock.json
154+
176155
- run: npm ci
177156
- run: npm run build
178157
- run: npm run build:vscode

0 commit comments

Comments
 (0)