good morning!!!!

Skip to content
Snippets Groups Projects
Unverified Commit 20ccbc4c authored by Anmol Sethi's avatar Anmol Sethi
Browse files

Improve CONTRIBUTING.md

parent d8abc3a8
No related branches found
No related tags found
No related merge requests found
......@@ -56,28 +56,6 @@ jobs:
- store_test_results:
path: ci/out
bench:
docker:
- image: nhooyr/websocket-ci
steps:
- checkout
- restore_cache:
keys:
- go-v3-{{ checksum "go.sum" }}
# Fallback to using the latest cache if no exact match is found.
- go-v3-
- run: ./ci/bench.sh
- store_artifacts:
path: ci/out
destination: out
- save_cache:
paths:
- /root/gopath
- /root/.cache/go-build
key: go-v3-{{ checksum "go.sum" }}
- store_test_results:
path: ci/out
workflows:
version: 2
fmt:
......@@ -89,6 +67,3 @@ workflows:
test:
jobs:
- test
bench:
jobs:
- bench
#!/usr/bin/env bash
set -euo pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
mkdir -p ci/out/gobench
benchArgs=(
"-vet=off"
"-run=^$"
"-bench=."
"-o=ci/out/websocket.test"
"-cpuprofile=ci/out/cpu.prof"
"-memprofile=ci/out/mem.prof"
"-blockprofile=ci/out/block.prof"
"-mutexprofile=ci/out/mutex.prof"
.
)
if [[ ${CI-} ]]; then
# https://circleci.com/docs/2.0/collect-test-data/
go test "${benchArgs[@]}" | tee /dev/stderr |
go run github.com/jstemmer/go-junit-report > ci/out/gobench/report.xml
else
go test "${benchArgs[@]}"
fi
echo
echo "Profiles are in ./ci/out/*.prof
Keep in mind that every profiler Go provides is enabled so that may skew the benchmarks."
......@@ -8,4 +8,4 @@ cd "$(git rev-parse --show-toplevel)"
./ci/fmt.sh
./ci/lint.sh
./ci/test.sh
./ci/test.sh
\ No newline at end of file
......@@ -4,12 +4,12 @@ set -euo pipefail
cd "$(dirname "${0}")"
cd "$(git rev-parse --show-toplevel)"
mkdir -p ci/out/gotest
testFlags=(-race "-vet=off" "-coverprofile=ci/out/coverage.prof" "-coverpkg=./...")
mkdir -p ci/out/websocket
testFlags=(-race "-vet=off" "-bench=." "-coverprofile=ci/out/coverage.prof" "-coverpkg=./...")
if [[ ${CI-} ]]; then
# https://circleci.com/docs/2.0/collect-test-data/
go test "${testFlags[@]}" -v ./... 2>&1 | tee /dev/stderr |
go run github.com/jstemmer/go-junit-report > ci/out/gotest/report.xml
go run github.com/jstemmer/go-junit-report > ci/out/websocket/testReport.xml
else
go test "${testFlags[@]}" ./...
fi
......
......@@ -22,20 +22,20 @@ You can run tests normally with `go test`.
You'll need the [Autobahn Test suite pip package](https://github.com/crossbario/autobahn-testsuite).
In the future this dependency will be removed. See [#117](https://github.com/nhooyr/websocket/issues/117).
On submission please check if CI has passed and if not, please correct your code such that it does.
If necessary, you may run CI locally with the `ci/run.sh` script which will fmt, lint and test your code
with coverage.
You'll need [shellcheck](https://github.com/koalaman/shellcheck#installing), node and the
Autobahn Test suite linked above.
Please ensure CI passes for your changes. If necessary, you may run CI locally. The various steps are located
in `ci/*.sh`.
For coverage details locally, please see `ci/out/coverage.html` after running `ci/run.sh` or `ci/test.sh`.
For remote coverage, you can use either [codecov](https://codecov.io/gh/nhooyr/websocket) or download the
`coverage.html` artifact on the test step in CI.
`ci/fmt.sh` requires node (specifically prettier).
`ci/lint.sh` requires [shellcheck](https://github.com/koalaman/shellcheck#installing).
`ci/test.sh` requires the [Autobahn Test suite pip package](https://github.com/crossbario/autobahn-testsuite).
`ci/bench.sh` requires only Go.
`ci/run.sh` runs everything in the above order and requires all of their dependencies.
You can also run any of the CI steps individually. All of them are scripts in the `ci` directory.
See [../ci/image/Dockerfile](../ci/image/Dockerfile) for the installation of the CI dependencies on ubuntu.
See [../ci/image/Dockerfile](../ci/image/Dockerfile) for the
installation of the CI dependencies on arch linux.
For CI coverage, you can use either [codecov](https://codecov.io/gh/nhooyr/websocket) or click the
`coverage.html` artifact on the test step in CI.
For coverage details locally, please see `ci/out/coverage.html` after running `ci/run.sh` or `ci/test.sh`.
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.
Benchmark profiles generated by `bench.sh` are available as artifacts on the bench step so that they
may be analyzed.
......@@ -1035,7 +1035,7 @@ func BenchmarkConn(b *testing.B) {
b.Run("echo", func(b *testing.B) {
for _, size := range sizes {
b.Run(strconv.Itoa(size), func(b *testing.B) {
benchConn(b, false, false, size)
benchConn(b, true, true, size)
})
}
})
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment