Skip to content

Commit 7b607ce

Browse files
authored
Merge pull request #6487 from Algo-devops-service/relstable4.4.1
2 parents 3e5d694 + b7863ee commit 7b607ce

File tree

357 files changed

+8680
-4366
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

357 files changed

+8680
-4366
lines changed

.custom-gcl.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: v2.5.0
2+
name: custom-golangci-lint
3+
plugins:
4+
# partitiontest plugin from local source
5+
- module: 'github.com/algorand/go-algorand/cmd/partitiontest_linter'
6+
path: ./cmd/partitiontest_linter
7+
# errortype plugin for error handling consistency
8+
- module: fillmore-labs.com/errortype
9+
import: fillmore-labs.com/errortype/gclplugin
10+
version: v0.0.7

.github/workflows/ci-nightly.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,14 @@ jobs:
119119
job-type: "Test"
120120
build-type: "Nightly Build"
121121
details: "• Partition: `${{ matrix.partition_id }}` of ${{ env.PARTITION_TOTAL }}\n• Failed Step: `${{ steps.run_tests.name }}`"
122+
- name: Upload test logs on failure
123+
if: failure()
124+
uses: actions/upload-artifact@v4
125+
with:
126+
name: test-logs-${{ matrix.platform }}-${{ github.run_id }}-${{ matrix.partition_id }}
127+
path: |
128+
**/*.log
129+
retention-days: 30
122130
- name: Upload test artifacts to GitHub
123131
uses: actions/upload-artifact@v4
124132
with:
@@ -271,6 +279,12 @@ jobs:
271279
CI_KEEP_TEMP_PLATFORM: "ubuntu-24.04"
272280
S3_TESTDATA: ${{ secrets.S3_TESTDATA }}
273281
steps:
282+
- name: Set CI_E2E_FILENAME for e2e test data publishing
283+
run: |
284+
# Set CI_E2E_FILENAME based on branch name, replacing '/' with '-' - used when publishing e2e test data to S3 (e2e.sh) for indexer tests
285+
BRANCH_NAME="${{ github.event.inputs.branch || github.ref_name }}"
286+
MODIFIED_BRANCH_NAME="${BRANCH_NAME//\//-}"
287+
echo "CI_E2E_FILENAME=${MODIFIED_BRANCH_NAME}" >> $GITHUB_ENV
274288
- name: Download workspace archive
275289
uses: actions/download-artifact@v4
276290
with:

.github/workflows/ci-pr.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,14 @@ jobs:
6464
job-type: "Test"
6565
build-type: "PR Build"
6666
details: "• Partition: `${{ matrix.partition_id }}` of ${{ env.PARTITION_TOTAL }}\n• Failed Step: `${{ steps.run_tests.name }}`"
67+
- name: Upload test logs on failure
68+
if: failure()
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: test-logs-${{ matrix.platform }}-${{ github.run_id }}-${{ matrix.partition_id }}
72+
path: |
73+
**/*.log
74+
retention-days: 30
6775
- name: Upload test artifacts to GitHub
6876
if: ${{ !cancelled() }}
6977
uses: actions/upload-artifact@v4

.github/workflows/reviewdog.yml

Lines changed: 48 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: "ReviewDog workflow"
22
env:
3-
GOLANGCI_LINT_VERSION: "v1.62.0"
3+
GOLANGCI_LINT_VERSION: "v2.6.0"
44
on:
55
push:
66
branches:
@@ -20,20 +20,42 @@ jobs:
2020
with:
2121
path: crypto/libs
2222
key: libsodium-ubuntu-latest-${{ hashFiles('crypto/libsodium-fork/**') }}
23-
# move go out of the way temporarily to avoid "go list ./..." from installing modules
23+
# move go out of the way temporarily to avoid "go list ./..." from installing modules
2424
- name: Make libsodium.a
2525
run: sudo mv /usr/bin/go /usr/bin/go.bak && make libsodium && sudo mv /usr/bin/go.bak /usr/bin/go
26-
- name: reviewdog-golangci-lint
27-
uses: reviewdog/[email protected]
28-
with:
29-
go_version_file: go.mod
30-
golangci_lint_version: ${{ env.GOLANGCI_LINT_VERSION }}
31-
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
32-
reporter: "github-pr-check"
33-
tool_name: "Lint Errors"
34-
level: "error"
35-
fail_level: any
36-
filter_mode: "nofilter"
26+
- name: Add bin to PATH
27+
run: |
28+
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
29+
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
30+
- name: Set up Go
31+
uses: ./.github/actions/setup-go
32+
- name: Install golangci-lint
33+
run: |
34+
go install github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${{ env.GOLANGCI_LINT_VERSION }}
35+
golangci-lint --version
36+
- name: Install reviewdog
37+
run: |
38+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.21.0/install.sh | sh -s -- v0.21.0
39+
reviewdog --version
40+
- name: Run golangci-lint with reviewdog
41+
env:
42+
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
43+
run: |
44+
set -e
45+
46+
golangci-lint run \
47+
--output.text.path stdout \
48+
-c .golangci.yml \
49+
--issues-exit-code 0 \
50+
--allow-parallel-runners > temp_golangci-lint-errors.txt
51+
52+
cat temp_golangci-lint-errors.txt | reviewdog \
53+
-f=golangci-lint \
54+
-name="Lint Errors" \
55+
-reporter=github-pr-check \
56+
-filter-mode=nofilter \
57+
-fail-level=any \
58+
-level=error
3759
# Non-Blocking Warnings Section
3860
reviewdog-warnings:
3961
runs-on: ubuntu-latest
@@ -56,47 +78,34 @@ jobs:
5678
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
5779
- name: Set up Go
5880
uses: ./.github/actions/setup-go
59-
- name: Create folders for golangci-lint
60-
run: mkdir -p cicdtmp/golangci-lint
61-
- name: Check if custom golangci-lint is already built
62-
id: cache-golangci-lint
81+
- name: Check if custom golangci-lint with partitiontest plugin is already built
82+
id: cache-custom-golangci-lint
6383
uses: actions/cache@v4
6484
with:
65-
path: cicdtmp/golangci-lint/golangci-lint-cgo
66-
key: cicd-golangci-lint-cgo-v0.0.3-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}
67-
68-
- name: Build custom golangci-lint with CGO_ENABLED
69-
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
85+
path: custom-golangci-lint
86+
key: custom-golangci-lint-${{ env.GO_VERSION }}-${{ env.GOLANGCI_LINT_VERSION }}-${{ hashFiles('cmd/partitiontest_linter/**', '.custom-gcl.yml') }}
87+
- name: Build custom golangci-lint with partitiontest plugin
88+
if: steps.cache-custom-golangci-lint.outputs.cache-hit != 'true'
7089
run: |
71-
cd cicdtmp/golangci-lint
72-
git clone https://github.com/golangci/golangci-lint.git .
73-
git checkout tags/${GOLANGCI_LINT_VERSION}
74-
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
75-
./golangci-lint-cgo --version
76-
cd ../../
90+
go run github.com/golangci/golangci-lint/v2/cmd/golangci-lint@${{ env.GOLANGCI_LINT_VERSION }} custom -v
91+
./custom-golangci-lint --version
7792
- name: Install reviewdog
7893
run: |
79-
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.20.3/install.sh | sh -s -- v0.20.3
94+
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.21.0/install.sh | sh -s -- v0.21.0
8095
reviewdog --version
81-
- name: Build custom linters
82-
run: |
83-
cd cmd/partitiontest_linter/
84-
CGO_ENABLED=true go build -buildmode=plugin -trimpath plugin/plugin.go
85-
cd ../../
86-
ls -la cmd/partitiontest_linter/
8796
- name: Run golangci-lint with reviewdog
8897
env:
8998
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
9099
run: |
91100
set -e
92101
93-
./cicdtmp/golangci-lint/golangci-lint-cgo run \
94-
--out-format line-number \
102+
./custom-golangci-lint run \
103+
--output.text.path stdout \
95104
-c .golangci-warnings.yml \
96105
--issues-exit-code 0 \
97-
--allow-parallel-runners > temp_golangci-lint-cgo.txt
106+
--allow-parallel-runners > temp_golangci-lint-warnings.txt
98107
99-
cat temp_golangci-lint-cgo.txt | reviewdog \
108+
cat temp_golangci-lint-warnings.txt | reviewdog \
100109
-f=golangci-lint \
101110
-name="Lint Warnings" \
102111
-reporter=github-pr-check \

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ cmd/algod/algod
2424
cmd/goal/goal
2525
cmd/updater/updater
2626

27+
# custom golangci-lint binary with plugins
28+
custom-golangci-lint
29+
2730
# Exclude our local temp directory
2831
tmp/
2932

.golangci-warnings.yml

Lines changed: 35 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,46 @@
1+
version: "2"
12
run:
2-
timeout: 5m
33
tests: true
4-
54
linters:
6-
disable-all: true
5+
default: none
76
enable:
87
- gosec
98
- partitiontest
10-
11-
linters-settings:
12-
gosec: # Go 1.22 makes G601 irrelevant
13-
excludes: [G101, G103, G104, G107, G115, G202, G301, G302, G303, G304, G306, G307, G404, G601]
14-
custom:
15-
partitiontest:
16-
path: cmd/partitiontest_linter/plugin.so
17-
description: This custom linter checks files that end in '_test.go', specifically functions that start with 'Test' and have testing argument, for a line 'partitiontest.ParitionTest(<testing arg>)'
18-
original-url: github.com/algorand/go-algorand/cmd/partitiontest_linter
19-
20-
severity:
21-
default-severity: warning
22-
9+
- errortype
10+
settings:
11+
gosec:
12+
excludes: [G101, G103, G104, G107, G112, G114, G115, G202, G204, G301, G302, G303, G304, G306, G307, G404]
13+
custom:
14+
partitiontest:
15+
type: "module"
16+
description: This custom linter ensures test functions call 'partitiontest.PartitionTest(t)'
17+
errortype:
18+
type: module
19+
description: "errortype helps prevent subtle bugs in error handling."
20+
original-url: "https://fillmore-labs.com/errortype"
21+
settings:
22+
style-check: false
23+
deep-is-check: true
24+
check-is: true
25+
unchecked-assert: false
26+
check-unused: true
27+
exclusions:
28+
generated: lax
29+
rules:
30+
# be more lenient with test code
31+
- linters:
32+
- gosec
33+
path: _test\.go
34+
- linters:
35+
- partitiontest
36+
path: crypto/secp256k1/secp256_test\.go
2337
issues:
24-
# use these new lint checks on code since #2574
25-
new-from-rev: eb019291beed556ec6ac1ceb4a15114ce4df0c57
26-
27-
# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
28-
exclude-use-default: false
29-
3038
# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
3139
max-issues-per-linter: 0
32-
3340
# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
3441
max-same-issues: 0
35-
36-
exclude:
37-
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
38-
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
39-
# ignore issues about the way we use _struct fields to define encoding settings
40-
- "`_struct` is unused"
41-
42-
# Enable some golangci-lint default exception rules:
43-
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
44-
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
45-
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
46-
- ineffective break statement. Did you mean to break out of the outer loop
47-
48-
exclude-rules:
49-
# be more lenient with test code
50-
- path: _test\.go
51-
linters:
52-
- deadcode
53-
- gosec
54-
- structcheck
55-
- varcheck
56-
- unused
57-
# Add all linters here -- Comment this block out for testing linters
58-
- path: test/linttest/lintissues\.go
59-
linters:
60-
- deadcode
61-
- structcheck
62-
- varcheck
63-
- unused
64-
- path: crypto/secp256k1/secp256_test\.go
65-
linters:
66-
- partitiontest
42+
severity:
43+
default: warning
44+
formatters:
45+
exclusions:
46+
generated: lax

0 commit comments

Comments
 (0)