diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..bf8b586 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,57 @@ +name: JSONAPI CI + +on: + push: + branches: + - 'master' + tags: + - 'v*' + pull_request: + branches: + - '*' + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Set up Go 1.22.x + uses: actions/setup-go@v4 + with: + go-version: 1.22.x + cache-dependency-path: go.sum + + - name: Checkout Code + uses: actions/checkout@v3 + + - name: go-fmt + run: | + if [ -n "$(gofmt -s -l .)" ]; then + echo "Go code is not formatted, run 'gofmt -s -w .'" + exit 1 + fi + + - name: go-vet + run: go vet ./... + + - name: revive + run: | + go install github.com/mgechev/revive@v1.3.2 + revive -config .revive.toml -formatter friendly ./... + + test: + name: Test + needs: check + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v3 + + - name: Set up Go 1.22.x + uses: actions/setup-go@v4 + with: + go-version: 1.22.x + cache-dependency-path: go.sum + + - name: Test JSONAPI + run: go test -v -covermode=count -coverprofile=coverage.out ./... \ No newline at end of file diff --git a/.revive.toml b/.revive.toml new file mode 100644 index 0000000..1a2b002 --- /dev/null +++ b/.revive.toml @@ -0,0 +1,28 @@ +ignoreGeneratedHeader = false +severity = "warning" +confidence = 0.8 +errorCode = 1 +warningCode = 1 + +[rule.blank-imports] +[rule.context-as-argument] +[rule.context-keys-type] +[rule.dot-imports] +[rule.empty-block] +[rule.error-naming] +[rule.error-return] +[rule.error-strings] +[rule.errorf] +[rule.exported] +[rule.increment-decrement] +[rule.indent-error-flow] +[rule.range] +[rule.receiver-naming] +[rule.redefines-builtin-id] +[rule.superfluous-else] +[rule.time-naming] +[rule.unexported-return] +[rule.unreachable-code] +[rule.unused-parameter] +[rule.var-declaration] +[rule.var-naming] \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index abc7d1b..0000000 --- a/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go -arch: - - amd64 - - ppc64le -go: - - 1.11.x - - 1.12.x - - 1.13.x - - 1.14.x - - 1.15.x - - 1.16.x - - tip -script: go test ./... -v