diff --git a/.github/workflows/build-lint-typecheck-test.yaml b/.github/workflows/build-lint-typecheck-test.yaml index a9fa1556b4..89f58e9e92 100644 --- a/.github/workflows/build-lint-typecheck-test.yaml +++ b/.github/workflows/build-lint-typecheck-test.yaml @@ -25,14 +25,17 @@ jobs: registry-url: https://registry.npmjs.org/ cache: "yarn" - - name: Install dependencies - run: yarn install --immutable - - - name: Cache node_modules + # this step will also try to cache the node_modules at the end of the workflow run + - name: Restore cached node_modules + id: restore-cache-node_modules uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} + + - name: Install dependencies + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' + run: yarn install --immutable - name: Check Single Package Version Policy run: yarn syncpack:check @@ -67,8 +70,7 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules- + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Restore cached build artifacts uses: actions/cache@v4 @@ -77,7 +79,6 @@ jobs: ./sdk ./packages key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build- - name: Build passport sample app run: yarn workspace @imtbl/passport-sdk-sample-app build @@ -101,8 +102,7 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules- + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Restore cached build artifacts uses: actions/cache@v4 @@ -111,7 +111,6 @@ jobs: ./sdk ./packages key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build- - name: Typecheck run: yarn typecheck @@ -137,8 +136,7 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules- + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Restore cached build artifacts uses: actions/cache@v4 @@ -147,7 +145,6 @@ jobs: ./sdk ./packages key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build- - name: Test run: yarn test @@ -188,8 +185,7 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules- + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Get reviewing teams id: reviewer-teams @@ -203,7 +199,6 @@ jobs: ./sdk ./packages key: ${{ runner.os }}-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-build- - name: Checkout-widgets cypress tests if: ${{ contains(steps.reviewer-teams.outputs.teams, 'Wallets') && !contains(github.event.pull_request.title, 'SKIP-CY') }} @@ -243,8 +238,7 @@ jobs: uses: actions/cache@v4 with: path: node_modules - key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - restore-keys: ${{ runner.os }}-node-modules- + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Lint run: yarn lint diff --git a/.github/workflows/build-sdk.yaml b/.github/workflows/build-sdk.yaml index c555d9fddf..e11090aa67 100644 --- a/.github/workflows/build-sdk.yaml +++ b/.github/workflows/build-sdk.yaml @@ -23,19 +23,19 @@ jobs: - name: Install dependencies run: yarn install --immutable - - name: Cache build artifacts + - name: Cache node_modules uses: actions/cache@v4 with: path: node_modules key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - - name: Build - run: yarn build + # - name: Build + # run: yarn build - - name: Cache build artifacts - uses: actions/cache@v2 - with: - path: | - ./sdk - ./packages - key: ${{ runner.os }}-build-cache-${{ github.sha }} + # - name: Cache build artifacts + # uses: actions/cache@v4 + # with: + # path: | + # ./sdk + # ./packages + # key: ${{ runner.os }}-build-cache-${{ github.sha }} diff --git a/.github/workflows/detect-node-version-change.yaml b/.github/workflows/detect-node-version-change.yaml index f90d2d89bb..f717ee3cc9 100644 --- a/.github/workflows/detect-node-version-change.yaml +++ b/.github/workflows/detect-node-version-change.yaml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Get Node engine version from package.json id: get_package_json_node_engine_version diff --git a/.github/workflows/functional-tests-imx.yml b/.github/workflows/functional-tests-imx.yml index e88fe17dc6..9f219081aa 100644 --- a/.github/workflows/functional-tests-imx.yml +++ b/.github/workflows/functional-tests-imx.yml @@ -10,13 +10,25 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: 'yarn' + + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 with: - node-version-file: .nvmrc + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Install root dependencies - run: npm install -g yarn && yarn install --immutable + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' + run: yarn install --immutable - name: Build SDK run: yarn build diff --git a/.github/workflows/functional-tests-zkevm.yml b/.github/workflows/functional-tests-zkevm.yml index 977e15b0ee..7b9384f7fb 100644 --- a/.github/workflows/functional-tests-zkevm.yml +++ b/.github/workflows/functional-tests-zkevm.yml @@ -10,13 +10,25 @@ jobs: timeout-minutes: 60 runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" + cache: 'yarn' + + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} - name: Install root dependencies - run: npm install -g yarn && yarn install --immutable + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' + run: yarn install --immutable - name: Build SDK run: yarn build diff --git a/.github/workflows/playwright.yml b/.github/workflows/playwright.yml index 757eec7bc4..a0cb75072b 100644 --- a/.github/workflows/playwright.yml +++ b/.github/workflows/playwright.yml @@ -12,13 +12,25 @@ jobs: container: image: mcr.microsoft.com/playwright:v1.40.0-jammy steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Checkout + uses: actions/checkout@v4 + + - name: Use Node.js + uses: actions/setup-node@v4 with: node-version-file: samples/apps/ts-immutable-sample/.nvmrc + cache: 'yarn' + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} + - name: Install root dependencies - run: npm install -g yarn && yarn install --immutable + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' + run: yarn install --immutable - name: Build SDK run: yarn build diff --git a/.github/workflows/publish-docs.yaml b/.github/workflows/publish-docs.yaml index 10f96cf820..829d5c34b0 100644 --- a/.github/workflows/publish-docs.yaml +++ b/.github/workflows/publish-docs.yaml @@ -16,12 +16,12 @@ jobs: GITHUB_USER: ${{ github.actor }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Checkout Docs Repo - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: immutable/docs token: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }} @@ -44,7 +44,7 @@ jobs: git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: .nvmrc cache: "yarn" @@ -55,7 +55,15 @@ jobs: jq '.version = "${{ env.VERSION }}"' ./package.json > "$tmp" && mv "$tmp" ./package.json shell: bash + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' run: yarn install --immutable - name: Build diff --git a/.github/workflows/publish-major-version.yaml b/.github/workflows/publish-major-version.yaml index c0d06c7e7e..bac0691dba 100644 --- a/.github/workflows/publish-major-version.yaml +++ b/.github/workflows/publish-major-version.yaml @@ -70,7 +70,7 @@ jobs: run: failure("Public releases should be only done from main branch, current branch ${{ github.ref }}") - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -83,7 +83,7 @@ jobs: run: git fetch --tags - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: .nvmrc cache: "yarn" @@ -100,7 +100,15 @@ jobs: ./.github/scripts/version-up.sh --${{ github.event.inputs.release_type }} --$upgrade_type --apply $revision_upgrade shell: bash + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' run: yarn install --immutable - name: Lint diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index a5dc120214..e79495d0a7 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -53,7 +53,7 @@ jobs: run: failure("Public releases should be only done from main branch, current branch ${{ github.ref }}") - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 token: ${{ secrets.TS_IMMUTABLE_SDK_GITHUB_TOKEN }} @@ -67,7 +67,7 @@ jobs: run: git fetch --tags - name: Setup Node - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: .nvmrc cache: "yarn" @@ -87,7 +87,15 @@ jobs: ./.github/scripts/version-up.sh --${{ env.RELEASE_TYPE }} $upgrade_type --apply $revision_upgrade shell: bash + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} + - name: Install dependencies + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' run: yarn install --immutable - name: Lint diff --git a/.github/workflows/secret-scan.yaml b/.github/workflows/secret-scan.yaml index 8f98b52ebf..fed6f0ec9b 100644 --- a/.github/workflows/secret-scan.yaml +++ b/.github/workflows/secret-scan.yaml @@ -5,7 +5,7 @@ jobs: name: gitleaks runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - uses: gitleaks/gitleaks-action@v2.3.4 diff --git a/.github/workflows/smokes-tests.yaml b/.github/workflows/smokes-tests.yaml index 6b1361c4d1..25ee4c5c5e 100644 --- a/.github/workflows/smokes-tests.yaml +++ b/.github/workflows/smokes-tests.yaml @@ -16,16 +16,24 @@ jobs: NODE_OPTIONS: --max-old-space-size=14366 steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Use Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version-file: ".nvmrc" registry-url: https://registry.npmjs.org/ cache: "yarn" + - name: Restore cached node_modules + id: restore-cache-node_modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-build-cache-deps-${{ hashFiles('yarn.lock') }} + - name: Install root dependencies + if: steps.restore-cache-node_modules.outputs.cache-hit != 'true' run: yarn install --immutable - name: Build