From 1e606557d0a5a958d806a38bf314f94bc51266bd Mon Sep 17 00:00:00 2001 From: Anmol Sethi <hi@nhooyr.io> Date: Tue, 20 Aug 2019 19:49:15 -0400 Subject: [PATCH] Remove useless ci/lib.sh and add script to push docker image --- .circleci/config.yml | 3 +++ ci/bench.sh | 3 ++- ci/fmt.sh | 2 +- ci/{ => image}/Dockerfile | 0 ci/image/push.sh | 7 +++++++ ci/lib.sh | 5 ----- ci/lint.sh | 2 +- ci/run.sh | 2 +- ci/test.sh | 3 ++- docs/CONTRIBUTING.md | 2 +- 10 files changed, 18 insertions(+), 11 deletions(-) rename ci/{ => image}/Dockerfile (100%) create mode 100755 ci/image/push.sh delete mode 100644 ci/lib.sh diff --git a/.circleci/config.yml b/.circleci/config.yml index 1149545..59350e0 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -83,3 +83,6 @@ workflows: test: jobs: - test + bench: + jobs: + - bench \ No newline at end of file diff --git a/ci/bench.sh b/ci/bench.sh index d9249e6..98a74af 100755 --- a/ci/bench.sh +++ b/ci/bench.sh @@ -2,8 +2,9 @@ set -euo pipefail cd "$(dirname "${0}")" -source ./lib.sh +cd "$(git rev-parse --show-toplevel)" +mkdir -p ci/out go test -vet=off -run=^$ -bench=. -o=ci/out/websocket.test \ -cpuprofile=ci/out/cpu.prof \ -memprofile=ci/out/mem.prof \ diff --git a/ci/fmt.sh b/ci/fmt.sh index ce277af..cd1e7b1 100755 --- a/ci/fmt.sh +++ b/ci/fmt.sh @@ -2,7 +2,7 @@ set -euo pipefail cd "$(dirname "${0}")" -source ./lib.sh +cd "$(git rev-parse --show-toplevel)" gen() { # Unfortunately, this is the only way to ensure go.mod and go.sum are correct. diff --git a/ci/Dockerfile b/ci/image/Dockerfile similarity index 100% rename from ci/Dockerfile rename to ci/image/Dockerfile diff --git a/ci/image/push.sh b/ci/image/push.sh new file mode 100755 index 0000000..fdc321d --- /dev/null +++ b/ci/image/push.sh @@ -0,0 +1,7 @@ +#!/usr/bin/env bash + +set -euo pipefail +cd "$(dirname "${0}")" + +docker build -t nhooyr/websocket-ci . +docker push nhooyr/websocket-ci diff --git a/ci/lib.sh b/ci/lib.sh deleted file mode 100644 index 4cfe1ff..0000000 --- a/ci/lib.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/usr/bin/env bash - -set -euo pipefail - -cd "$(git rev-parse --show-toplevel)" diff --git a/ci/lint.sh b/ci/lint.sh index 00dcbd3..9077286 100755 --- a/ci/lint.sh +++ b/ci/lint.sh @@ -2,7 +2,7 @@ set -euo pipefail cd "$(dirname "${0}")" -source ./lib.sh +cd "$(git rev-parse --show-toplevel)" # shellcheck disable=SC2046 shellcheck -e SC1091 -x $(git ls-files "*.sh") diff --git a/ci/run.sh b/ci/run.sh index 8bf1905..56da2d9 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -4,7 +4,7 @@ set -euo pipefail cd "$(dirname "${0}")" -source ./lib.sh +cd "$(git rev-parse --show-toplevel)" ./ci/fmt.sh ./ci/lint.sh diff --git a/ci/test.sh b/ci/test.sh index 1079d54..57089b6 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -2,8 +2,9 @@ set -euo pipefail cd "$(dirname "${0}")" -source ./lib.sh +cd "$(git rev-parse --show-toplevel)" +mkdir -p ci/out # If you'd like to modify the args to go test, just run go test directly, this script is meant # for running tests at the end to get coverage and test under the race detector. go test -race -vet=off -coverprofile=ci/out/coverage.prof -coverpkg=./... ./... diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index adc1bd0..6a77d1b 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -40,4 +40,4 @@ installation of shellcheck, node and the Autobahn test suite on Debian or Ubuntu For Go, please refer to the [offical docs](https://golang.org/doc/install). You can benchmark the library with `./ci/benchmark.sh`. You only need Go to run that script. Benchmark -profiles generated by that script are also available as artifacts on the bench step. \ No newline at end of file +profiles generated by that script are also available as artifacts on the bench step. -- GitLab