*(global): CI scripts

This commit is contained in:
Andrey Meshkov 2019-10-02 15:41:14 +03:00
parent c020c1d0af
commit b835baf013
5 changed files with 41 additions and 10 deletions

1
.gitignore vendored
View File

@ -12,6 +12,7 @@
/querylog.json
/querylog.json.1
/a_main-packr.go
coverage.txt
# Test output
dnsfilter/tests/top-1m.csv

View File

@ -38,6 +38,9 @@ linters:
- gochecknoinits
- prealloc
- maligned
- godox
- funlen
- whitespace
- goconst # disabled until it's possible to configure
fast: true

View File

@ -11,6 +11,7 @@ os:
before_install:
- nvm install node
- npm install -g npm
- go install github.com/golangci/golangci-lint/cmd/golangci-lint
install:
- npm --prefix client install
@ -22,13 +23,7 @@ cache:
- $HOME/Library/Caches/go-build
script:
- node -v
- npm -v
# Run tests
- go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./...
# Make
- make build/static/index.html
- make
- /bin/bash ci.sh
after_success:
- bash <(curl -s https://codecov.io/bash)

32
ci.sh Executable file
View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
set -x
# Check versions and current directory
node -v
npm -v
go version
golangci-lint --version
# Print the current directory contents
ls -la
# Run linter
golangci-lint run
# Run tests
go test -race -v -bench=. -coverprofile=coverage.txt -covermode=atomic ./...
# Make
make clean
make build/static/index.html
make
if [[ -z "$(git status --porcelain)" ]]; then
# Working directory clean
echo "Git status is clean"
else
echo "Git status is not clean and contains uncommited changes"
echo "Please make sure there are no changes"
exit 1
fi

View File

@ -271,7 +271,7 @@ func (r *Reader) BeginReadPrev(olderThan time.Time, count uint64) {
if int64(off) < maxEntrySize {
off = 0
}
r.fpos = uint64(off)
r.fpos = off
log.Debug("QueryLog: seek: %x", off)
_, err := r.f.Seek(int64(off), io.SeekStart)
if err != nil {
@ -376,7 +376,7 @@ func (r *Reader) prepareRead() bool {
if int64(off) < maxEntrySize {
off = 0
}
r.fpos = uint64(off)
r.fpos = off
log.Debug("QueryLog: seek: %x", off)
_, err = r.f.Seek(int64(off), io.SeekStart)
if err != nil {