diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9ddf904ef..804457911 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,6 +17,8 @@ env: NIM_PARAMS: "-d:disableMarchNative" NIM_VERSION: '2.2.4' NIMBLE_VERSION: '0.22.3' + # Bump to invalidate the nimble deps cache (GitHub caches are immutable per key). + NIMBLE_CACHE_VERSION: 'v3' jobs: changes: # changes detection @@ -71,6 +73,21 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Get zerokit submodule SHA + id: zerokit-sha + run: echo "sha=$(git submodule status vendor/zerokit | awk '{print $1}' | sed 's/^[+-]//')" >> $GITHUB_OUTPUT + + - name: Get librln version + id: librln-version + run: echo "version=$(make print-librln-version)" >> $GITHUB_OUTPUT + + - name: Cache librln + id: cache-librln + uses: actions/cache@v3 + with: + path: librln_${{ steps.librln-version.outputs.version }}.a + key: ${{ runner.os }}-librln-${{ steps.librln-version.outputs.version }}-${{ steps.zerokit-sha.outputs.sha }} + - name: Install Nim ${{ env.NIM_VERSION }} uses: jiro4989/setup-nim-action@v2 with: @@ -89,7 +106,10 @@ jobs: path: | nimbledeps/ nimble.paths - key: ${{ runner.os }}-nimbledeps-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + ~/.nimble + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' @@ -97,7 +117,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Build binaries run: make V=1 all @@ -124,6 +146,21 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Get zerokit submodule SHA + id: zerokit-sha + run: echo "sha=$(git submodule status vendor/zerokit | awk '{print $1}' | sed 's/^[+-]//')" >> $GITHUB_OUTPUT + + - name: Get librln version + id: librln-version + run: echo "version=$(make print-librln-version)" >> $GITHUB_OUTPUT + + - name: Cache librln + id: cache-librln + uses: actions/cache@v3 + with: + path: librln_${{ steps.librln-version.outputs.version }}.a + key: ${{ runner.os }}-librln-${{ steps.librln-version.outputs.version }}-${{ steps.zerokit-sha.outputs.sha }} + - name: Install Nim ${{ env.NIM_VERSION }} uses: jiro4989/setup-nim-action@v2 with: @@ -142,7 +179,10 @@ jobs: path: | nimbledeps/ nimble.paths - key: ${{ runner.os }}-nimbledeps-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + ~/.nimble + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' @@ -150,7 +190,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Run tests run: | @@ -207,7 +249,10 @@ jobs: path: | nimbledeps/ nimble.paths - key: ${{ runner.os }}-nimbledeps-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + ~/.nimble + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' @@ -215,7 +260,9 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps make rebuild-bearssl-nimbledeps - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Build nph run: | diff --git a/.github/workflows/windows-build.yml b/.github/workflows/windows-build.yml index 50f1602cd..9dbb92bee 100644 --- a/.github/workflows/windows-build.yml +++ b/.github/workflows/windows-build.yml @@ -11,6 +11,8 @@ env: NPROC: 4 NIM_VERSION: '2.2.4' NIMBLE_VERSION: '0.22.3' + # Bump to invalidate the nimble deps cache (GitHub caches are immutable per key). + NIMBLE_CACHE_VERSION: 'v3' jobs: build: @@ -88,6 +90,18 @@ jobs: run: | sed -i 's/68bb85cbfb1832ce4db43943911b046c3af3caab/a092a045d3a427d127a5334a6e59c76faff54686/g' nimble.lock + - name: Cache nimble deps + id: cache-nimbledeps + uses: actions/cache@v3 + with: + path: | + nimbledeps/ + nimble.paths + ~/.nimble + key: ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}-${{ hashFiles('nimble.lock', 'BearSSL.mk', 'Nat.mk') }} + restore-keys: | + ${{ runner.os }}-nimbledeps-${{ env.NIMBLE_CACHE_VERSION }}-nimble${{ env.NIMBLE_VERSION }}- + - name: Install nimble deps if: steps.cache-nimbledeps.outputs.cache-hit != 'true' run: | @@ -95,32 +109,14 @@ jobs: nimble setup --localdeps -y make rebuild-nat-libs-nimbledeps CC=gcc make rebuild-bearssl-nimbledeps CC=gcc - touch nimbledeps/.nimble-setup + + - name: Refresh nimbledeps stamp + run: touch nimbledeps/.nimble-setup - name: Creating tmp directory run: mkdir -p tmp - - name: Building wakunode2.exe + - name: Build binaries run: | export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH" - make wakunode2 V=3 -j${{ env.NPROC }} - - - name: Building libwaku.dll - run: | - export PATH="$GITHUB_WORKSPACE/.nim_runtime/bin:$HOME/.nimble/bin:$PATH" - make libwaku STATIC=0 V=1 -j - - - name: Check Executable - run: | - if [ -f "./build/wakunode2.exe" ]; then - echo "wakunode2.exe build successful" - else - echo "Build failed: wakunode2.exe not found" - exit 1 - fi - if [ -f "./build/libwaku.dll" ]; then - echo "libwaku.dll build successful" - else - echo "Build failed: libwaku.dll not found" - exit 1 - fi \ No newline at end of file + make all STATIC=0 V=1 -j${{ env.NPROC }} diff --git a/Makefile b/Makefile index ea1bf66f0..ef263da6a 100644 --- a/Makefile +++ b/Makefile @@ -172,11 +172,14 @@ deps: | nimble ################## ## RLN ## ################## -.PHONY: librln +.PHONY: librln print-librln-version LIBRLN_BUILDDIR := $(CURDIR)/vendor/zerokit LIBRLN_VERSION := v2.0.2 +print-librln-version: + @echo "$(LIBRLN_VERSION)" + ifeq ($(detected_OS),Windows) LIBRLN_FILE ?= rln.lib else