Skip to content

Commit

Permalink
use matrix to run golangci
Browse files Browse the repository at this point in the history
Signed-off-by: Ivan Valdes <[email protected]>
  • Loading branch information
ivanvc committed May 2, 2024
1 parent 24e156f commit 5bf14d8
Showing 1 changed file with 32 additions and 5 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/static-analysis.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,49 @@ name: Static Analysis
on: [push, pull_request]
permissions: read-all
jobs:
run:
module-dirs:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.list-modules.outputs.list }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- id: list-modules
run: |
echo ::set-output name=list::{\"modules\":[\"$(source ./scripts/test_lib.sh && module_dirs | sed 's/\s/","/g' )\"]}
golangci:
name: "Run golangci-lint on ${{ matrix.modules }}"
runs-on: ubuntu-latest
needs: module-dirs
strategy:
matrix: ${{ fromJSON(needs.module-dirs.outputs.matrix) }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- id: golangci_lint_version
run: echo "golangci_lint_version=$(cd tools/mod && go list -m -f {{.Version}} github.com/golangci/golangci-lint)" >> "$GITHUB_OUTPUT"
- id: golangci-lint-version
run: echo "version=$(cd tools/mod && go list -m -f {{.Version}} github.com/golangci/golangci-lint)" >> "$GITHUB_OUTPUT"
- id: golangci-config
run: echo "config=$(git rev-parse --show-toplevel)/tools/.golangci.yaml" >> "$GITHUB_OUTPUT"
- name: golangci-lint
uses: golangci/golangci-lint-action@9d1e0624a798bb64f6c3cea93db47765312263dc # v5.1.0
with:
version: ${{ steps.golangci_lint_version.outputs.golangci_lint_version }}
args: --config tools/.golangci.yaml
version: ${{ steps.golangci-lint-version.outputs.version }}
args: --config=${{ steps.golangci-config.outputs.config }}
working-directory: ${{ matrix.modules }}
run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- id: goversion
run: echo "goversion=$(cat .go-version)" >> "$GITHUB_OUTPUT"
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
with:
go-version: ${{ steps.goversion.outputs.goversion }}
- run: |
go install github.com/golangci/golangci-lint/cmd/golangci-lint@"$(cd tools/mod && go list -m -f {{.Version}} github.com/golangci/golangci-lint)"
- name: protoc
uses: arduino/setup-protoc@149f6c87b92550901b26acd1632e11c3662e381f # v1.3.0
with:
Expand Down

0 comments on commit 5bf14d8

Please sign in to comment.