1
0
mirror of https://github.com/golang/go synced 2024-11-19 02:24:41 -07:00
go/gopls/integration/govim/run_local.sh
Rob Findley 850357681a gopls/integration/govim: update build steps to capture artifacts
Govim integration tests generate a number of artifacts, including both
the govim and gopls logs, that can be useful in debugging failures. This
change updates our cloud build configuration to capture these artifacts,
along with several other minor improvements.

Notably artifacts are uploaded to GCS as a separate build step, so that
we have the potential to use its granular permission model for sharing
these artifacts. Right now, this requires temporarily swallowing the
exit code of `go test` so that the build can proceed.

Also:
 - Update govim to a newer version; we still can't use latest as there
   isn't a tagged version that contains the requisite flag change.
 - Alter the test harness to run tests from the github.com/govim/govim
   module root.
 - Switch use a major version label when referring to the test harness
   build step, to allow for breaking changes (such as the one made
   here).
 - Add a missing copyright header to run_local.sh.
 - Update run_local.sh to work with the modified harness.
 - Update documentation accordingly.

Change-Id: Ie5ddaf54e775371a36163f98c1beb90c217be931
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214577
Run-TryBot: Robert Findley <rfindley@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2020-01-15 14:49:07 +00:00

36 lines
1.2 KiB
Bash
Executable File

#!/bin/bash -e
# Copyright 2019 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Run govim integration tests against a local gopls.
# TODO(findleyr): this script assumes that docker may be run without sudo.
# Update it to escalate privileges if and only if necessary.
# Find the tools root, so that this script can be run from any directory.
script_dir=$(dirname "$(readlink -f "$0")")
tools_dir=$(readlink -f "${script_dir}/../../..")
# Build gopls.
cd "${tools_dir}/gopls"
temp_gopls=$(mktemp -p "$PWD")
trap "rm -f \"${temp_gopls}\"" EXIT
go build -o "${temp_gopls}"
# Build the test harness. Here we are careful to pass in a very limited build
# context so as to optimize caching.
cd "${tools_dir}"
docker build -t gopls-govim-harness -f gopls/integration/govim/Dockerfile \
gopls/integration/govim
# Run govim integration tests.
echo "running govim integration tests using ${temp_gopls}"
temp_gopls_name=$(basename "${temp_gopls}")
docker run --rm -t \
-v "${tools_dir}:/src/tools" \
-w "/src/govim" \
gopls-govim-harness \
go test ./cmd/govim \
-gopls "/src/tools/gopls/${temp_gopls_name}"