forked from syndtr/gocapability
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
- Loading branch information
Showing
1 changed file
with
90 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
name: test | ||
on: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- main | ||
- release-* | ||
pull_request: | ||
env: | ||
GO_VERSION: 1.22.x | ||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
lint: | ||
timeout-minutes: 30 | ||
permissions: | ||
contents: read | ||
pull-requests: read | ||
checks: write # to allow the action to annotate code in the PR. | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "${{ env.GO_VERSION }}" | ||
- name: install deps | ||
run: | | ||
sudo apt -q update | ||
sudo apt -qy install libseccomp-dev | ||
- uses: golangci/golangci-lint-action@v6 | ||
with: | ||
version: v1.57 | ||
# Extra linters, only checking new code from a pull request. | ||
- name: lint-extra | ||
if: github.event_name == 'pull_request' | ||
run: | | ||
golangci-lint run --config .golangci-extra.yml --new-from-rev=HEAD~1 | ||
go-fix: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 2 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "${{ env.GO_VERSION }}" | ||
- name: run go fix | ||
run: | | ||
go fix ./... | ||
git diff --exit-code | ||
codespell: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: install deps | ||
# Version of codespell bundled with Ubuntu is way old, so use pip. | ||
run: pip install --break-system-packages codespell==v2.3.0 | ||
- name: run codespell | ||
run: codespell | ||
|
||
space-at-eol: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: rm -fr vendor | ||
- run: if git -P grep -I -n '\s$'; then echo "^^^ extra whitespace at EOL, please fix"; exit 1; fi | ||
|
||
verify-changelog: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
# Period before issue/PR references. | ||
! grep -n '[0-9a-zA-Z][^.] (#[1-9][0-9, #]*)$$' CHANGELOG.md | ||
unit: | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-go@v5 | ||
with: | ||
go-version: "${{ env.GO_VERSION }}" | ||
- name: run go test | ||
run: go test -v ./... |