-
Notifications
You must be signed in to change notification settings - Fork 20
135 lines (130 loc) · 5.97 KB
/
golangci-lint.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
name: golangci_lint
on:
push:
jobs:
golangci-lint-version:
name: Get golangci-lint version to from nix
runs-on: ubuntu-latest
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Parse version
id: parse
run: |
long=$(nix develop -c golangci-lint version | grep "golangci-lint has version")
stringArray=($long)
version=$(echo "${stringArray[3]}")
echo "version found: ${version}"
echo "version=${version}" >>$GITHUB_OUTPUT
outputs:
version: ${{ steps.parse.outputs.version }}
golang_lint_relayer:
name: Golang Lint Relayer
runs-on: ubuntu-latest
needs: [golangci-lint-version]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Lint relayer
run: nix develop -c make lint-go-relayer
- name: Print Report
if: failure()
run: cat ./relayer/golangci-lint-relayer-report.xml
- name: Store Golangci lint relayer report artifact
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: golangci-lint-relayer-report
path: ./relayer/golangci-lint-relayer-report.xml
golang_lint_ops:
name: Golang Lint Ops
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
needs: [golangci-lint-version]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Setup Go with private repo access
uses: ./.github/actions/setup-github-private-access
with:
gati_token: ${{ steps.setup-github-token.outputs.access-token }}
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Lint ops
run: nix develop -c make lint-go-ops
- name: Print Report
if: failure()
run: cat ./ops/golangci-lint-ops-report.xml
- name: Store Golangci lint ops report artifact
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: golangci-lint-ops-report
path: ./ops/golangci-lint-ops-report.xml
golang_lint_integration_tests:
name: Golang Lint Integration Tests
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
needs: [golangci-lint-version]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Setup GitHub Token
id: setup-github-token
uses: smartcontractkit/.github/actions/setup-github-token@9e7cc0779934cae4a9028b8588c9adb64d8ce68c # [email protected]
with:
aws-role-arn: ${{ secrets.AWS_OIDC_GLOBAL_READ_ONLY_TOKEN_ISSUER_ROLE_ARN }}
aws-lambda-url: ${{ secrets.GATI_RELENG_LAMBDA_URL }}
aws-region: ${{ secrets.QA_AWS_REGION }}
- name: Setup Go with private repo access
uses: ./.github/actions/setup-github-private-access
with:
gati_token: ${{ steps.setup-github-token.outputs.access-token }}
- name: Install Nix
uses: cachix/install-nix-action@3715ab1a11cac9e991980d7b4a28d80c7ebdd8f9 # nix:v2.24.6
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Lint integration-tests
run: nix develop -c make lint-go-test
- name: Print Report
if: failure()
run: cat ./integration-tests/golangci-lint-integration-tests-report.xml
- name: Store Golangci lint integration tests report artifact
if: always()
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1
with:
name: golangci-lint-integration-tests-report
path: ./integration-tests/golangci-lint-integration-tests-report.xml
# Note: I could not figure out why the golangci-lint-action would not work even though it is technically running the same as above, error message is this:
# Running [/home/runner/golangci-lint-1.50.1-linux-amd64/golangci-lint run --out-format=github-actions --path-prefix=integration-tests --exclude=dot-imports] in [/home/runner/work/chainlink-starknet/chainlink-starknet/integration-tests] ...
# level=warning msg="[runner] Can't run linter goanalysis_metalinter: inspect: failed to load package client: could not load export data: no export data for \"github.com/smartcontractkit/chainlink-testing-framework/client\""
# level=error msg="Running error: 1 error occurred:\n\t* can't run linter goanalysis_metalinter: inspect: failed to load package client: could not load export data: no export data for \"github.com/smartcontractkit/chainlink-testing-framework/client\"\n\n"
# - name: golangci-lint
# uses: golangci/golangci-lint-action@v3
# env:
# CGO_ENABLED: 1
# with:
# version: v${{ needs.golangci-lint-version.outputs.version }}
# working-directory: integration-tests
# args: --exclude=dot-imports