Skip to content

Commit 0eda2fc

Browse files
added makefile, github-actions and updated go version (#241)
## What type of PR is this? - [x] Refactor - [x] Optimization ## Description This PR aims to - update go version to 1.20 - introduce make file - configure golangci lint - introduce github actions/workflows ## Added/updated tests? - [x] Yes ## Run verification and test - [x] `make verify` is passing - [x] `make test` is passing
1 parent f1799b8 commit 0eda2fc

27 files changed

+433
-406
lines changed

.circleci/config.yml

Lines changed: 0 additions & 70 deletions
This file was deleted.

.editorconfig

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
; https://editorconfig.org/
2+
3+
root = true
4+
5+
[*]
6+
insert_final_newline = true
7+
charset = utf-8
8+
trim_trailing_whitespace = true
9+
indent_style = space
10+
indent_size = 2
11+
12+
[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
13+
indent_style = tab
14+
indent_size = 4
15+
16+
[*.md]
17+
indent_size = 4
18+
trim_trailing_whitespace = false
19+
20+
eclint_indent_style = unset

.github/release-drafter.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.github/stale.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/issues.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Add issues or pull-requests created to the project.
2+
name: Add issue or pull request to Project
3+
4+
on:
5+
issues:
6+
types:
7+
- opened
8+
pull_request:
9+
types:
10+
- opened
11+
12+
jobs:
13+
add-to-project:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Add issue to project
17+
uses: actions/add-to-project@v0.5.0
18+
with:
19+
project-url: https://github.com/orgs/gorilla/projects/4
20+
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}

.github/workflows/test.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: CI
2+
on:
3+
push:
4+
branches:
5+
- main
6+
pull_request:
7+
branches:
8+
- main
9+
10+
permissions:
11+
contents: read
12+
13+
jobs:
14+
verify-and-test:
15+
strategy:
16+
matrix:
17+
go: ['1.19','1.20']
18+
os: [ubuntu-latest, macos-latest, windows-latest]
19+
fail-fast: true
20+
runs-on: ${{ matrix.os }}
21+
steps:
22+
- name: Checkout Code
23+
uses: actions/checkout@v3
24+
25+
- name: Setup Go ${{ matrix.go }}
26+
uses: actions/setup-go@v4
27+
with:
28+
go-version: ${{ matrix.go }}
29+
cache: false
30+
31+
- name: Run golangci-lint
32+
uses: golangci/golangci-lint-action@v3
33+
with:
34+
version: v1.53
35+
args: --timeout=5m
36+
37+
- name: Run gosec
38+
if: matrix.os == 'ubuntu-latest'
39+
uses: securego/gosec@master
40+
with:
41+
args: ./...
42+
43+
- name: Run govulncheck
44+
uses: golang/govulncheck-action@v1
45+
with:
46+
go-version-input: ${{ matrix.go }}
47+
go-package: ./...
48+
49+
- name: Run tests
50+
run: go test -race -cover -coverprofile=coverage -covermode=atomic -v ./...
51+
52+
- name: Upload coverage to Codecov
53+
uses: codecov/codecov-action@v3
54+
with:
55+
files: ./coverage

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Output of the go test coverage tool
2+
coverage.coverprofile

LICENSE

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,27 @@
1-
Copyright (c) 2013 The Gorilla Handlers Authors. All rights reserved.
1+
Copyright (c) 2023 The Gorilla Authors. All rights reserved.
22

33
Redistribution and use in source and binary forms, with or without
4-
modification, are permitted provided that the following conditions are met:
4+
modification, are permitted provided that the following conditions are
5+
met:
56

6-
Redistributions of source code must retain the above copyright notice, this
7-
list of conditions and the following disclaimer.
7+
* Redistributions of source code must retain the above copyright
8+
notice, this list of conditions and the following disclaimer.
9+
* Redistributions in binary form must reproduce the above
10+
copyright notice, this list of conditions and the following disclaimer
11+
in the documentation and/or other materials provided with the
12+
distribution.
13+
* Neither the name of Google Inc. nor the names of its
14+
contributors may be used to endorse or promote products derived from
15+
this software without specific prior written permission.
816

9-
Redistributions in binary form must reproduce the above copyright notice,
10-
this list of conditions and the following disclaimer in the documentation
11-
and/or other materials provided with the distribution.
12-
13-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
14-
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
15-
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
16-
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
17-
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18-
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19-
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
20-
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
21-
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
17+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
2227
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
2+
GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest
3+
4+
GO_SEC=$(shell which gosec 2> /dev/null || echo '')
5+
GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest
6+
7+
GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
8+
GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest
9+
10+
.PHONY: verify
11+
verify: sec govulncheck lint test
12+
13+
.PHONY: lint
14+
lint:
15+
$(if $(GO_LINT), ,go install $(GO_LINT_URI))
16+
@echo "##### Running golangci-lint #####"
17+
golangci-lint run -v
18+
19+
.PHONY: sec
20+
sec:
21+
$(if $(GO_SEC), ,go install $(GO_SEC_URI))
22+
@echo "##### Running gosec #####"
23+
gosec ./...
24+
25+
.PHONY: govulncheck
26+
govulncheck:
27+
$(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
28+
@echo "##### Running govulncheck #####"
29+
govulncheck ./...
30+
31+
.PHONY: test
32+
test:
33+
@echo "##### Running tests #####"
34+
go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
gorilla/handlers
2-
================
1+
# gorilla/handlers
2+
3+
![Testing](https://github.com/gorilla/handlers/actions/workflows/test.yml/badge.svg)
4+
[![Codecov](https://codecov.io/github/gorilla/handlers/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/handlers)
35
[![GoDoc](https://godoc.org/github.com/gorilla/handlers?status.svg)](https://godoc.org/github.com/gorilla/handlers)
4-
[![CircleCI](https://circleci.com/gh/gorilla/handlers.svg?style=svg)](https://circleci.com/gh/gorilla/handlers)
56
[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/handlers/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/handlers?badge)
67

78
Package handlers is a collection of handlers (aka "HTTP middleware") for use

0 commit comments

Comments
 (0)