Skip to content

Commit

Permalink
Merge branch 'release/2.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Algo-devops-service committed May 3, 2022
2 parents 4c5201d + 814aca1 commit 5648d0a
Show file tree
Hide file tree
Showing 41 changed files with 971 additions and 513 deletions.
48 changes: 33 additions & 15 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ workflows:
matrix: &go-version-matrix
parameters:
go_version: ["1.14.7", "1.15.15"]
- indexer_vs_algod_nightly:
name: nightly_test_indexer_vs_algod
context: slack-secrets

jobs:
test:
machine:
Expand All @@ -56,18 +60,38 @@ jobs:
- go/install:
version: << parameters.go_version >>
- install_dependencies
- run_tests_nightly
- run_tests
- upload_coverage
- slack/notify: &slack-fail-event
event: fail
custom: |
{
custom: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Failed: $CIRCLE_USERNAME's build of \n<$CIRCLE_BUILD_URL|$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME>\n(<https://app.circleci.com/pipelines/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME?branch=$CIRCLE_BRANCH|$CIRCLE_BRANCH>) \n- <$CIRCLE_BUILD_URL|$CIRCLE_JOB> failed\n\nThis is probably a result of `make indexer-v-algod`\nSee <https://algorand.atlassian.net/wiki/spaces/LAMPREY/pages/2339536905/Nightly+Indexer+Tests#Q%3A-What-does-it-mean-that-the-nightly-test-failed-because-of-make-indexer-v-algod%3F|this wiki page> for more details"
"text": "Failed: <$CIRCLE_BUILD_URL|$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME>\n(<https://app.circleci.com/pipelines/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME?branch=$CIRCLE_BRANCH|$CIRCLE_BRANCH>) \n- <$CIRCLE_BUILD_URL|$CIRCLE_JOB> failed\n\n"
}
}
]
}
indexer_vs_algod_nightly:
machine:
image: << pipeline.parameters.ubuntu_image >>
steps:
- install_dependencies
- run_indexer_vs_algod
- slack/notify: &slack-fail-event
event: fail
custom: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Failed: <$CIRCLE_BUILD_URL|$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME>\n(<https://app.circleci.com/pipelines/github/$CIRCLE_PROJECT_USERNAME/$CIRCLE_PROJECT_REPONAME?branch=$CIRCLE_BRANCH|$CIRCLE_BRANCH>) \n- <$CIRCLE_BUILD_URL|$CIRCLE_JOB> failed\n\nThis is probably a result of `make indexer-v-algod`\nSee <https://algorand.atlassian.net/wiki/spaces/LAMPREY/pages/2339536905/Nightly+Indexer+Tests#Q%3A-What-does-it-mean-that-the-nightly-test-failed-because-of-make-indexer-v-algod%3F|this wiki page> for more details"
}
}
]
Expand Down Expand Up @@ -104,25 +128,19 @@ commands:
- run: make lint
- run: make check
- run: make integration
# Start a docker container and set TEST_PG to optimize running tests.
- run: docker run -d --name some-postgres -p 5555:5432 -e POSTGRES_PASSWORD=pgpass -e POSTGRES_USER=pguser -e POSTGRES_DB=mydb postgres
- run: echo 'export TEST_PG="host=localhost user=pguser password=pgpass dbname=mydb port=5555 sslmode=disable"' >> $BASH_ENV
- run: echo 'export TEST_FLAG="-p 1"' >> $BASH_ENV
- run:
command: make test
no_output_timeout: 15m
- run: make test-generate
- run: make fakepackage
- run: make e2e

run_tests_nightly:
run_indexer_vs_algod:
steps:
- run: test -z `go fmt ./...`
- run: make lint
- run: make check
- run: make integration
- run:
command: make test
no_output_timeout: 15m
- run: make test-generate
- run: make fakepackage
- run: make e2e
- run: make indexer-v-algod

upload_coverage:
Expand Down
82 changes: 82 additions & 0 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
name: "ReviewDog workflow"
on:
pull_request:
jobs:
# Blocking Errors Section
reviewdog-errors:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
run: sudo apt-get -y -q install libboost-math-dev
- name: Install specific golang
uses: actions/setup-go@v2
with:
go-version: '1.16.15'
- name: reviewdog-golangci-lint
uses: reviewdog/action-golangci-lint@v2
with:
golangci_lint_version: "v1.44.2"
golangci_lint_flags: "-c .golangci.yml --allow-parallel-runners"
reporter: "github-pr-review"
tool_name: "Lint Errors"
level: "error"
fail_on_error: true
# Non-Blocking Warnings Section
reviewdog-warnings:
runs-on: ubuntu-latest
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
with:
fetch-depth: 0 # required for new-from-rev option in .golangci.yml
- name: Install libraries
run: sudo apt-get -y -q install libboost-math-dev
- name: Install specific golang
uses: actions/setup-go@v2
with:
go-version: '1.16.15'
- name: Add bin to PATH
run: |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH
echo "$RUNNER_WORKSPACE/$(basename $GITHUB_REPOSITORY)/bin" >> $GITHUB_PATH
- name: Create folders for golangci-lint
run: mkdir -p cicdtmp/golangci-lint
- name: Check if custom golangci-lint is already built
id: cache-golangci-lint
uses: actions/cache@v2
with:
path: cicdtmp/golangci-lint/golangci-lint-cgo
key: cicd-golangci-lint-cgo-v0.0.1

- name: Build custom golangci-lint with CGO_ENABLED
if: steps.cache-golangci-lint.outputs.cache-hit != 'true'
run: |
cd cicdtmp/golangci-lint
git clone https://github.com/golangci/golangci-lint.git .
git checkout tags/v1.41.1
CGO_ENABLED=true go build -trimpath -o golangci-lint-cgo ./cmd/golangci-lint
./golangci-lint-cgo --version
cd ../../
- name: Install reviewdog
run: |
curl -sfL https://raw.githubusercontent.com/reviewdog/reviewdog/v0.13.0/install.sh | sh -s
reviewdog --version
- name: Run golangci-lint with reviewdog
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >
./cicdtmp/golangci-lint/golangci-lint-cgo run
--out-format line-number
-c .golangci-warnings.yml
--allow-parallel-runners
| reviewdog
-f=golangci-lint
-name="Lint Warnings"
-reporter=github-check
-filter-mode=added
-fail-on-error=false
-level=warning
56 changes: 56 additions & 0 deletions .golangci-warnings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
run:
timeout: 5m
tests: true

linters:
disable-all: true
enable:
- staticcheck
- structcheck
- typecheck
- varcheck
- deadcode
- gosimple
- unused

severity:
default-severity: warning

issues:
# use these new lint checks on code since #935
new-from-rev: 99ab66fdadcd77fef4048bb2aa86cae1f06c6e08

# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
exclude-use-default: false

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

exclude:
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
- "exported method (.*).Unwrap` should have comment or be unexported"
# ignore issues about the way we use _struct fields to define encoding settings
- "`_struct` is unused"

# Enable some golangci-lint default exception rules:
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop

exclude-rules:
# be more lenient with test code
- path: _test\.go
linters:
- staticcheck
- structcheck
- typecheck
- varcheck
- deadcode
- gosimple
- unused
65 changes: 65 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
run:
timeout: 5m
tests: false

linters:
disable-all: true
enable:
- errcheck
- gofmt
- golint
- govet
- ineffassign
- misspell
- gci

linters-settings:
gci:
sections:
- standard
- default
- prefix(github.com/algorand)
- prefix(github.com/algorand/go-algorand)

section-separators:
- newLine

severity:
default-severity: error
rules:
- linters:
- errcheck
- gofmt
- golint
- govet
- ineffassign
- misspell
- gci
severity: error

issues:
# use these new lint checks on code since #935
new-from-rev: 99ab66fdadcd77fef4048bb2aa86cae1f06c6e08

# Disable default exclude rules listed in `golangci-lint run --help` (selectively re-enable some below)
exclude-use-default: false

# Maximum issues count per one linter. Set to 0 to disable. Default is 50.
max-issues-per-linter: 0

# Maximum count of issues with the same text. Set to 0 to disable. Default is 3.
max-same-issues: 0

exclude:
# ignore govet false positive fixed in https://github.com/golang/go/issues/45043
- "sigchanyzer: misuse of unbuffered os.Signal channel as argument to signal.Notify"
# ignore golint false positive fixed in https://github.com/golang/lint/pull/487
- "exported method (.*).Unwrap` should have comment or be unexported"
# ignore issues about the way we use _struct fields to define encoding settings
- "`_struct` is unused"

# Enable some golangci-lint default exception rules:
# "EXC0001 errcheck: Almost all programs ignore errors on these functions and in most cases it's ok"
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*print(f|ln)?|os\.(Un)?Setenv). is not checked
# "EXC0005 staticcheck: Developers tend to write in C-style with an explicit 'break' in a 'switch', so it's ok to ignore"
- ineffective break statement. Did you mean to break out of the outer loop
2 changes: 1 addition & 1 deletion .version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.10.0
2.11.0
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fakepackage: go-algorand
misc/release.py --host-only --outdir $(PKG_DIR) --fake-release

test: idb/mocks/IndexerDb.go cmd/algorand-indexer/algorand-indexer
go test -coverpkg=$(COVERPKG) ./... -coverprofile=coverage.txt -covermode=atomic
go test -coverpkg=$(COVERPKG) ./... -coverprofile=coverage.txt -covermode=atomic ${TEST_FLAG}

lint: go-algorand
golint -set_exit_status ./...
Expand Down
Loading

0 comments on commit 5648d0a

Please sign in to comment.