Skip to content

Commit

Permalink
fixup! fixup! fixup! fixup! fixup! fixup! fixup! fixup! ci: Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nhooyr committed Oct 10, 2023
1 parent f74ace6 commit 157e664
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 36 deletions.
33 changes: 11 additions & 22 deletions ci/test.sh
Original file line number Diff line number Diff line change
@@ -1,25 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail
#!/bin/sh
set -eu
cd -- "$(dirname "$0")/.."

main() {
cd "$(dirname "$0")/.."
go install github.com/agnivade/wasmbrowsertest@latest
go test --race --timeout=1h --covermode=atomic --coverprofile=ci/out/coverage.prof --coverpkg=./... "$@" ./...
sed -i.bak '/stringer\.go/d' ci/out/coverage.prof
sed -i.bak '/nhooyr.io\/websocket\/internal\/test/d' ci/out/coverage.prof
sed -i.bak '/examples/d' ci/out/coverage.prof

go test -timeout=30m -covermode=atomic -coverprofile=ci/out/coverage.prof -coverpkg=./... "$@" ./...
sed -i.bak '/stringer\.go/d' ci/out/coverage.prof
sed -i.bak '/nhooyr.io\/websocket\/internal\/test/d' ci/out/coverage.prof
sed -i.bak '/examples/d' ci/out/coverage.prof
# Last line is the total coverage.
go tool cover -func ci/out/coverage.prof | tail -n1

# Last line is the total coverage.
go tool cover -func ci/out/coverage.prof | tail -n1

go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html

if [[ ${CI-} && ${GITHUB_REF-} == *master ]]; then
local deployDir
deployDir="$(mktemp -d)"
cp ci/out/coverage.html "$deployDir/index.html"
netlify deploy --prod "--dir=$deployDir"
fi
}

main "$@"
go tool cover -html=ci/out/coverage.prof -o=ci/out/coverage.html
18 changes: 4 additions & 14 deletions make.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,7 @@
#!/bin/sh
set -eu
cd -- "$(dirname "$0")"

cd "$(dirname "$0")"

fmt() {
go mod tidy
gofmt -s -w .
goimports -w "-local=$(go list -m)" .
}

if ! command -v wasmbrowsertest > /dev/null; then
go install github.com/agnivade/wasmbrowsertest@latest
fi

fmt
go test -race --timeout=1h ./... "$@"
./ci/fmt.sh
./ci/lint.sh
./ci/test.sh

0 comments on commit 157e664

Please sign in to comment.