chore: improve go module chache (#12057)

This commit is contained in:
Robert Zaremba 2022-05-26 21:59:04 +02:00 committed by GitHub
parent 16badb17be
commit e1413cb698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 106 additions and 149 deletions

View File

@ -22,28 +22,19 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Linter cache (Linux)
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-linter-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-linter-${{ matrix.go-version }}-
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: golangci-lint
if: env.GIT_DIFF
uses: golangci/golangci-lint-action@v3
with:
version: latest
args: --out-format=tab
skip-go-installation: true
if: env.GIT_DIFF

View File

@ -7,29 +7,9 @@ on:
- "rc**"
jobs:
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-sims')"
steps:
- uses: actions/checkout@v3
- run: |
make build
install-runsim:
runs-on: ubuntu-latest
needs: build
steps:
- name: install runsim
run: |
export GO111MODULE="on" && go get github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v3
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
test-sim-multi-seed-long:
runs-on: ubuntu-latest
needs: [build, install-runsim]
if: "!contains(github.event.head_commit.message, 'skip-sims')"
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
@ -37,6 +17,19 @@ jobs:
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- run: |
make build
- name: test-sim-multi-seed-long
run: |
make test-sim-multi-seed-long

View File

@ -15,6 +15,7 @@ jobs:
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/main'"
build:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, 'skip-sims')"
@ -25,17 +26,22 @@ jobs:
go-version: 1.18
- name: Display go version
run: go version
- run: make build
install-runsim:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v3
- uses: technote-space/get-diff-action@v6.0.1
with:
go-version: 1.18
- name: Display go version
run: go version
PATTERNS: |
**/**.go
go.mod
go.sum
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- run: make build
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v3
@ -45,7 +51,7 @@ jobs:
test-sim-import-export:
runs-on: ubuntu-latest
needs: [build, install-runsim]
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
@ -64,15 +70,13 @@ jobs:
test-sim-after-import:
runs-on: ubuntu-latest
needs: [build, install-runsim]
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Display go version
run: go version
- uses: actions/cache@v3
with:
path: ~/go/bin
@ -83,15 +87,13 @@ jobs:
test-sim-multi-seed-short:
runs-on: ubuntu-latest
needs: [build, install-runsim]
needs: [build]
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Display go version
run: go version
- uses: actions/cache@v3
with:
path: ~/go/bin

View File

@ -48,10 +48,21 @@ jobs:
**/**.go
**/go.mod
**/go.sum
- name: Get data from Go build cache
uses: actions/cache@v3
if: env.GIT_DIFF
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Build
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
- name: Build cosmovisor
if: env.GIT_DIFF
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor
split-test-files:
@ -101,31 +112,25 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
- name: Get data from Go build cache
uses: actions/cache@v3
if: env.GIT_DIFF
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-race-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-race-${{ matrix.go-version }}-
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- uses: actions/download-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-${{ matrix.part }}"
if: env.GIT_DIFF
- name: test & coverage report creation
if: env.GIT_DIFF
run: |
xargs --arg-file=pkgs.txt.part.${{ matrix.part }} go test -mod=readonly -timeout 30m -race -tags='cgo ledger test_ledger_mock'
if: env.GIT_DIFF
- uses: actions/upload-artifact@v3
if: env.GIT_DIFF
with:
name: "${{ github.sha }}-${{ matrix.part }}-race-output"
path: ./${{ matrix.part }}-race-output.txt

View File

@ -35,12 +35,28 @@ jobs:
**/**.go
**/go.mod
**/go.sum
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Build
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make build
- name: Build cosmovisor
run: GOARCH=${{ matrix.go-arch }} LEDGER_ENABLED=false make cosmovisor
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v3
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
test-submodules:
runs-on: ubuntu-latest
container: tendermintdev/docker-tm-db-testing
@ -56,6 +72,15 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: Run submodule tests and create test coverage profile.
# GIT_DIFF is passed to the scripts
run: bash scripts/module-tests.sh
@ -112,24 +137,15 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Linter cache (Linux)
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-linter-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-linter-${{ matrix.go-version }}-
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- uses: actions/download-artifact@v3
with:
name: "${{ github.sha }}-${{ matrix.part }}"
@ -207,23 +223,15 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-rosetta-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-rosetta-${{ matrix.go-version }}-
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: test rosetta
run: |
make test-rosetta
@ -244,22 +252,15 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
- name: Get data from Go build cache
if: env.GIT_DIFF
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-${{ matrix.go-version }}-
~/go/pkg/mod
~/.cache/golangci-lint
~/.cache/go-build
key: ${{ runner.os }}-go-build-${{ hashFiles('**/go.sum') }}
- name: start localnet
run: |
make clean localnet-start
@ -269,25 +270,9 @@ jobs:
./contrib/localnet_liveness.sh 100 5 50 localhost
if: env.GIT_DIFF
install-runsim:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Display go version
run: go version
- name: Install runsim
run: go install github.com/cosmos/tools/cmd/runsim@v1.0.0
- uses: actions/cache@v3
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
test-sim-nondeterminism:
runs-on: ubuntu-latest
needs: [build, install-runsim]
needs: [build]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
@ -301,26 +286,6 @@ jobs:
**/**.go
go.mod
go.sum
- name: Get data from build cache
uses: actions/cache@v3
with:
# In order:
# * Module download cache
# * Build cache (Linux)
# * Build cache (Mac)
# * Build cache (Windows)
path: |
~/go/pkg/mod
~/.cache/go-build
~/Library/Caches/go-build
~\AppData\Local\go-build
key: ${{ runner.os }}-go-sim-${{ matrix.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-sim-${{ matrix.go-version }}-
- uses: actions/cache@v3
with:
path: ~/go/bin
key: ${{ runner.os }}-go-runsim-binary
if: env.GIT_DIFF
- name: test-sim-nondeterminism
run: |

View File

@ -17,7 +17,8 @@ func EndBlocker(ctx sdk.Context, keeper keeper.Keeper) {
logger := keeper.Logger(ctx)
// delete dead proposals from store and returns theirs deposits. A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase.
// delete dead proposals from store and returns theirs deposits.
// A proposal is dead when it's inactive and didn't get enough deposit on time to get into voting phase.
keeper.IterateInactiveProposalsQueue(ctx, ctx.BlockHeader().Time, func(proposal v1.Proposal) bool {
keeper.DeleteProposal(ctx, proposal.Id)
keeper.RefundAndDeleteDeposits(ctx, proposal.Id) // refund deposit if proposal got removed without getting 100% of the proposal