Skip to content

Commit

Permalink
Added cache for smart contracts (#255)
Browse files Browse the repository at this point in the history
* Added cache for smart contracts

* change key structure

* added a test step

* changed checkout action

* change ci test step

* added more commands

* fixed repo patch for smart contract cache

* change ci test

* add more ls

* fix ls -la path

* fixed cache file location

* removed commented line

* rebuild crust

* ls the cache folders

* added one more ls step

* fixed cache key

* force re-run

* remove everything and try something simple

* limit the ci scope

* separate caches

* enable the default flow

* remove unneeded steps

* changed removed id line

* added comments

* Merge branch 'master' into milad/wasm-ci-build-cache
  • Loading branch information
miladz68 authored Aug 3, 2023
1 parent 22df2e9 commit f9eefd9
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- ci_step: "integration tests coreum-ibc"
command: "crust build/integration-tests/coreum/ibc images && crust znet test --test-groups=coreum-ibc --timeout-commit 1s"
go-cache: true
wasm-cache: false
wasm-cache: true
linter-cache: false
docker-cache: true
- ci_step: "integration tests coreum-upgrade"
Expand Down Expand Up @@ -92,8 +92,12 @@ jobs:
uses: actions/cache@v3
if: ${{ matrix.wasm-cache }}
with:
path: ~/.cache/crust/wasm
key: ${{ runner.os }}-wasm-cache-${{ hashFiles('**/Cargo.lock') }}
# we need to exclude code-hashes.json from the rest, since the invalidation condition for it is not
# same as WASM cache, but it is same as smart contract artifacts.
path: |
~/.cache/crust/wasm
!/.cache/crust/wasm/code-hashes.json
key: ${{ runner.os }}-wasm-cache-${{ hashFiles('~/.cache/crust/wasm/**/*.rs') }}
- name: Setup linter cache
uses: actions/cache@v3
if: ${{ matrix.linter-cache }}
Expand All @@ -117,6 +121,16 @@ jobs:
with:
path: ~/.cache/crust/bin
key: ${{ runner.os }}-bin-${{ steps.get-year-week.outputs.date }} # year-week key
- name: Setup smart contract build cache
uses: actions/cache@v3
with:
# we need to cache code-hashes.json under the same key as the artifacts, since the invalidation condition
# for both of them are the same.
path: |
${{ github.workspace }}/coreum/integration-tests/contracts/**/artifacts/*
~/.cache/crust/wasm/code-hashes.json
key: ${{ runner.os }}-cache-smart-contracts-${{ hashFiles('./coreum/**/*.rs') }}
if: ${{ matrix.wasm-cache }}
- name: Run ${{ matrix.ci_step }}
run: ${{ matrix.command }}
- name: Dump docker logs on failure
Expand Down

0 comments on commit f9eefd9

Please sign in to comment.