Skip to content

Commit

Permalink
Upgrade deps
Browse files Browse the repository at this point in the history
RELEASE_NOTES=n/a

Signed-off-by: Dominik Schulz <[email protected]>
  • Loading branch information
dominikschulz committed Mar 26, 2022
1 parent 0ca26a1 commit 472739c
Show file tree
Hide file tree
Showing 15 changed files with 366 additions and 496 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build gopass

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:

linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Ubuntu Dependencies
run: sudo apt-get install --yes git gnupg
- run: git config --global user.name nobody
- run: git config --global user.email [email protected]

-
name: Debug
run: |
echo "Go env ------------------"
pwd
echo ${HOME}
echo ${GITHUB_WORKSPACE}
echo ${GOPATH}
echo ${GOROOT}
env
- name: Build and Unit Test
run: make travis
- name: Integration Test
run: make test-integration

windows:
runs-on: windows-latest
defaults:
run:
shell: msys2 {0}
steps:
- uses: msys2/setup-msys2@v2
with:
release: false
path-type: inherit
install: >-
base-devel
git
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- run: git config --global user.name nobody
- run: git config --global user.email [email protected]

- name: Build and Unit Test
run: make travis

macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18

- name: MacOS Dependencies
run: brew install git gnupg

- run: git config --global user.name nobody
- run: git config --global user.email [email protected]

- name: Build and Unit Test
run: make travis
env:
SLOW_TEST_FACTOR: 100

67 changes: 67 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
schedule:
- cron: '19 21 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
27 changes: 27 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: golangci-lint

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

permissions:
contents: read
pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- uses: actions/checkout@v3
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest # we have a list of linters in our .golangci.yml config file
only-new-issues: true
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@
# Dependency directories (remove the comment below to include it)
# vendor/

gopass-hibp
gopass-hibp*
dist/
68 changes: 68 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
run:
go: 1.18

linters-settings:
gocyclo:
min-complexity: 22
cyclop:
max-complexity: 22
skip-tests: true
staticcheck:
go: "1.18"
# https://staticcheck.io/docs/options#checks
checks: ["all","-SA1019"]
funlen:
lines: -1
statements: 100

linters:
enable-all: true
disable:
- bodyclose
- contextcheck
- durationcheck
- dupl
- exhaustivestruct
- forbidigo
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- godox
- goerr113
- golint
- gomnd
- gosec
- gosimple
- govet
- interfacer
- ireturn
- lll
- maintidx
- maligned
- nilerr
- noctx
- revive
- rowserrcheck
- scopelint
- sqlclosecheck
- staticcheck
- structcheck
- stylecheck
- tagliatelle
- testpackage
- tparallel
- typecheck
- unparam
- unused
- varnamelen
- wastedassign
- wrapcheck
- wsl

issues:
exclude-use-default: false # disable filtering of defaults for better zero-issue policy
max-per-linter: 0 # disable limit; report all issues of a linter
max-same-issues: 0 # disable limit; report all issues of the same issue
84 changes: 15 additions & 69 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -100,81 +100,27 @@ full:
codequality:
@echo ">> CODE QUALITY"

@echo -n " REVIVE "
@which revive > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/mgechev/revive; \
@echo -n " GOLANGCI-LINT "
@which golangci-lint > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) install github.com/golangci/golangci-lint/cmd/golangci-lint@latest; \
fi
@revive -formatter friendly -exclude vendor/... ./...
@printf '%s\n' '$(OK)'

@echo -n " FMT "
@$(foreach gofile, $(GOFILES_NOVENDOR),\
out=$$(gofmt -s -l -d -e $(gofile) | tee /dev/stderr); if [ -n "$$out" ]; then exit 1; fi;)
@printf '%s\n' '$(OK)'

@echo -n " CLANGFMT "
@$(foreach pbfile, $(PROTOFILES),\
if [ $$(clang-format -output-replacements-xml $(pbfile) | wc -l) -gt 3 ]; then exit 1; fi;)
@printf '%s\n' '$(OK)'

@echo -n " VET "
@$(GO) vet ./...
@printf '%s\n' '$(OK)'
@golangci-lint run --max-issues-per-linter 0 --max-same-issues 0 --sort-results || exit 1

@echo -n " CYCLO "
@which gocyclo > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/fzipp/gocyclo/cmd/gocyclo; \
fi
@$(foreach gofile, $(GOFILES_NOVENDOR),\
gocyclo -over 22 $(gofile) || exit 1;)
@printf '%s\n' '$(OK)'

@echo -n " LINT "
@which golint > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u golang.org/x/lint/golint; \
fi
@$(foreach pkg, $(PKGS),\
golint -set_exit_status $(pkg) || exit 1;)
@printf '%s\n' '$(OK)'

@echo -n " INEFF "
@which ineffassign > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/gordonklaus/ineffassign; \
fi
@ineffassign . || exit 1
@printf '%s\n' '$(OK)'

@echo -n " SPELL "
@which misspell > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u github.com/client9/misspell/cmd/misspell; \
fi
@$(foreach gofile, $(GOFILES_NOVENDOR),\
misspell --error $(gofile) || exit 1;)
@printf '%s\n' '$(OK)'

@echo -n " STATICCHECK "
@which staticcheck > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u honnef.co/go/tools/cmd/staticcheck; \
fi
@staticcheck $(PKGS) || exit 1
@printf '%s\n' '$(OK)'

@echo -n " UNPARAM "
@which unparam > /dev/null; if [ $$? -ne 0 ]; then \
$(GO) get -u mvdan.cc/unparam; \
fi
@unparam -exported=false $(PKGS)
@printf '%s\n' '$(OK)'

gen:
@go generate ./...
@$(GO) generate ./...

fmt:
@gofmt -s -l -w $(GOFILES_NOVENDOR)
@goimports -l -w $(GOFILES_NOVENDOR)
@which clang-format > /dev/null; if [ $$? -eq 0 ]; then \
clang-format -i $(PROTOFILES); \
fi
@go mod tidy
@gofumpt -s -l -w $(GOFILES_NOVENDOR)
@gci write $(GOFILES_NOVENDOR)
@$(GO) mod tidy

deps:
@$(GO) build -v ./...

upgrade: gen fmt
@$(GO) get -u ./...
@$(GO) mod tidy

.PHONY: clean build completion install sysinfo crosscompile test codequality release goreleaser debsign
Loading

0 comments on commit 472739c

Please sign in to comment.