diff --git a/.github/actions/sync-workspace/action.yml b/.github/actions/sync-workspace/action.yml index 3a67d1a1ef1..3a45e77ef57 100644 --- a/.github/actions/sync-workspace/action.yml +++ b/.github/actions/sync-workspace/action.yml @@ -4,21 +4,29 @@ inputs: package-json-checksum: description: "Checksum of package.json" required: true + rebuild-package: + description: "Rebuild package. It also disable fail-on-cache-miss" + required: false + default: 'false' runs: using: "composite" steps: - uses: actions/cache/restore@v3 id: cache_node + env: + REBUILD_PACKAGE: ${{ inputs.rebuild-package }} with: path: | node_modules packages/**/node_modules key: node-${{ runner.os }}-${{ runner.arch }}-${{ env.NODE_MODULE_CACHE_VERSION }}-${{ hashFiles('**/yarn.lock') }}-${{ inputs.package-json-checksum }} enableCrossOsArchive: true - fail-on-cache-miss: true + fail-on-cache-miss: "!${{ fromJSON(env.REBUILD_PACKAGE) }}" - name: Restore build artifacts cache - uses: actions/cache@v3 + uses: actions/cache/restore@v3 id: cache_build_artifacts + env: + REBUILD_PACKAGE: ${{ inputs.rebuild-package }} with: # We need to cache all the artifacts generated by yarn install+build # Update this list also in .github/actions/sync-workspace/action.yml with exactly the same list @@ -35,4 +43,12 @@ runs: restore-keys: | code-${{ github.sha }} enableCrossOsArchive: true - fail-on-cache-miss: true + fail-on-cache-miss: "!${{ fromJSON(env.REBUILD_PACKAGE) }}" + - name: Rebuild package + shell: bash --login -eo pipefail {0} + env: + REBUILD_PACKAGE: ${{ inputs.rebuild-package }} + if: ${{ fromJSON(env.REBUILD_PACKAGE) }} + run: | + yarn install + yarn build --ignore docs --include-dependencies diff --git a/.github/workflows/circleci.yml b/.github/workflows/circleci.yml index a0acc1eee91..f060e1fc964 100644 --- a/.github/workflows/circleci.yml +++ b/.github/workflows/circleci.yml @@ -69,8 +69,9 @@ jobs: id: node-checksums run: | find . -maxdepth 5 -type f -name 'package.json' -not -path "*node_modules*" -print0 | sort -z | xargs -0 cat > $RUNNER_TEMP/package.checksum - find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat > $RUNNER_TEMP/patches.checksum - echo "PACKAGE_JSON_CHECKSUM=${{ hashFiles('$RUNNER_TEMP/*.checksum') }}" >> "$GITHUB_OUTPUT" + find ./patches -type f -name '*.patch' -print0 | sort -z | xargs -0 cat >> $RUNNER_TEMP/package.checksum + echo "PACKAGE_JSON_CHECKSUM=$(md5sum $RUNNER_TEMP/package.checksum | cut -f1 -d' ')" + echo "PACKAGE_JSON_CHECKSUM=$(md5sum $RUNNER_TEMP/package.checksum | cut -f1 -d' ')" >> "$GITHUB_OUTPUT" - name: Restore node cache uses: actions/cache@v3 id: cache_node @@ -331,10 +332,13 @@ jobs: path: .git key: git-${{ github.ref }} - uses: actions/checkout@v3 + with: + submodules: recursive - name: Sync workspace uses: ./.github/actions/sync-workspace with: package-json-checksum: ${{ needs.install-dependencies.outputs.package-json-checksum }} + rebuild-package: 'true' - name: Build protocol run: | yarn --cwd packages/protocol build @@ -753,7 +757,7 @@ jobs: - name: Setup tmate session uses: mxschmitt/action-tmate@v3 timeout-minutes: 20 - if: contains(matrix.command, '/lockedgold.sh') + if: contains(matrix.command, '/lockedgold.sh') && false with: limit-access-to-actor: true - name: Certora dependencies @@ -768,4 +772,3 @@ jobs: - name: Build and run command run: | ${{ matrix.command }} - \ No newline at end of file diff --git a/package.json b/package.json index bc6cba82d3b..e3408fcefa7 100644 --- a/package.json +++ b/package.json @@ -133,4 +133,4 @@ "websocket-extensions": "^0.1.4", "y18n": "^5.0.5" } -} \ No newline at end of file +}