зеркало из https://github.com/golang/pkgsite.git
devtools/ci: add files for CI
Files used for kokoro are copied to devtools/ci along with a README.md, so that it is clear what these files are used for. The existing files will be deleted in the next CL, after an internal CL is merged to change references. Change-Id: I893ac9461d3f775460ba749da80e2b4ba71dcc1e Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/325129 Trust: Julie Qiu <julie@golang.org> Reviewed-by: Jonathan Amsterdam <jba@google.com>
This commit is contained in:
Родитель
7bf1c20471
Коммит
0d2439f018
6
all.bash
6
all.bash
|
@ -180,7 +180,7 @@ run_build_static() {
|
|||
}
|
||||
|
||||
run_npm() {
|
||||
npmcmd="./devtools/docker_nodejs.sh npm"
|
||||
npmcmd="./devtools/ci/docker_nodejs.sh npm"
|
||||
if [[ -x "$(command -v npm)" ]]; then
|
||||
npmcmd="npm"
|
||||
fi
|
||||
|
@ -192,7 +192,7 @@ run_npm() {
|
|||
}
|
||||
|
||||
run_npx() {
|
||||
npxcmd="./devtools/docker_nodejs.sh npx"
|
||||
npxcmd="./devtools/ci/docker_nodejs.sh npx"
|
||||
if [[ -x "$(command -v npx)" ]]; then
|
||||
npxcmd="npx"
|
||||
fi
|
||||
|
@ -216,7 +216,7 @@ run_prettier() {
|
|||
if [[ -x "$(command -v npx)" ]]; then
|
||||
runcmd npx prettier --write $files
|
||||
else
|
||||
runcmd ./devtools/docker_nodejs.sh npx prettier --write $files
|
||||
runcmd ./devtools/ci/docker_nodejs.sh npx prettier --write $files
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# CI
|
||||
|
||||
The Go pkgsite project uses a continuous integration service called “Kokoro”
|
||||
for running tests.
|
||||
|
||||
This directory contains files used for kokoro test job configurations.
|
||||
(Additional job definitions live in an internal repository). The shell scripts
|
||||
that act as entry points to execute the actual tests.
|
|
@ -0,0 +1,47 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2020 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.
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<EOUSAGE
|
||||
Usage: $0 [--sudo]
|
||||
|
||||
Run standard CI (tests and linters) using local docker. If --sudo is set, run
|
||||
docker with sudo.
|
||||
EOUSAGE
|
||||
}
|
||||
|
||||
maybe_sudo=
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
"-h" | "--help" | "help")
|
||||
usage
|
||||
exit 0
|
||||
;;
|
||||
"--sudo")
|
||||
maybe_sudo="sudo "
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
usage
|
||||
exit 1
|
||||
esac
|
||||
done
|
||||
|
||||
# Find the repo root.
|
||||
script_dir=$(dirname "$(readlink -f "$0")")
|
||||
pkgsite_dir=$(readlink -f "${script_dir}/..")
|
||||
|
||||
# Run postgres.
|
||||
pg_container=$(${maybe_sudo}docker run --rm -d -e LANG=C postgres:11.4)
|
||||
trap "${maybe_sudo} docker stop ${pg_container}" EXIT
|
||||
|
||||
# Run all.bash. To avoid any port conflict, run in the postgres network.
|
||||
cd "${pkgsite_dir}"
|
||||
${maybe_sudo}docker run --rm -t \
|
||||
--network container:${pg_container} \
|
||||
-v $(pwd):"/workspace" -w "/workspace" \
|
||||
-e GO_DISCOVERY_TESTDB=true golang:1.15 ./all.bash ci
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env bash
|
||||
# Copyright 2021 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.
|
||||
|
||||
set -e
|
||||
|
||||
usage() {
|
||||
cat <<EOUSAGE
|
||||
Usage:
|
||||
|
||||
This is a placeholder file for running e2e tests in CI.
|
||||
EOUSAGE
|
||||
}
|
||||
|
||||
usage
|
|
@ -0,0 +1,20 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
# Copyright 2020 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.
|
||||
|
||||
set -e
|
||||
|
||||
# Script for running a nodejs docker image.
|
||||
# It passes env variables for e2e tests,
|
||||
# mounts the pwd into a volume in the container at /pkgsite,
|
||||
# and sets the working directory in the container to /pkgsite.
|
||||
|
||||
docker run --net=host --rm \
|
||||
-e GO_DISCOVERY_E2E_BASE_URL \
|
||||
-e GO_DISCOVERY_E2E_AUTHORIZATION \
|
||||
-e GO_DISCOVERY_E2E_QUOTA_BYPASS \
|
||||
-v `pwd`:/pkgsite \
|
||||
-w /pkgsite \
|
||||
node:15.14.0 $@
|
Загрузка…
Ссылка в новой задаче