Avoid docker buildkite plugin, which is not supported by bkrun

This commit is contained in:
Grimes 2018-05-28 14:07:30 -07:00 committed by Grimes
parent 5af922722f
commit 26153d9919
5 changed files with 56 additions and 50 deletions

View File

@ -1,32 +1,12 @@
steps:
- command: "ci/coverage.sh"
name: "coverage [public]"
# TODO: Run coverage in a docker image rather than assuming kcov/cargo-kcov
# is installed on the build agent...
#plugins:
# docker#v1.1.1:
# image: "rust"
# user: "998:997" # buildkite-agent:buildkite-agent
# environment:
# - CODECOV_TOKEN
- command: "ci/test-stable.sh"
- command: "ci/docker-run.sh rust ci/test-stable.sh"
name: "stable [public]"
plugins:
docker#v1.1.1:
image: "rust"
user: "998:997" # buildkite-agent:buildkite-agent
- command: "ci/test-nightly.sh || true"
- command: "ci/docker-run.sh rustlang/rust:nightly ci/test-nightly.sh || true"
name: "nightly - FAILURES IGNORED [public]"
plugins:
docker#v1.1.1:
image: "rustlang/rust:nightly"
user: "998:997" # buildkite-agent:buildkite-agent
- command: "ci/test-ignored.sh"
- command: "ci/docker-run.sh rust ci/test-ignored.sh"
name: "ignored [public]"
plugins:
docker#v1.1.1:
image: "rust"
user: "998:997" # buildkite-agent:buildkite-agent
- command: "ci/test-cuda.sh"
name: "cuda"
- command: "ci/shellcheck.sh"
@ -34,10 +14,3 @@ steps:
- wait
- command: "ci/publish.sh"
name: "publish release artifacts"
plugins:
docker#v1.1.1:
image: "rust"
user: "998:997" # buildkite-agent:buildkite-agent
environment:
- BUILDKITE_TAG
- CRATES_IO_TOKEN

View File

@ -2,20 +2,15 @@
cd "$(dirname "$0")/.."
if [[ -r ~/.cargo/env ]]; then
# Pick up local install of kcov/cargo-kcov
# shellcheck disable=SC1090
source ~/.cargo/env
fi
ci/docker-run.sh evilmachines/rust-cargo-kcov \
bash -exc "\
export RUST_BACKTRACE=1; \
cargo build --verbose; \
cargo kcov --lib --verbose; \
"
rustc --version
cargo --version
kcov --version
cargo-kcov --version
export RUST_BACKTRACE=1
cargo build
cargo kcov --lib
echo Coverage report:
ls -l target/cov/index.html
if [[ -z "$CODECOV_TOKEN" ]]; then
echo CODECOV_TOKEN undefined

41
ci/docker-run.sh Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash -e
usage() {
echo "Usage: $0 [docker image name] [command]"
echo
echo Runs command in the specified docker image with
echo a CI-appropriate environment
echo
}
cd "$(dirname "$0")/.."
IMAGE="$1"
if [[ -z "$IMAGE" ]]; then
echo Error: image not defined
exit 1
fi
docker pull "$IMAGE"
shift
ARGS=(--workdir /solana --volume "$PWD:/solana" --rm)
ARGS+=(--env "CARGO_HOME=/solana/.cargo")
# kcov tries to set the personality of the binary which docker
# doesn't allow by default.
ARGS+=(--security-opt "seccomp=unconfined")
# Ensure files are created with the current host uid/gid
ARGS+=(--user "$(id -u):$(id -g)")
# Environment variables to propagate into the container
ARGS+=(
--env BUILDKITE_TAG
--env CODECOV_TOKEN
--env CRATES_IO_TOKEN
)
set -x
docker run "${ARGS[@]}" "$IMAGE" "$@"

View File

@ -12,8 +12,8 @@ if [[ -z "$CRATES_IO_TOKEN" ]]; then
exit 1
fi
cargo package
# TODO: Ensure the published version matches the contents of BUILDKITE_TAG
cargo publish --token "$CRATES_IO_TOKEN"
ci/docker-run.sh rust \
bash -exc "cargo package; cargo publish --token $CRATES_IO_TOKEN"
exit 0

View File

@ -5,10 +5,7 @@
cd "$(dirname "$0")/.."
set -x
docker pull koalaman/shellcheck
find -E . -name "*.sh" -not -regex ".*/(.cargo|node_modules)/.*" -print0 \
find . -name "*.sh" -not -regex ".*/.cargo/.*" -not -regex ".*/node_modules/.*" -print0 \
| xargs -0 \
docker run -w /work -v "$PWD:/work" \
koalaman/shellcheck --color=always --external-sources --shell=bash
ci/docker-run.sh koalaman/shellcheck --color=always --external-sources --shell=bash
exit 0