keel/.github/workflows/checks.yml
Kevin Franklin Kim 661f16e550 chore: linting
2021-11-19 14:16:09 +01:00

59 lines
1.7 KiB
YAML

# This workflow runs all dockerfiles in this repo
name: checks
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
GO_VERSION: 1.17
GOLANGCI_LINT_VERSION: v1.43.0
jobs:
go_matrix:
name: go matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v2
- id: set-matrix
run: |
matrix=$(find . -type f -name "go.mod" -printf "{\"folder\":\"%h\"}," | sed -e 's/,$//')
echo "Matrix: $matrix"
echo "::set-output name=matrix::{\"include\":[$matrix]}"
go_lint:
name: go lint
needs: go_matrix
runs-on: ubuntu-latest
strategy:
matrix: ${{ fromJson(needs.go_matrix.outputs.matrix) }}
env:
GOFLAGS: -mod=readonly
GOPROXY: https://proxy.golang.org
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2
with:
go-version: ${{ env.GO_VERSION }}
- uses: golangci/golangci-lint-action@v2
with:
version: ${{ env.GOLANGCI_LINT_VERSION }}
working-directory: ${{ matrix.folder }}
- uses: github/super-linter@v3
env:
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
VALIDATE_ALL_CODEBASE: false
VALIDATE_JSCPD: false
VALIDATE_GO: false
- run: go test -v -cover -coverprofile=coverage.txt -covermode=atomic ./...
env:
CGO_ENABLED: 0
- uses: codecov/codecov-action@v2
with:
files: coverage.txt
fail_ci_if_error: true # optional (default = false)