Goworker V2 #7
Workflow file for this run
This file contains hidden or 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: [ master ] | |
pull_request: {} | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
go: | |
- "1.21" | |
- "1.22" | |
- "1.23" | |
- "1.24" | |
broker: | |
- type: redis | |
redis-version: 6 | |
- type: redis | |
redis-version: 7 | |
- type: rabbitmq | |
rabbitmq-version: "3.12" | |
- type: rabbitmq | |
rabbitmq-version: "3.13" | |
steps: | |
- name: Check out code into the Go module directory | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ matrix.go }} | |
- name: Setup Redis | |
if: matrix.broker.type == 'redis' | |
uses: supercharge/[email protected] | |
with: | |
redis-version: ${{ matrix.broker.redis-version }} | |
- name: Setup RabbitMQ | |
if: matrix.broker.type == 'rabbitmq' | |
uses: mer-team/[email protected] | |
with: | |
RABBITMQ_TAG: ${{ matrix.broker.rabbitmq-version }} | |
- name: Build | |
run: go build -v ./... | |
- name: Test | |
run: go test -v ./... | |
imports: | |
name: Imports | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.24' | |
- name: Install goimports | |
run: go install golang.org/x/tools/cmd/goimports@latest | |
- name: Check imports | |
run: | | |
if [ "$(goimports -l . | wc -l)" -gt 0 ]; then | |
echo "The following files need goimports formatting:" | |
goimports -l . | |
echo "Run 'goimports -w .' to fix" | |
exit 1 | |
fi | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.24' | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: latest | |
staticcheck: | |
name: StaticCheck | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: '1.24' | |
- name: Install staticcheck | |
run: go install honnef.co/go/tools/cmd/staticcheck@latest | |
- name: Run staticcheck | |
run: staticcheck ./... | |
## Additional checks that can be enabled if needed: | |
# errcheck: | |
# name: Errcheck | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Setup Go | |
# uses: actions/setup-go@v5 | |
# with: | |
# go-version: '1.24' | |
# - name: Install errcheck | |
# run: go install github.com/kisielk/errcheck@latest | |
# - name: Run errcheck | |
# run: errcheck ./... | |
# sec: | |
# name: Sec | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: actions/checkout@v4 | |
# - name: Setup Go | |
# uses: actions/setup-go@v5 | |
# with: | |
# go-version: '1.24' | |
# - name: Install gosec | |
# run: go install github.com/securego/gosec/v2/cmd/gosec@latest | |
# - name: Run gosec | |
# run: gosec ./... |