Skip to content

Commit

Permalink
Update go version & add verification/testing tools
Browse files Browse the repository at this point in the history
  • Loading branch information
coreydaley committed Jul 30, 2023
1 parent 4ce5252 commit 82a2d51
Show file tree
Hide file tree
Showing 153 changed files with 228 additions and 437 deletions.
70 changes: 0 additions & 70 deletions .circleci/config.yml

This file was deleted.

20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
; https://editorconfig.org/

root = true

[*]
insert_final_newline = true
charset = utf-8
trim_trailing_whitespace = true
indent_style = space
indent_size = 2

[{Makefile,go.mod,go.sum,*.go,.gitmodules}]
indent_style = tab
indent_size = 4

[*.md]
indent_size = 4
trim_trailing_whitespace = false

eclint_indent_style = unset
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

4 changes: 0 additions & 4 deletions .github/release_drafter.yml

This file was deleted.

21 changes: 21 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add issues or pull-requests created to the project.
name: Add issue or pull request to Project

on:
issues:
types:
- opened
pull_request_target:
types:
- opened
- reopened

jobs:
add-to-project:
runs-on: ubuntu-latest
steps:
- name: Add issue to project
uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/gorilla/projects/4
github-token: ${{ secrets.ADD_TO_PROJECT_TOKEN }}
58 changes: 58 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main

permissions:
contents: read

jobs:
verify-and-test-and-fuzz:
strategy:
matrix:
go: ['1.19','1.20']
os: [ubuntu-latest, macos-latest, windows-latest]
fail-fast: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Go ${{ matrix.go }}
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
cache: false

- name: Run GolangCI-Lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.53
args: --timeout=5m

- name: Run GoSec
if: matrix.os == 'ubuntu-latest'
uses: securego/gosec@master
with:
args: ./...

- name: Run GoVulnCheck
uses: golang/govulncheck-action@v1
with:
go-version-input: ${{ matrix.go }}
go-package: ./...

- name: Run Tests
run: go test -race -cover -coverprofile=coverage -covermode=atomic -v ./...

- name: Run Fuzz Tests
run: go test -v -fuzz FuzzEncodeDecode -fuzztime 60s

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ./coverage
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
coverage.coverprofile
19 changes: 0 additions & 19 deletions AUTHORS

This file was deleted.

2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) 2012-2018 The Gorilla Authors. All rights reserved.
Copyright (c) 2023 The Gorilla Authors. All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
Expand Down
39 changes: 39 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
GO_LINT=$(shell which golangci-lint 2> /dev/null || echo '')
GO_LINT_URI=github.com/golangci/golangci-lint/cmd/golangci-lint@latest

GO_SEC=$(shell which gosec 2> /dev/null || echo '')
GO_SEC_URI=github.com/securego/gosec/v2/cmd/gosec@latest

GO_VULNCHECK=$(shell which govulncheck 2> /dev/null || echo '')
GO_VULNCHECK_URI=golang.org/x/vuln/cmd/govulncheck@latest

.PHONY: golangci-lint
golangci-lint:
$(if $(GO_LINT), ,go install $(GO_LINT_URI))
@echo "##### Running golangci-lint"
golangci-lint run -v

.PHONY: gosec
gosec:
$(if $(GO_SEC), ,go install $(GO_SEC_URI))
@echo "##### Running gosec"
gosec ./...

.PHONY: govulncheck
govulncheck:
$(if $(GO_VULNCHECK), ,go install $(GO_VULNCHECK_URI))
@echo "##### Running govulncheck"
govulncheck ./...

.PHONY: verify
verify: golangci-lint gosec govulncheck

.PHONY: test
test:
@echo "##### Running tests"
go test -race -cover -coverprofile=coverage.coverprofile -covermode=atomic -v ./...

.PHONY: fuzz
fuzz:
@echo "##### Running fuzz tests"
go test -v -fuzz FuzzEncodeDecode -fuzztime 60s
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# securecookie
# gorilla/securecookie

[![GoDoc](https://godoc.org/github.com/gorilla/securecookie?status.svg)](https://godoc.org/github.com/gorilla/securecookie) [![Build Status](https://travis-ci.org/gorilla/securecookie.png?branch=master)](https://travis-ci.org/gorilla/securecookie)
[![Sourcegraph](https://sourcegraph.com/github.com/gorilla/securecookie/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/securecookie?badge)
![testing](https://github.com/gorilla/securecookie/actions/workflows/test.yml/badge.svg)
[![codecov](https://codecov.io/github/gorilla/securecookie/branch/main/graph/badge.svg)](https://codecov.io/github/gorilla/securecookie)
[![godoc](https://godoc.org/github.com/gorilla/securecookie?status.svg)](https://godoc.org/github.com/gorilla/securecookie)
[![sourcegraph](https://sourcegraph.com/github.com/gorilla/securecookie/-/badge.svg)](https://sourcegraph.com/github.com/gorilla/securecookie?badge)

![Gorilla Logo](https://github.com/gorilla/.github/assets/53367916/d92caabf-98e0-473e-bfbf-ab554ba435e5)

securecookie encodes and decodes authenticated and optionally encrypted
cookie values.
Expand Down
25 changes: 0 additions & 25 deletions fuzz.go

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/0.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/05a79f06cf3f67f726dae68d18a2290f6c9a50c9-1

This file was deleted.

3 changes: 0 additions & 3 deletions fuzz/corpus/05aefe7b48db1dcf464048449ac4fa6af2fbc73b-5

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/1.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/10.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/11.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/12.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/13.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/14.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/15.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/16.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/169c3e89cd10efe9bce3a1fdb69a31229e618fc0

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/17.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/18.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/19.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/2.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/20.sc

This file was deleted.

3 changes: 0 additions & 3 deletions fuzz/corpus/202ad82e80f70c37f893e47d23f91b1de5067219-7

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/21.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/21606782c65e44cac7afbb90977d8b6f82140e76-1

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/22.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/23.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/24.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/25.sc

This file was deleted.

2 changes: 0 additions & 2 deletions fuzz/corpus/25c648c4c5161116b9b3b883338ddae51f25a901-1

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/26.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/27.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/28.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/29.sc

This file was deleted.

2 changes: 0 additions & 2 deletions fuzz/corpus/2aad7069353f2b76fa70b9e0b22115bb42025ec0-2

This file was deleted.

3 changes: 0 additions & 3 deletions fuzz/corpus/2b28c8193457fb5385d22ef4ca733c4e364f00e7-4

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/3.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/30.sc

This file was deleted.

1 change: 0 additions & 1 deletion fuzz/corpus/31.sc

This file was deleted.

0 comments on commit 82a2d51

Please sign in to comment.