Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix golangci-lint #10555

Merged
merged 4 commits into from
Sep 12, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions .github/scripts/bash/.shellspec

This file was deleted.

10 changes: 0 additions & 10 deletions .github/scripts/bash/README.md

This file was deleted.

41 changes: 0 additions & 41 deletions .github/scripts/bash/ontriggerlint.sh

This file was deleted.

106 changes: 0 additions & 106 deletions .github/scripts/bash/spec/ontriggerlint_spec.sh

This file was deleted.

24 changes: 0 additions & 24 deletions .github/scripts/bash/spec/spec_helper.sh

This file was deleted.

61 changes: 0 additions & 61 deletions .github/workflows/bash-cicd-scripts.yml

This file was deleted.

82 changes: 17 additions & 65 deletions .github/workflows/ci-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,82 +10,35 @@ on:
branches:
- master
- develop
- 'release/*'
- staging
- trying
- rollup
- "release/*"
merge_group:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
golangci-changes:
name: detect changes for lint
runs-on: ubuntu-latest
outputs:
src: ${{ steps.golangci-changes.outputs.src }}
steps:
- name: Checkout the repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1
id: golangci-changes
with:
filters: |
src:
- '**/*.go'
- '**/go.mod'
- '**/go.sum'
- '.golangci.yml'
- '.github/workflows/ci-core.yml'
init:
name: initialize
runs-on: ubuntu-latest
needs: [golangci-changes]
defaults:
run:
shell: bash
outputs:
# Determine if `on` event should trigger linting to run
on_trigger_lint: ${{ steps.golangci-lint.outputs.on_trigger }}
steps:
- name: Checkout the repo
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
- name: Check if event should trigger lint
id: golangci-lint
env:
GITHUB_EVENT_NAME: ${{ github.event_name }}
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_REF: ${{ github.ref }}
SRC_CHANGED: ${{ needs.golangci-changes.outputs.src }}
run: ./.github/scripts/bash/ontriggerlint.sh | tee -a $GITHUB_OUTPUT
HenryNguyen5 marked this conversation as resolved.
Show resolved Hide resolved

golangci:
if: ${{ github.event_name == 'pull_request' || github.event_name == 'schedule' }}
name: lint
runs-on: ubuntu-latest
needs: [init]
runs-on: ubuntu20.04-8cores-32GB
steps:
- uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3.6.0
with:
fetch-depth: 0
- uses: actions/setup-go@v4
if: needs.init.outputs.on_trigger_lint == 'true'
with:
go-version-file: 'go.mod'
# If cache is set to true (default), the "prepare environment" will
# silently fail with these errors:
# Error: /usr/bin/tar: <...>: Cannot open: File exists
cache: false
- uses: actions/checkout@v4
- name: Setup Go
uses: ./.github/actions/setup-go
- name: Touching core/web/assets/index.html
run: mkdir -p core/web/assets && touch core/web/assets/index.html
- name: Build binary
run: go build ./...
- name: golangci-lint
if: needs.init.outputs.on_trigger_lint == 'true'
uses: golangci/golangci-lint-action@3a919529898de77ec3da873e3063ca4b10e7f5cc # v3.7.0
with:
version: v1.54.2
only-new-issues: ${{ github.event.schedule == '' }} # show only new issues, unless it's a scheduled run
args: --out-format checkstyle:golangci-lint-report.xml
- name: Print lint report artifact
if: always()
run: test -f golangci-lint-report.xml && cat golangci-lint-report.xml || true
# We already cache these directories in setup-go
skip-pkg-cache: true
skip-build-cache: true
# only-new-issues is only applicable to PRs, otherwise it is always set to false
only-new-issues: true
args: --out-format colored-line-number,checkstyle:golangci-lint-report.xml
- name: Store lint report artifact
if: always()
uses: actions/upload-artifact@3cea5372237819ed00197afe530f5a7ea3e805c8 # v3.1.0
Expand All @@ -94,7 +47,6 @@ jobs:
path: golangci-lint-report.xml
- name: Collect Metrics
if: always()
id: collect-gha-metrics
uses: smartcontractkit/push-gha-metrics-action@d2c2b7bdc9012651230b2608a1bcb0c48538b6ec
with:
basic-auth: ${{ secrets.GRAFANA_CLOUD_BASIC_AUTH }}
Expand Down Expand Up @@ -231,7 +183,7 @@ jobs:
env:
SLACK_BOT_TOKEN: ${{ secrets.QA_SLACK_API_KEY }}
with:
channel-id: '#topic-data-races'
channel-id: "#topic-data-races"
slack-message: "Race tests failed: ${{ job.html_url }}\n${{ format('https://github.com/smartcontractkit/chainlink/actions/runs/{0}', github.run_id) }}"
- name: Collect Metrics
if: always()
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ on:
push:
branches:
- develop
- staging
- trying
- rollup
pull_request:
# The branches below must be a subset of the branches above
branches: [develop]
Expand Down
1 change: 0 additions & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@ postgres 13.3
helm 3.10.3
zig 0.10.1
golangci-lint 1.54.2
shellspec 0.28.1
Loading