From 62f050fda795c30b9faf43a3efeffa64f1d979b4 Mon Sep 17 00:00:00 2001 From: Asher Date: Wed, 15 Jan 2020 12:05:27 -0600 Subject: [PATCH] Add a simple test --- package.json | 1 + scripts/ci.bash | 8 +++----- scripts/test.sh | 19 +++++++++++++++++++ 3 files changed, 23 insertions(+), 5 deletions(-) create mode 100755 scripts/test.sh diff --git a/package.json b/package.json index 2987400fa..12dcf927d 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "scripts": { "runner": "cd ./scripts && node --max-old-space-size=32384 -r ts-node/register ./build.ts", "start": "nodemon --watch ../../../out --verbose ../../../out/vs/server/main.js", + "test": "./scripts/test.sh", "watch": "cd ../../../ && yarn watch", "build": "yarn && yarn runner build", "package": "yarn runner package", diff --git a/scripts/ci.bash b/scripts/ci.bash index 4eb6b313f..77fe12b41 100755 --- a/scripts/ci.bash +++ b/scripts/ci.bash @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # ci.bash -- Build code-server in the CI. set -euo pipefail @@ -9,7 +9,7 @@ function main() { # Get the version information. If a specific version wasn't set, generate it # from the tag and VS Code version. local vscode_version=${VSCODE_VERSION:-1.41.1} - local code_server_version=${VERSION:-2.${TRAVIS_TAG:-${DRONE_TAG:-daily}}-vsc$vscode_version} + local code_server_version=${VERSION:-2.${TRAVIS_TAG:-${DRONE_TAG:-daily}}} # Remove everything that isn't the current VS Code source for caching # (otherwise the cache will contain old versions). @@ -32,9 +32,7 @@ function main() { } run-yarn build - if [[ -n ${PACKAGE:-} || -n ${BINARY:-} ]] ; then - run-yarn binary - fi + run-yarn binary if [[ -n ${PACKAGE:-} ]] ; then run-yarn package fi diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 000000000..2765e77cd --- /dev/null +++ b/scripts/test.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env sh +# test.sh -- Simple test for CI. +# We'll have more involved tests eventually. This just ensures the binary has +# been built and runs. + +set -eu + +main() { + cd "$(dirname "$0")/.." + + version=$(./binaries/code-server* --version | head -1) + echo "Got '$version' for the version" + case $version in + *2.*-vsc1.41.1) exit 0 ;; + *) exit 1 ;; + esac +} + +main "$@"