Skip to content

Commit b018502

Browse files
committed
Fix Travis build script
1 parent 9af553e commit b018502

File tree

5 files changed

+17
-9
lines changed

5 files changed

+17
-9
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ before_install:
2121
libsecret-1-dev; fi
2222
- npm install -g [email protected]
2323
script:
24-
- scripts/build.sh
24+
- scripts/build.bash
2525
before_deploy:
2626
- echo "$VERSION" "$TRAVIS_COMMIT"
2727
- git config --local user.name "$USER_NAME"

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ COPY . .
1313

1414
# In the future, we can use https://github.com/yarnpkg/rfcs/pull/53 to make yarn use the node_modules
1515
# directly which should be fast as it is slow because it populates its own cache every time.
16-
RUN yarn && NODE_ENV=production yarn task build:server:binary
16+
RUN yarn && yarn build
1717

1818
# We deploy with ubuntu so that devs have a familiar environment.
1919
FROM ubuntu:18.04

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"postinstall": "yarn build:rules",
1111
"build": "yarn task build",
1212
"bundle": "yarn task bundle",
13+
"package": "yarn task package",
1314
"start": "npm-run-all --parallel watch build:run",
1415
"watch": "yarn task build true",
1516
"build:run": "cd ./out && node ./packages/server/src/cli # TODO: restart on change",

scripts/build.bash

+9-5
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ set -euxo pipefail
55
function docker_build() {
66
local image="${1}" ; shift
77
local version="${1}" ; shift
8+
local ci=${CI:-}
89

910
local containerId
1011
containerId=$(docker create --network=host --rm -it -v "$(pwd)"/.cache:/src/.cache "${image}")
@@ -18,8 +19,9 @@ function docker_build() {
1819
docker cp ./. "${containerId}":/src
1920
docker_exec "cd /src && yarn"
2021
docker_exec "cd /src && npm rebuild"
21-
docker_exec "cd /src && NODE_ENV=production VERSION=${version} yarn task build:server:binary"
22-
docker_exec "cd /src && yarn task package ${version}"
22+
docker_exec "cd /src && VERSION=${version} CI=${ci} yarn build"
23+
docker_exec "cd /src && yarn bundle"
24+
docker_exec "cd /src && yarn package ${version}"
2325
docker cp "${containerId}":/src/release/. ./release/
2426

2527
docker stop "${containerId}"
@@ -28,18 +30,20 @@ function docker_build() {
2830
function main() {
2931
local version=${VERSION:-}
3032
local ostype=${OSTYPE:-}
33+
local target=${TARGET:-}
3134

3235
if [[ -z "${version}" ]] ; then
3336
>&2 echo "Must set VERSION environment variable"
3437
exit 1
3538
fi
3639

3740
if [[ "${ostype}" == "darwin"* ]]; then
38-
NODE_ENV=production VERSION="${version}" yarn task build:server:binary
39-
yarn task package "${version}"
41+
VERSION="${version}" yarn build
42+
yarn bundle
43+
yarn package "${version}"
4044
else
4145
local image
42-
if [[ "$TARGET" == "alpine" ]]; then
46+
if [[ "${target}" == "alpine" ]]; then
4347
image="codercom/nbin-alpine"
4448
else
4549
image="codercom/nbin-centos"

scripts/tasks.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ register("build", async (runner, logger, shouldWatch: string) => {
2525
const watch = shouldWatch === "true";
2626

2727
logger.info("Building", field("env", {
28-
NODE_ENV: process.env.NODE_ENV,
2928
VERSION: process.env.VERSION,
3029
}), field("vscode", vscodeVersion), field("watch", watch));
3130

@@ -153,7 +152,11 @@ const ensureInstalled = register("vscode:install", async (runner, logger) => {
153152
}));
154153
break;
155154
case 404:
156-
logger.info(`VS Code ${vscodeVersion} hasn't been packaged yet`);
155+
const message = `VS Code ${vscodeVersion} hasn't been packaged yet`;
156+
if (process.env.CI) {
157+
return reject(new Error(message));
158+
}
159+
logger.warn(message);
157160
clone().then(() => build()).catch(reject);
158161
break;
159162
default:

0 commit comments

Comments
 (0)