name: Lint and Unit tests on: push: branches: - main paths: - "**.go" - go.mod - go.sum pull_request: branches: - main paths: - "**.go" - go.mod - go.sum env: GOLANGCI_LINT_VERSION: v2.6.2 GOLANGCI_LINT_TIMEOUT: 5m permissions: contents: read concurrency: group: fission-lint-${{ github.ref }} cancel-in-progress: true jobs: lint: permissions: contents: read # for actions/checkout to fetch code pull-requests: read # for golangci/golangci-lint-action to fetch pull requests runs-on: ubuntu-24.04 # if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-ci') }} steps: - name: Harden Runner uses: step-security/harden-runner@20cf305ff2072d973412fa9b1e3a4f227bda3c76 # v2.14.0 with: egress-policy: audit - name: Check out code uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 - name: Set up Go uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0 with: go-version-file: "go.mod" cache: true - name: Verify dependencies run: | go mod verify go mod download - name: Run golangci-lint uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0 with: skip-cache: true version: ${{ env.GOLANGCI_LINT_VERSION }} args: --timeout=${{ env.GOLANGCI_LINT_TIMEOUT }} - name: Detect git changes if: always() run: | if [[ $(git diff --stat) != '' ]]; then echo -e '❌ \033[0;31m. Fix lint changes.\033[0m' git diff --color exit 1 else echo '✔ No issues detected. Have a nice day :-)' fi - name: Run unit tests run: ./hack/runtests.sh - name: Upload Coverage report to CodeCov uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests file: ./coverage.txt