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.4.0 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@ec9f2d5744a09debf3a187a3f4f675c53b671911 # v2.13.0 with: egress-policy: audit - name: Check out code uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - name: Set up Go uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.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@4afd733a84b1f43292c63897423277bb7f4313a9 # v8.0.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@5a1091511ad55cbe89839c7260b706298ca349f7 # v5.5.1 with: token: ${{ secrets.CODECOV_TOKEN }} flags: unittests file: ./coverage.txt