From 175fb17dc2d8bb5dd9fe42eb787f9188ba4b2a67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Pavl=C3=ADn?= Date: Mon, 15 May 2023 10:20:00 +0200 Subject: [PATCH] refactor(ci): cache all of submodules/deps to speed up build time --- .github/workflows/ci-experimental.yml | 44 +++++++++------------------ .github/workflows/ci.yml | 30 +++++++++--------- .github/workflows/release-assets.yml | 21 ++++++------- vendor/nim-libp2p | 2 +- vendor/zerokit | 2 +- 5 files changed, 40 insertions(+), 59 deletions(-) diff --git a/.github/workflows/ci-experimental.yml b/.github/workflows/ci-experimental.yml index 3e4570c6af..0829069045 100644 --- a/.github/workflows/ci-experimental.yml +++ b/.github/workflows/ci-experimental.yml @@ -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 @@ -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 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d214f1bae..d133033691 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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 @@ -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 diff --git a/.github/workflows/release-assets.yml b/.github/workflows/release-assets.yml index 8c7f2b64d3..6535bafd24 100644 --- a/.github/workflows/release-assets.yml +++ b/.github/workflows/release-assets.yml @@ -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: | diff --git a/vendor/nim-libp2p b/vendor/nim-libp2p index a1eb53b181..95e98e8c51 160000 --- a/vendor/nim-libp2p +++ b/vendor/nim-libp2p @@ -1 +1 @@ -Subproject commit a1eb53b1813df5d4fa1b343ef003ad9fb5ebb1d8 +Subproject commit 95e98e8c51d57d041a9094b300cd884b35e87b95 diff --git a/vendor/zerokit b/vendor/zerokit index 584c2cf4c0..c319f32a1e 160000 --- a/vendor/zerokit +++ b/vendor/zerokit @@ -1 +1 @@ -Subproject commit 584c2cf4c000b391ca6b415c09d8399fde329e5c +Subproject commit c319f32a1e4a3471554006523c90856a943b366e