From d0cbc78ba786584ded4a4b83cc55d7a9c573b133 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1s=20Senart?= Date: Sun, 11 Oct 2020 12:30:58 +0200 Subject: [PATCH] Setup Github Actions based CI (#456) * .github/workflows: CI * fixup! Set FUZZIT_API_KEY * fixup! Test on ubuntu only * fixup! Update fuzzit * fixup! Only test on latest Go version * fixup! Rename to ci * fixup! Remove travis and fuzzit * fixup! Update deepsource analyzers * fixup! Update badge * fixup! Remove race --- .deepsource.toml | 11 ++++++++++- .github/workflows/ci.yml | 20 ++++++++++++++++++++ .goreleaser.yml | 35 ----------------------------------- .travis.yml | 22 ---------------------- README.md | 11 +++++++++-- fuzzit.sh | 40 ---------------------------------------- lib/results_test.go | 4 ++-- 7 files changed, 41 insertions(+), 102 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .goreleaser.yml delete mode 100644 .travis.yml delete mode 100755 fuzzit.sh diff --git a/.deepsource.toml b/.deepsource.toml index 89cad58c..4ab01bce 100644 --- a/.deepsource.toml +++ b/.deepsource.toml @@ -3,4 +3,13 @@ version = 1 [[analyzers]] name = "python" enabled = true -runtime_version = "3.x.x" \ No newline at end of file + + [analyzers.meta] + runtime_version = "3.x.x" + +[[analyzers]] +name = "go" +enabled = true + + [analyzers.meta] + import_paths = ["github.com/tsenart/vegeta"] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..987fb840 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +on: [push, pull_request] +name: CI +jobs: + ci: + strategy: + matrix: + go-version: [1.13.x] + platform: [ubuntu-latest] + runs-on: ${{ matrix.platform }} + steps: + - name: Install Go + uses: actions/setup-go@v1 + with: + go-version: ${{ matrix.go-version }} + - name: Checkout code + uses: actions/checkout@v1 + - name: Vet + run: go vet ./... + - name: Test + run: go test -race -v ./... diff --git a/.goreleaser.yml b/.goreleaser.yml deleted file mode 100644 index 9a51a899..00000000 --- a/.goreleaser.yml +++ /dev/null @@ -1,35 +0,0 @@ -builds: -- goos: - - freebsd - - linux - - darwin - - windows - goarch: - - amd64 - - arm64 - - arm - goarm: - - 7 - env: - - CGO_ENABLED=0 - flags: - - -a - - -tags="netgo" - ldflags: - - -s -w -extldflags "-static" -X main.Version={{.Version}} -X main.Commit={{.Commit}} -X main.Date={{.Date}}" - -release: - name_template: "v{{.Version}}" - -archive: - name_template: "{{.ProjectName}}-{{.Version}}-{{.Os}}-{{.Arch}}" - format: tar.gz - format_overrides: - - goos: windows - format: zip - -checksum: - name_template: "{{ .ProjectName }}-checksums.txt" - -sign: - artifacts: checksum diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 8427aa0b..00000000 --- a/.travis.yml +++ /dev/null @@ -1,22 +0,0 @@ -dist: bionic -language: go -services: - - docker -go: - - 1.13.x -install: - - go get -v golang.org/x/lint/golint - - go get -d -t -v ./... - - go build -v ./... -jobs: - include: - - stage: Test - script: - - go vet ./... - - $HOME/gopath/bin/golint -set_exit_status $(go list ./... | grep -v /vendor/) - - go test -v ./... - - stage: Fuzz regression - script: ./fuzzit.sh local-regression - # - stage: Fuzz - # if: branch = master AND type IN (push) - # script: ./fuzzit.sh fuzzing diff --git a/README.md b/README.md index 88f58a35..811ce18d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Vegeta [![Build Status](https://secure.travis-ci.org/tsenart/vegeta.svg?branch=master)](http://travis-ci.org/tsenart/vegeta) [![Fuzzit Status](https://app.fuzzit.dev/badge?org_id=vegeta)](https://app.fuzzit.dev/orgs/vegeta/dashboard) [![Go Report Card](https://goreportcard.com/badge/github.com/tsenart/vegeta)](https://goreportcard.com/report/github.com/tsenart/vegeta) [![GoDoc](https://godoc.org/github.com/tsenart/vegeta?status.svg)](https://godoc.org/github.com/tsenart/vegeta) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tsenart/vegeta?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Donate](https://img.shields.io/badge/donate-bitcoin-yellow.svg)](#donate) +# Vegeta [![Build Status](https://github.com/tsenart/vegeta/workflows/ci/badge.svg)](https://github.com/tsenart/vegeta/actions) [![Go Report Card](https://goreportcard.com/badge/github.com/tsenart/vegeta)](https://goreportcard.com/report/github.com/tsenart/vegeta) [![GoDoc](https://godoc.org/github.com/tsenart/vegeta?status.svg)](https://godoc.org/github.com/tsenart/vegeta) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/tsenart/vegeta?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) [![Donate](https://img.shields.io/badge/donate-bitcoin-yellow.svg)](#donate) Vegeta is a versatile HTTP load testing tool built out of a need to drill HTTP services with a constant request rate. @@ -466,7 +466,14 @@ All duration like fields are in nanoseconds. "max": 3660505, "min": 1949582 }, - "buckets": {"0":9952,"1000000":40,"2000000":6,"3000000":0,"4000000":0,"5000000":2}, + "buckets": { + "0": 9952, + "1000000": 40, + "2000000": 6, + "3000000": 0, + "4000000": 0, + "5000000": 2 + }, "bytes_in": { "total": 606700, "mean": 6067 diff --git a/fuzzit.sh b/fuzzit.sh deleted file mode 100755 index 5f5e006a..00000000 --- a/fuzzit.sh +++ /dev/null @@ -1,40 +0,0 @@ -#!/bin/bash -set -xe - -# Validate arguments -if [ "$#" -ne 1 ]; then - echo "Usage: $0 " - exit 1 -fi - -# Configure -NAME=vegeta -ROOT=./lib -TYPE=$1 - -# Setup -export GO111MODULE="off" -go get -u github.com/dvyukov/go-fuzz/go-fuzz github.com/dvyukov/go-fuzz/go-fuzz-build -go get -d -v -u ./... -if [ ! -f fuzzit ]; then - wget -q -O fuzzit https://github.com/fuzzitdev/fuzzit/releases/download/v2.4.29/fuzzit_Linux_x86_64 - chmod a+x fuzzit -fi - -# Fuzz -function fuzz { - FUNC=Fuzz$1 - TARGET=$2 - DIR=${3:-$ROOT} - go-fuzz-build -libfuzzer -func $FUNC -o fuzzer.a $DIR - clang -fsanitize=fuzzer fuzzer.a -o fuzzer - ./fuzzit create job --type $TYPE $NAME/$TARGET fuzzer -} -fuzz HTTPTargeter http-targeter -fuzz JSONTargeter json-targeter -fuzz ResultsFormatDetection results-format-detection -fuzz GobDecoder gob-decoder -fuzz CSVDecoder csv-decoder -fuzz JSONDecoder json-decoder -fuzz AttackerTCP attacker-tcp -fuzz AttackerHTTP attacker-http diff --git a/lib/results_test.go b/lib/results_test.go index 27e61342..eac00bb6 100644 --- a/lib/results_test.go +++ b/lib/results_test.go @@ -53,6 +53,8 @@ func TestResultDecoding(t *testing.T) { } func TestResultEncoding(t *testing.T) { + t.Parallel() + newStdJSONEncoder := func(w io.Writer) Encoder { enc := json.NewEncoder(w) return func(r *Result) error { return enc.Encode(r) } @@ -79,8 +81,6 @@ func TestResultEncoding(t *testing.T) { } { tc := tc t.Run(tc.encoding, func(t *testing.T) { - t.Parallel() - rapid.Check(t, func(t *rapid.T) { hdrs := rapid.MapOf( rapid.StringMatching(`([\w-]+)`),