refactor: github audit workflow (#251)

Execute jobs in parallel to speed up the workflow.

Signed-off-by: Julian Strobl <jmastr@mailbox.org>
This commit is contained in:
Julian Strobl 2024-01-03 09:24:17 +01:00
parent a71f3d7f2a
commit 13c5383a82
No known key found for this signature in database
GPG Key ID: E0A8F9AD733499A7

View File

@ -4,11 +4,8 @@ name: Audit
on: [push] on: [push]
jobs: jobs:
audit: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy:
matrix:
go-version: [ '1.20', '1.21' ]
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
@ -18,7 +15,7 @@ jobs:
- name: Setup Go - name: Setup Go
uses: actions/setup-go@v4 uses: actions/setup-go@v4
with: with:
go-version: ${{ matrix.go-version }} go-version: "1.21"
- name: Verify dependencies - name: Verify dependencies
run: go mod verify run: go mod verify
@ -26,6 +23,14 @@ jobs:
- name: Build - name: Build
run: go build -v ./... run: go build -v ./...
ignite:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Check generated files - name: Check generated files
run: | run: |
curl https://get.ignite.com/cli@v0.27.1 | bash curl https://get.ignite.com/cli@v0.27.1 | bash
@ -33,12 +38,51 @@ jobs:
rm ignite rm ignite
if [ "$(git diff --stat | wc -l)" -gt 0 ]; then exit 1; fi if [ "$(git diff --stat | wc -l)" -gt 0 ]; then exit 1; fi
gofmt:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run gofmt - name: Run gofmt
run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi run: if [ "$(gofmt -s -l . | wc -l)" -gt 0 ]; then exit 1; fi
govet:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run go vet - name: Run go vet
run: go vet ./... run: go vet ./...
staticcheck:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install staticcheck - name: Install staticcheck
run: go install honnef.co/go/tools/cmd/staticcheck@latest run: go install honnef.co/go/tools/cmd/staticcheck@latest
@ -46,11 +90,59 @@ jobs:
run: | run: |
staticcheck ./... staticcheck ./...
golangci-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install golangci-lint - name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run golangci-lint - name: Run golangci-lint
run: (golangci-lint run && cd lib && golangci-lint run) run: |
golangci-lint run
golangci-lint-lib:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Install golangci-lint
run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
- name: Run golangci-lint
run: |
pushd lib
golangci-lint run
gotest:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.21"
- name: Run tests - name: Run tests
run: | run: |