fmt: introduce golangci-lint and go vet #24
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: golangci-lint | ||
|
Check failure on line 1 in .github/workflows/golangci-lint.yml
|
||
| on: | ||
| push: | ||
| tags: | ||
| - v* | ||
| branches: | ||
| - dev | ||
| pull_request: | ||
| permissions: | ||
| contents: read | ||
| # Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
| # pull-requests: read | ||
| jobs: | ||
| collectpackages: | ||
| name: "Collect all packages to a list" | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| packages: "${{ steps.create-package-list.outputs.packages }}" | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - name: "Collect by calling 'make print_collected'" | ||
| id: create-package-list | ||
| run: | | ||
| pkgs=$(make print_collected) | ||
| # replace space by comma, add double quotes and copy to output | ||
| echo "packages=[\"${pkgs// /\",\"}\"]" >> $GITHUB_OUTPUT | ||
| - name: "Debug the collected packages as JSON array" | ||
| env: | ||
| COLLECTED_PACKAGES: ${{ steps.create-package-list.outputs.packages }} | ||
| run: echo "The collected packages are $COLLECTED_PACKAGES" | ||
| golangci: | ||
| needs: collectpackages | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| package: "${{ fromJson(needs.collectpackages.outputs.packages) }}" | ||
| name: "lint ${{ matrix.package }}" | ||
| # we need to exclude the root folder, because the CI action would lint all packages recursively again | ||
| # additionally the driver "touch" needs to be skipped here, because contains sub-folders with "machine" imports | ||
| #${{ format('{0}/{1}/{2}', env.TEMP_DB_FOLDER, env.PROJECT_NAME, 'artifacts') }} | ||
| if: ${{ matrix.package != github.workspace }} && ${{ matrix.package != format('{0}/{1}', github.workspace, 'touch') }} | ||
| steps: | ||
| - uses: actions/checkout@v5 | ||
| - uses: actions/setup-go@v6 | ||
| with: | ||
| go-version: '1.22' | ||
| cache: false | ||
| - name: golangci-lint | ||
| uses: golangci/golangci-lint-action@v8 | ||
| with: | ||
| version: v2.5.0 | ||
| working-directory: ${{ matrix.package }} | ||
| # Optional: golangci-lint command line arguments. | ||
| # Note: exclude arguments, e.g. --exclude-files="my_file", will not affect the "typecheck" linter, | ||
| # at least since v1.61.0 - use build tags instead. | ||
| #args: --exclude-files="platforms/digispark/digispark_adaptor.go" | ||
| # Optional: show only new issues if it's a pull request. The default value is `false`. | ||
| # only-new-issues: true | ||
| # Optional: if set to true then the all caching functionality will be complete disabled, | ||
| # takes precedence over all other caching options. | ||
| # skip-cache: true | ||