Merge pull request #126 from Icinga/fix-icinga-states #373
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
name: Go | |
on: | |
push: | |
branches: | |
- main | |
pull_request: { } | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Build | |
run: go build -gcflags="-m" ./... | |
- name: Test | |
run: go test -v -race ./... | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
only-new-issues: true | |
args: -E gosec --timeout=2m --verbose | |
modtidy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Run go mod tidy | |
run: | | |
go mod tidy | |
gitdiff="$(git diff -U0)" | |
echo "$gitdiff" | |
test -z "$gitdiff" | |
vendor-diff: | |
if: github.event_name == 'pull_request' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: stable | |
- name: Checkout base commit | |
uses: actions/checkout@v4 | |
with: | |
path: a | |
ref: ${{ github.base_ref }} | |
- name: Download dependencies of base commit | |
run: go mod vendor | |
working-directory: a | |
- name: Checkout PR | |
uses: actions/checkout@v4 | |
with: | |
path: b | |
- name: Download dependencies of PR | |
run: go mod vendor | |
working-directory: b | |
- name: Diff of dependencies | |
run: diff -ur --color=always a/vendor b/vendor || true |