Skip to content

Commit 1c30660

Browse files
committed
gopls/integration/govim: enable running at main
We're going to switch to running govim tests at main as post-submit CI rather than presubmit, and will also switch to running them via Kokoro using the run_local script rather than cloud build. Enable this by changing the semantics of run_local.sh to default to main. For #40451 Change-Id: I9c311dea8326a36a3f8335eddbfae0ce7f02f6bf Reviewed-on: https://go-review.googlesource.com/c/tools/+/245539 Run-TryBot: Robert Findley <[email protected]> Reviewed-by: Rebecca Stambler <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 6b78e25 commit 1c30660

File tree

2 files changed

+33
-12
lines changed

2 files changed

+33
-12
lines changed

gopls/integration/govim/Dockerfile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,12 @@
55
# govim requires a more recent version of vim than is available in most
66
# distros, so we build from their base image.
77
FROM govim/govim:latest-vim
8+
ARG GOVIM_REF
89

9-
# We use a pinned version of govim so that this build is repeatable, and so
10-
# that we're not sensitive to test breakages in govim.
11-
# TODO(findleyr): Once a version of govim has been tagged containing
12-
# https://github.com/govim/govim/pull/629, switch this to @latest.
1310
ENV GOPROXY=https://proxy.golang.org GOPATH=/go VIM_FLAVOR=vim
1411
WORKDIR /src
1512

1613
# Clone govim. In order to use the go command for resolving latest, we download
1714
# a redundant copy of govim to the build cache using `go mod download`.
18-
RUN GOVIM_VERSION=$(go mod download -json github.com/govim/govim@latest | jq -r .Version) && \
19-
git clone https://github.com/govim/govim /src/govim && cd /src/govim && \
20-
git checkout $GOVIM_VERSION
15+
RUN git clone https://github.com/govim/govim /src/govim && cd /src/govim && \
16+
git checkout $GOVIM_REF

gopls/integration/govim/run_local.sh

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,22 @@
88

99
usage() {
1010
cat <<EOUSAGE
11-
Usage: $0 [--sudo] [--short]
11+
Usage: $0 [--sudo] [--short] [--version (semver|latest)]
1212
13-
Run govim tests against HEAD using local docker. If --sudo is set, run docker
14-
with sudo. If --short is set, run `go test` with `-short`.
13+
Args:
14+
--sudo run docker with sudo
15+
--short run `go test` with `-short`
16+
--version run on the specific tagged Go version (or latest) rather
17+
than the default branch
18+
19+
Run govim tests against HEAD using local docker.
1520
EOUSAGE
1621
}
1722

1823
SUDO_IF_NEEDED=
1924
TEST_SHORT=
25+
DOCKERFILE=gopls/integration/govim/Dockerfile
26+
GOVIM_REF=main
2027
while [[ $# -gt 0 ]]; do
2128
case "$1" in
2229
"-h" | "--help" | "help")
@@ -31,6 +38,20 @@ while [[ $# -gt 0 ]]; do
3138
TEST_SHORT="-short"
3239
shift
3340
;;
41+
"--version")
42+
if [[ -z "$2" ]]; then
43+
usage
44+
exit 1
45+
fi
46+
GOVIM_REF=$2
47+
if [[ "${GOVIM_REF}" == "latest" ]]; then
48+
TMPGOPATH=$(mktemp -d)
49+
trap "GOPATH=${TMPGOPATH} go clean -modcache && rm -r ${TMPGOPATH}" EXIT
50+
GOVIM_REF=$(GOPATH=${TMPGOPATH} go mod download -json \
51+
github.com/govim/govim@latest | jq -r .Version)
52+
fi
53+
shift 2
54+
;;
3455
*)
3556
usage
3657
exit 1
@@ -49,8 +70,12 @@ go build -o "${temp_gopls}"
4970

5071
# Build the test harness. Here we are careful to pass in a very limited build
5172
# context so as to optimize caching.
73+
echo "Checking out govim@${GOVIM_REF}"
5274
cd "${tools_dir}"
53-
${SUDO_IF_NEEDED}docker build -t gopls-govim-harness -f gopls/integration/govim/Dockerfile \
75+
${SUDO_IF_NEEDED}docker build \
76+
--build-arg GOVIM_REF="${GOVIM_REF}" \
77+
-t gopls-govim-harness:${GOVIM_REF} \
78+
-f gopls/integration/govim/Dockerfile \
5479
gopls/integration/govim
5580

5681
# Run govim integration tests.
@@ -60,6 +85,6 @@ ${SUDO_IF_NEEDED}docker run --rm -t \
6085
-v "${tools_dir}:/src/tools" \
6186
-w "/src/govim" \
6287
--ulimit memlock=-1:-1 \
63-
gopls-govim-harness \
88+
gopls-govim-harness:${GOVIM_REF} \
6489
go test ${TEST_SHORT} ./cmd/govim \
6590
-gopls "/src/tools/gopls/${temp_gopls_name}"

0 commit comments

Comments
 (0)