Skip to content

Commit

Permalink
fix: golangci lint cicd (smartcontractkit#15161)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikburt authored Nov 13, 2024
1 parent f822149 commit 2439f6f
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
17 changes: 10 additions & 7 deletions .github/actions/golangci-lint/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: CI lint for Golang
description: Runs CI lint for Golang
inputs:
# general inputs
name:
description: Name of the lint action
required: true
go-directory:
description: Go directory to run commands from
default: "."
Expand All @@ -25,10 +21,17 @@ inputs:
runs:
using: composite
steps:
- uses: actions/[email protected]
- name: Checkout repo (full)
uses: actions/[email protected]
# Only do a full checkout on merge_groups
if: github.event_name == 'merge_group'
with:
# We only need a full clone on merge_group events for golangci-lint.
fetch-depth: ${{ github.event_name == 'merge_group' && '0' || '1' }}"
fetch-depth: 0
- name: Checkout repo
uses: actions/[email protected]
if: github.event_name != 'merge_group'
with:
fetch-depth: 1
- name: Setup Go
uses: ./.github/actions/setup-go
with:
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
pull-requests: read
outputs:
deployment-changes: ${{ steps.match-some.outputs.deployment == 'true' }}
should-run-ci-core: ${{ steps.match-every.outputs.non-ignored == 'true' || steps.match-some.outputs.core-ci == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
should-run-golangci: ${{ steps.match-every.outputs.non-integration-tests == 'true' || github.event_name == 'workflow_dispatch' }}
should-run-ci-core: ${{ steps.match-some.outputs.core-ci == 'true' || steps.match-every.outputs.non-ignored == 'true' || github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' }}
should-run-golangci: ${{ steps.match-some.outputs.golang-ci == 'true' || steps.match-every.outputs.non-ignored == 'true' || github.event_name == 'workflow_dispatch' }}
runs-on: ubuntu-latest
steps:
- name: Checkout the repo
Expand All @@ -48,19 +48,25 @@ jobs:
# "if any changed file matches one or more of the conditions" (https://github.com/dorny/paths-filter/issues/225)
predicate-quantifier: some
# deployment - any changes to files in `deployments/`
# core-ci - any changes that could affect this workflow definition
# golang-ci - any changes that could affect the linting result
filters: |
deployment:
- 'deployment/**'
core-ci:
- '.github/workflows/ci-core.yml'
- '.github/actions/**'
golang-ci:
- '.golangci.yml'
- '.github/workflows/ci-core.yml'
- '.github/actions/**'
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: match-every
with:
# "if any changed file match all of the conditions" (https://github.com/dorny/paths-filter/issues/225)
predicate-quantifier: every
# non-integration-tests - only changes made outside of the `integration-tests` directory
# everything-except-ignored - only changes except for the negated ones
# non-ignored - only changes except for the negated ones
# - This is opt-in on purpose. To be safe, new files are assumed to have an affect on CI Core unless listed here specifically.
filters: |
non-integration-tests:
Expand Down Expand Up @@ -103,9 +109,6 @@ jobs:
- name: Golang Lint
uses: ./.github/actions/golangci-lint
if: ${{ needs.filter.outputs.should-run-golangci == 'true' }}
with:
id: core
name: lint
- name: Notify Slack
if: ${{ failure() && needs.run-frequency.outputs.one-per-day-frequency == 'true' }}
uses: slackapi/slack-github-action@6c661ce58804a1a20f6dc5fbee7f0381b469e001 # v1.25.0
Expand Down

0 comments on commit 2439f6f

Please sign in to comment.