Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 16 additions & 15 deletions .github/workflows/docker-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,34 @@ on:
- 'docs/**'
- '*.md'

permissions:
contents: read
packages: write

jobs:
release:
runs-on: ubuntu-latest

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin commit hashes instead of tags, add the tag as a comment.

Suggested change
uses: actions/checkout@v7
uses: actions/checkout@<commit-sha> # v7


- name: Set up QEMU
uses: docker/setup-qemu-action@v2
uses: docker/setup-qemu-action@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin docker/setup-qemu-action to a commit hash, not @v4.


- name: Set up Docker buildx
id: buildx
uses: docker/setup-buildx-action@v2
uses: docker/setup-buildx-action@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin docker/setup-buildx-action to a commit hash, not @v4.


- name: Login to Docker Registry
uses: docker/login-action@v2
uses: docker/login-action@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin docker/login-action to a commit hash, not @v4.

with:
registry: ${{ secrets.DOCKER_REGISTRY }}
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v4

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin docker/login-action (GHCR login) to a commit hash, not @v4.

with:
registry: ghcr.io
username: ${{ github.repository_owner }}
Expand All @@ -46,23 +50,20 @@ jobs:
env:
DOCKER_REPOSITORY: ${{ secrets.DOCKER_REPOSITORY }}
run: |
name=${DOCKER_REPOSITORY}
if [ -z "$name" ]; then
name=${{ github.repository }}
fi
echo ::set-output name=name::${name}
echo ::debug::docker image name ${name}
name="${DOCKER_REPOSITORY:-${GITHUB_REPOSITORY}}"
echo "name=${name}" >> "$GITHUB_OUTPUT"
echo "::debug::docker image name ${name}"

- name: Decide on tag
id: tagger
run: |
tag=$(echo "${{ github.ref }}" | sed -e 's/^refs\/heads\///g' -e 's/^refs\/tags\///g' -e 's/^refs\/pull\///g' -e 's/\/merge$//g' | sed -e 's/master/latest/g')
echo "::set-output name=tag::${tag}"
tag=$(echo "${GITHUB_REF}" | sed -e 's/^refs\/heads\///g' -e 's/^refs\/tags\///g' -e 's/^refs\/pull\///g' -e 's/\/merge$//g' | sed -e 's/master/latest/g')
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
echo "::debug::docker image tag ${tag}"

- name: Build and push Docker image
id: build-push
uses: docker/build-push-action@v3
uses: docker/build-push-action@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin docker/build-push-action to a commit hash, not @v7.

with:
build-args: VERSION=${{ steps.tagger.outputs.tag }}
platforms: linux/amd64,linux/arm64
Expand All @@ -74,4 +75,4 @@ jobs:
push: true

- name: Image digest
run: echo "${{ steps.build-push.outputs.digest }}"
run: echo "${{ steps.build-push.outputs.digest }}"
18 changes: 11 additions & 7 deletions .github/workflows/github-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,36 @@ on:
- 'docs/**'
- '*.md'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest

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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin commit hashes instead of tags, add the tag as a comment.


- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin actions/setup-go to a commit hash, not @v7.

with:
go-version: '>=1.21.0'
go-version: '1.26.5'
cache: true

- name: Cross-Platform build
run: |
make platfrom-build
make platform-build

- name: Build Changelog
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
uses: mikepenz/release-changelog-builder-action@v6

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin mikepenz/release-changelog-builder-action to a commit hash, not @v6.

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Release
uses: softprops/action-gh-release@v1
uses: softprops/action-gh-release@v3

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin softprops/action-gh-release to a commit hash, not @v3.

with:
body: ${{steps.github_release.outputs.changelog}}
body: ${{ steps.build_changelog.outputs.changelog }}
files: |
.bin/*
20 changes: 13 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,36 +1,42 @@
name: test

on:
push:
branches:
- '*'
- '**'

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'*''**' changes trigger matching to include branches/tags with slashes (e.g. feature/foo), which the old glob didn't match. Looks intentional, but wasn't called out in the PR description — @ibrahimlawal-paystack can you confirm this was deliberate?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was intentional so the tests can run on my fork

tags:
- '*'
- '**'
paths-ignore:
- 'docs/**'
- '*.md'
pull_request:
branches:
- '*'
- '**'
env:
GOPROXY: https://proxy.golang.org
CGO_ENABLED: 0

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pin commit hashes instead of tags, add the tag as a comment.


- name: Install Go
uses: actions/setup-go@v3
uses: actions/setup-go@v7

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here — pin actions/setup-go to a commit hash, not @v7.

with:
go-version: '>=1.21.0'
go-version: '1.26.5'
cache: true

- name: Lint
run: |
make lint

- name: Test
run: |
make test
make test
180 changes: 83 additions & 97 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -1,144 +1,130 @@
version: "2"
run:
# which dirs to skip
skip-dirs:
- mocks
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m
# Exit code when at least one issue was found.
# Default: 1
issues-exit-code: 2
# Include test files or not.
# Default: true
tests: false

linters-settings:
govet:
check-shadowing: true
gocyclo:
min-complexity: 15
maligned:
suggest-new: true
dupl:
threshold: 100
goconst:
min-len: 2
min-occurrences: 2
misspell:
locale: US
ignore-words:
- "cancelled"
goimports:
local-prefixes: github.com/golangci/golangci-lint
gocritic:
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
disabled-checks:
- dupImport # https://github.com/go-critic/go-critic/issues/845
- ifElseChain
- octalLiteral
- rangeValCopy
- unnamedResult
- whyNoLint
- wrapperFunc
funlen:
lines: 105
statements: 50

linters:
# please, do not use `enable-all`: it's deprecated and will be removed soon.
# inverted configuration with `enable-all` and `disable` is not scalable during updates of golangci-lint
disable-all: true
default: none
enable:
- asciicheck
- bidichk
- bodyclose
# - containedctx
# - contextcheck disabled because of generics
- dupword
- decorder
# - depguard
- dogsled
- dupl
- dupword
- durationcheck
- err113
- errcheck
- errchkjson
- errname
- errorlint
- exhaustive
# - exhaustivestruct TODO: check how to fix it
- exportloopref
# - forbidigo TODO: configure forbidden code patterns
# - forcetypeassert
- funlen
- gci
# - gochecknoglobals TODO: remove globals from code
# - gochecknoinits TODO: remove main.init
- gocognit
- goconst
- gocritic
- gocyclo
# - godox
- goerr113
- gofmt
- goimports
- gomnd
# - gomoddirectives
- goprintffuncname
- gosec
- gosimple
- govet
- goprintffuncname
- grouper
- importas
# - ireturn TODO: not sure if it is a good linter
- ineffassign
- interfacebloat
- loggercheck
- maintidx
- makezero
- misspell
- mnd
- nakedret
# - nestif
- nilerr
- nilnil
# - noctx
- nolintlint
- prealloc
- predeclared
- promlinter
- reassign
- revive
# - rowserrcheck disabled because of generics
# - staticcheck doesn't work with go1.19
# - structcheck disabled because of generics
- stylecheck
- tenv
- staticcheck
- testableexamples
- typecheck
- unconvert
- unparam
- unused
# - varnamelen TODO: review naming
# - varcheck depricated 1.49
# - wastedassign disabled because of generics
- whitespace
- wrapcheck
# - wsl

issues:
exclude-rules:
- path: _test\.go
linters:
- funlen
- bodyclose
- gosec
- dupl
- gocognit
- goconst
- gocyclo
exclude:
- Using the variable on range scope `tt` in function literal
settings:
dupl:
threshold: 100
funlen:
lines: 105
statements: 50
goconst:
min-len: 2
min-occurrences: 2
gocritic:
disabled-checks:
- dupImport
- ifElseChain
- octalLiteral
- rangeValCopy
- unnamedResult
- whyNoLint
- wrapperFunc
enabled-tags:
- diagnostic
- experimental
- opinionated
- performance
- style
gocyclo:
min-complexity: 15
misspell:
locale: US
ignore-rules:
- cancelled
exclusions:
generated: lax
presets:
- comments
- common-false-positives
- legacy
- std-error-handling
rules:
- linters:
- bodyclose
- dupl
- funlen
- gocognit
- goconst
- gocyclo
- gosec
path: _test\.go
- path: (.+)\.go$
text: Using the variable on range scope `tt` in function literal
paths:
- mocks$
- third_party$
- builtin$
- examples$
formatters:
enable:
- gci

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bot review: These are formatters in golangci-lint v2, but make lint still only runs golangci-lint run; v2 executes formatter checks through golangci-lint fmt. The old config enforced gci/gofmt/goimports during lint, so CI now silently loses that coverage. Please wire the formatter check into CI and make it fail when files would change.

- gofmt
- goimports
settings:
gci:
sections:
- standard
- default
- prefix(secrets-init)
custom-order: true
goimports:
local-prefixes:
- secrets-init
exclusions:
generated: lax
paths:
- mocks$
- third_party$
- builtin$
- examples$
Loading