Add a simple test

This commit is contained in:
Asher 2020-01-15 12:05:27 -06:00
parent 57425377e5
commit 62f050fda7
No known key found for this signature in database
GPG Key ID: D63C1EF81242354A
3 changed files with 23 additions and 5 deletions

View File

@ -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",

View File

@ -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

19
scripts/test.sh Executable file
View File

@ -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 "$@"