diff --git a/.github/actions/setup-ci/action.yaml b/.github/actions/setup-ci/action.yaml index 975bc3c483..f9b714e6ca 100644 --- a/.github/actions/setup-ci/action.yaml +++ b/.github/actions/setup-ci/action.yaml @@ -1,6 +1,6 @@ --- -name: "Setup CI environment" -description: "Setup Cloudserver CI environment" +name: 'Setup CI environment' +description: 'Setup Cloudserver CI environment' runs: using: composite @@ -28,12 +28,23 @@ runs: - uses: actions/setup-node@v4 with: node-version: '22.23.1' - cache: 'yarn' + # Cache node_modules directly (not the yarn download cache) so the git + # dependencies' TypeScript compilation and relink are skipped on a hit. + # Key includes runner.os because node_modules can hold native addons; all + # CI runners are Linux/ubuntu, so the cache stays homogeneous. + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: install typescript shell: bash + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn global add typescript@4.9.5 - name: install dependencies shell: bash + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install --ignore-engines --frozen-lockfile --network-concurrency 1 - uses: actions/cache@v3 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index d775a2b8d1..de269449ef 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -86,11 +86,18 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '22.23.1' - cache: yarn + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: install typescript shell: bash + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn global add typescript@4.9.5 - name: install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile --network-concurrency 1 - uses: actions/setup-python@v5 with: @@ -127,8 +134,14 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '22.23.1' - cache: yarn + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile --network-concurrency 1 - name: Count async/await migration progress run: yarn run count-async @@ -141,11 +154,18 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '22.23.1' - cache: yarn + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: install typescript shell: bash + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn global add typescript@4.9.5 - name: install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile --network-concurrency 1 - name: Unit Coverage run: | @@ -1089,8 +1109,14 @@ jobs: - uses: actions/setup-node@v4 with: node-version: '22.23.1' - cache: yarn + - name: Cache node_modules + id: cache-node-modules + uses: actions/cache@v4 + with: + path: node_modules + key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }} - name: Install dependencies + if: steps.cache-node-modules.outputs.cache-hit != 'true' run: yarn install --frozen-lockfile --network-concurrency 1 - name: Delete stale GCP CI buckets run: yarn run cleanup_gcp_buckets