Skip to content

Commit

Permalink
refactor(ci): cache all of submodules/deps to speed up build time
Browse files Browse the repository at this point in the history
  • Loading branch information
vpavlin committed May 15, 2023
1 parent 2defbd2 commit 175fb17
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 59 deletions.
44 changes: 14 additions & 30 deletions .github/workflows/ci-experimental.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,27 +61,19 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Get submodule versions
- name: Get submodules hash
id: submodules
shell: bash
run: |
echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT
echo "zerokit-hash=$(git rev-parse HEAD:vendor/zerokit)" >> $GITHUB_OUTPUT
- name: Cache nim compiler
uses: actions/cache@v3
with:
path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }}
echo "hash=$(git submodule status | sha256sum | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT
- name: Cache zerokit artifacts
- name: Cache submodules
uses: actions/cache@v3
with:
path: vendor/zerokit/target/release
key: ${{ runner.os }}-zerokit-${{ steps.submodules.outputs.zerokit-hash }}
path: |
vendor/
.git/modules
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Build binaries
run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 v2
Expand All @@ -99,27 +91,19 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Get submodule versions
- name: Get submodules hash
id: submodules
shell: bash
run: |
echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT
echo "zerokit-hash=$(git rev-parse HEAD:vendor/zerokit)" >> $GITHUB_OUTPUT
- name: Cache nim compiler
uses: actions/cache@v3
with:
path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }}
echo "hash=$(git submodule status | sha256sum | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT
- name: Cache zerokit artifacts
- name: Cache submodules
uses: actions/cache@v3
with:
path: vendor/zerokit/target/release
key: ${{ runner.os }}-zerokit-${{ steps.submodules.outputs.zerokit-hash }}
path: |
vendor/
.git/modules
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Run tests
run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test2 testwakunode2
30 changes: 14 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,19 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Get submodule versions
- name: Get submodules hash
id: submodules
shell: bash
run: |
echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT
echo "hash=$(git submodule status | sha256sum | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT
- name: Cache nim
- name: Cache submodules
uses: actions/cache@v3
with:
path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }}
path: |
vendor/
.git/modules
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Build binaries
run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 v1
Expand All @@ -164,20 +163,19 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive

- name: Get submodule vesions
- name: Get submodules hash
id: submodules
shell: bash
run: |
echo "nim-hash=$(git rev-parse HEAD:vendor/nimbus-build-system)" >> $GITHUB_OUTPUT
echo "hash=$(git submodule status | sha256sum | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT
- name: Cache nim
- name: Cache submodules
uses: actions/cache@v3
with:
path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-nim-${{ steps.submodules.outputs.nim-hash }}
path: |
vendor/
.git/modules
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Run tests
run: make V=1 LOG_LEVEL=DEBUG QUICK_AND_DIRTY_COMPILER=1 test1
21 changes: 10 additions & 11 deletions .github/workflows/release-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,18 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

# We need to do this because of how github cache works
# I am not sure we can move the cache file, so if we do not do this
# make update breaks because the cached compiler is there where the submodules
# are meant to go.
- name: Submodules
- name: Get submodules hash
id: submodules
run: |
git submodule update --init --recursive
- name: Cache nim
uses: actions/cache@v1
echo "hash=$(git submodule status | sha256sum | sed 's/[ -]*//g')" >> $GITHUB_OUTPUT
- name: Cache submodules
uses: actions/cache@v3
with:
path: vendor/nimbus-build-system/vendor/Nim/bin
key: ${{ runner.os }}-${{ matrix.env.NPROC }}-nim-${{ hashFiles('.gitmodules') }}
path: |
vendor/
.git/modules
key: ${{ runner.os }}-vendor-modules-${{ steps.submodules.outputs.hash }}

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion vendor/nim-libp2p

0 comments on commit 175fb17

Please sign in to comment.