From 13c5383a826f73f41593c0dcca0c44bb479f9509 Mon Sep 17 00:00:00 2001 From: Julian Strobl Date: Wed, 3 Jan 2024 09:24:17 +0100 Subject: [PATCH] refactor: github audit workflow (#251) Execute jobs in parallel to speed up the workflow. Signed-off-by: Julian Strobl --- .github/workflows/audit.yaml | 104 +++++++++++++++++++++++++++++++++-- 1 file changed, 98 insertions(+), 6 deletions(-) diff --git a/.github/workflows/audit.yaml b/.github/workflows/audit.yaml index 5f3497a..b473689 100644 --- a/.github/workflows/audit.yaml +++ b/.github/workflows/audit.yaml @@ -4,11 +4,8 @@ name: Audit on: [push] jobs: - audit: + build: runs-on: ubuntu-latest - strategy: - matrix: - go-version: [ '1.20', '1.21' ] steps: - name: Checkout uses: actions/checkout@v3 @@ -18,7 +15,7 @@ jobs: - name: Setup Go uses: actions/setup-go@v4 with: - go-version: ${{ matrix.go-version }} + go-version: "1.21" - name: Verify dependencies run: go mod verify @@ -26,6 +23,14 @@ jobs: - name: Build run: go build -v ./... + ignite: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 0 + - name: Check generated files run: | curl https://get.ignite.com/cli@v0.27.1 | bash @@ -33,12 +38,51 @@ jobs: rm ignite 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 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 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 run: go install honnef.co/go/tools/cmd/staticcheck@latest @@ -46,11 +90,59 @@ jobs: run: | 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 run: go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest - 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 run: |