From b992fd6d98d0b1db02651ef34cdf8b21ad9fa123 Mon Sep 17 00:00:00 2001 From: Robert Zaremba Date: Wed, 25 May 2022 22:40:22 +0200 Subject: [PATCH] chore: speedup Github CI by adding more cache (#949) ## Description Related to: https://github.com/osmosis-labs/osmosis/pull/1583/files and old task I had in the Cosmos SDK (https://github.com/cosmos/cosmos-sdk/issues/10471) ---- ### Author Checklist *All items are required. Please add a note to the item if the item is not applicable and please add links to any relevant follow up issues.* I have... - [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] added appropriate labels to the PR - [ ] added `!` to the type prefix if API or client breaking change - [ ] targeted the correct branch (see [PR Targeting](https://github.com/umee-network/umee/blob/main/CONTRIBUTING.md#pr-targeting)) - [ ] provided a link to the relevant issue or specification - [ ] added a changelog entry to `CHANGELOG.md` - [ ] included comments for [documenting Go code](https://blog.golang.org/godoc) - [ ] updated the relevant documentation or specification - [ ] reviewed "Files changed" and left comments if necessary - [ ] confirmed all CI checks have passed ### Reviewers Checklist *All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.* I have... - [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title - [ ] confirmed `!` in the type prefix if API or client breaking change - [ ] confirmed all author checklist items have been addressed - [ ] reviewed state machine logic - [ ] reviewed API design and naming - [ ] reviewed documentation is accurate - [ ] reviewed tests and test coverage - [ ] manually tested (if applicable) --- .github/workflows/build.yml | 9 +++++ .github/workflows/debug.yml | 9 +++++ .github/workflows/lint.yml | 8 ++++ .github/workflows/price-feeder-release.yml | 9 +++++ .github/workflows/release.yml | 14 ++++++- .github/workflows/simulations.yml | 27 +++++++++++++ .github/workflows/tests.yml | 44 ++++++++++++++++++++-- 7 files changed, 115 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 372f8a1bc5..efa8843cb9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -20,6 +20,15 @@ jobs: GOOS: ${{ matrix.targetos }} GOARCH: ${{ matrix.arch }} + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + - name: Compile run: | go mod download diff --git a/.github/workflows/debug.yml b/.github/workflows/debug.yml index e8f08d40e1..8e451b0595 100644 --- a/.github/workflows/debug.yml +++ b/.github/workflows/debug.yml @@ -14,6 +14,15 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.17 + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + - uses: actions/checkout@v3 - name: Setup tmate session uses: mxschmitt/action-tmate@v3 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 97e5cd7b1d..c0df3b985e 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -20,6 +20,14 @@ jobs: **/**.go go.mod go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} - name: Run golangci-lint run: make lint if: env.GIT_DIFF diff --git a/.github/workflows/price-feeder-release.yml b/.github/workflows/price-feeder-release.yml index e14535cb0b..a7cb6ee90e 100644 --- a/.github/workflows/price-feeder-release.yml +++ b/.github/workflows/price-feeder-release.yml @@ -15,6 +15,15 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.17 + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF # Parse 'v*.*.*' semantic version from 'price-feeder/v*.*.*' and save to # the $GITHUB_ENV environment variable. - name: Set env diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index e093e3be89..6980c63c66 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,7 +8,7 @@ on: - "v[0-9]+\\.[0-9]+\\.[0-9]+" # Official release version tags e.g. v2.0.5 - "v[0-9]+\\.[0-9]+\\.[0-9]+-rc[0-9]+" # Release candidate tags e.g. v1.0.3-rc4 pull_request: - types: [ opened, synchronize ] + types: [opened, synchronize] jobs: release: @@ -19,7 +19,17 @@ jobs: fetch-depth: 0 - uses: actions/setup-go@v3 with: - go-version: 1.18 + go-version: 1.17 + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF + - name: Set Env run: echo "TM_VERSION=$(go list -m github.com/tendermint/tendermint | sed 's:.* ::')" >> $GITHUB_ENV - name: Build diff --git a/.github/workflows/simulations.yml b/.github/workflows/simulations.yml index dc78abc67f..5d2a1c8964 100644 --- a/.github/workflows/simulations.yml +++ b/.github/workflows/simulations.yml @@ -21,6 +21,15 @@ jobs: - uses: actions/setup-go@v3 with: go-version: 1.17 + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + - name: Install runsim run: export GO111MODULE="on" && go install github.com/cosmos/tools/cmd/runsim@v1.0.0 - uses: actions/cache@v3 @@ -41,6 +50,15 @@ jobs: **/**.go go.mod go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF - name: Test application non-determinism run: | make test-sim-non-determinism @@ -60,6 +78,15 @@ jobs: **/**.go go.mod go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF - uses: actions/cache@v3 with: path: ~/go/bin diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 361b7add0c..96927681f0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -23,13 +23,15 @@ jobs: go-version: 1.17 - name: Display Go Version run: go version - - name: Install tparse - run: | - export GO111MODULE="on" && go get github.com/mfridman/tparse@v0.8.3 - uses: actions/cache@v3 + id: cache-go-tpares with: path: ~/go/bin key: ${{ runner.os }}-go-tparse-binary + - name: Install tparse + if: steps.cache-go-tpares.outputs.cache-hit != 'true' + run: | + export GO111MODULE="on" && go get github.com/mfridman/tparse@v0.9.0 test-unit-cover: runs-on: ubuntu-latest @@ -44,6 +46,15 @@ jobs: **/**.go go.mod go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF - name: Test and Create Coverage Report run: | make test-unit-cover @@ -68,6 +79,15 @@ jobs: **/**.go go.mod go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF - name: Build Docker Image run: | make docker-build-debug @@ -90,6 +110,15 @@ jobs: **/**.go price-feeder/go.mod price-feeder/go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF - name: Test price-feeder run: | cd price-feeder && make test-unit @@ -110,6 +139,15 @@ jobs: **/**.go go.mod go.sum + - name: Get Go Cache + uses: actions/cache@v2 + with: + path: | + ~/go/pkg/mod + ~/.cache/golangci-lint + ~/.cache/go-build + key: ${{ runner.os }}-go-cache-${{ hashFiles('**/go.sum') }} + if: env.GIT_DIFF - name: Install Starport run: | curl https://get.starport.network/starport@v0.19.5! | bash