diff --git a/.github/workflows/accept-baselines-fix-lints.yaml b/.github/workflows/accept-baselines-fix-lints.yaml index d0196d1e29206..84612b0f60ba1 100644 --- a/.github/workflows/accept-baselines-fix-lints.yaml +++ b/.github/workflows/accept-baselines-fix-lints.yaml @@ -8,14 +8,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 + with: + cache: npm - name: Configure Git, Run Tests, Update Baselines, Apply Fixes run: | git config user.email "typescriptbot@microsoft.com" git config user.name "TypeScript Bot" - npm install + npm ci git rm -r --quiet tests/baselines/reference :^tests/baselines/reference/docker :^tests/baselines/reference/user gulp runtests-parallel --ci --fix || true gulp baseline-accept diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e870951c587cb..2256f0e94edc4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,6 +31,20 @@ jobs: with: node-version: ${{ matrix.node-version }} check-latest: true + # We use all of this instead of "cache: npm" above to avoid mixing npm 6 caches with npm 8+ caches. + # TODO: Remove this once we stop running CI on Node 14. + - name: Get npm cache directory + id: npm-cache-info + run: | + echo "::set-output name=dir::$(npm config get cache)" + echo "::set-output name=key::$(npm --version | grep -q '^6' && echo "node14" || echo "node")" + - uses: actions/cache@v3 + id: npm-cache + with: + path: ${{ steps.npm-cache-info.outputs.dir }} + key: ${{ runner.os }}-${{ steps.npm-cache-info.outputs.key }}-${{ hashFiles('**/package-lock.json') }} + restore-keys: | + ${{ runner.os }}-${{ steps.npm-cache-info.outputs.key }}- - run: npm ci # Re: https://github.com/actions/setup-node/pull/125 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index e9bc38cbcaeb8..583a7119e06fd 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -15,7 +15,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: # We must fetch at least the immediate parents so that if this is # a pull request then we can checkout the head. diff --git a/.github/workflows/ensure-related-repos-run-crons.yml b/.github/workflows/ensure-related-repos-run-crons.yml index a26fb5b799220..265e5028bdfa0 100644 --- a/.github/workflows/ensure-related-repos-run-crons.yml +++ b/.github/workflows/ensure-related-repos-run-crons.yml @@ -22,7 +22,7 @@ jobs: git config --global user.email "typescriptbot@microsoft.com" git config --global user.name "TypeScript Bot" - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: repository: 'microsoft/TypeScript-Website' path: 'ts-site' @@ -34,7 +34,7 @@ jobs: git config --unset-all http.https://github.com/.extraheader git push https://${{ secrets.TS_BOT_GITHUB_TOKEN }}@github.com/microsoft/TypeScript-Website.git - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: repository: 'microsoft/TypeScript-Make-Monaco-Builds' path: 'monaco-builds' diff --git a/.github/workflows/new-release-branch.yaml b/.github/workflows/new-release-branch.yaml index fa1d0a070750d..b7e3a3b6b7211 100644 --- a/.github/workflows/new-release-branch.yaml +++ b/.github/workflows/new-release-branch.yaml @@ -9,10 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 5 + - uses: actions/setup-node@v3 + with: + cache: npm - run: | git checkout -b ${{ github.event.client_payload.branch_name }} sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json diff --git a/.github/workflows/nightly.yaml b/.github/workflows/nightly.yaml index 351ea3ac8cd36..c0ec8526764fa 100644 --- a/.github/workflows/nightly.yaml +++ b/.github/workflows/nightly.yaml @@ -14,11 +14,12 @@ jobs: if: github.repository == 'microsoft/TypeScript' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: # Use NODE_AUTH_TOKEN environment variable to authenticate to this registry. registry-url: https://registry.npmjs.org/ + cache: npm - name: Setup and publish nightly run: | npm whoami diff --git a/.github/workflows/release-branch-artifact.yaml b/.github/workflows/release-branch-artifact.yaml index ed039a5accd27..8eab3f8050121 100644 --- a/.github/workflows/release-branch-artifact.yaml +++ b/.github/workflows/release-branch-artifact.yaml @@ -10,8 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 + with: + cache: npm - name: npm install and test run: | npm ci diff --git a/.github/workflows/rich-navigation.yml b/.github/workflows/rich-navigation.yml index 1c955f5973461..0bf1a03281ad6 100644 --- a/.github/workflows/rich-navigation.yml +++ b/.github/workflows/rich-navigation.yml @@ -15,11 +15,13 @@ jobs: runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 5 - uses: actions/setup-node@v3 + with: + cache: npm - name: Install dependencies run: npm ci diff --git a/.github/workflows/set-version.yaml b/.github/workflows/set-version.yaml index 567fba84e030e..162b151bb5266 100644 --- a/.github/workflows/set-version.yaml +++ b/.github/workflows/set-version.yaml @@ -9,8 +9,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.client_payload.branch_name }} # notably, this is essentially the same script as `new-release-branch.yaml` (with fewer inputs), but it assumes the branch already exists @@ -20,6 +19,9 @@ jobs: # branch_name - the target branch # package_version - the full version string (eg, `3.9.1-rc` or `3.9.2`) # core_major_minor - the major.minor pair associated with the desired package_version (eg, `3.9` for `3.9.3`) + - uses: actions/setup-node@v3 + with: + cache: npm - run: | sed -i -e 's/"version": ".*"/"version": "${{ github.event.client_payload.package_version }}"/g' package.json sed -i -e 's/const versionMajorMinor = ".*"/const versionMajorMinor = "${{ github.event.client_payload.core_major_minor }}"/g' src/compiler/corePublic.ts diff --git a/.github/workflows/sync-branch.yaml b/.github/workflows/sync-branch.yaml index 2928d072348e3..2a764bc70e86c 100644 --- a/.github/workflows/sync-branch.yaml +++ b/.github/workflows/sync-branch.yaml @@ -14,14 +14,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/setup-node@v3 - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: ref: ${{ github.event.inputs.branch_name || github.event.client_payload.branch_name }} fetch-depth: 0 # This does a test post-merge and only pushes the result if the test succeeds # required client_payload members: # branch_name - the target branch + - uses: actions/setup-node@v3 + with: + cache: npm - run: | git config user.email "typescriptbot@microsoft.com" git config user.name "TypeScript Bot" diff --git a/.github/workflows/sync-wiki.yml b/.github/workflows/sync-wiki.yml index a10335070b049..8054832be0a38 100644 --- a/.github/workflows/sync-wiki.yml +++ b/.github/workflows/sync-wiki.yml @@ -9,7 +9,7 @@ jobs: - name: Get repo name run: R=${GITHUB_REPOSITORY%?wiki}; echo "BASENAME=${R##*/}" >> $GITHUB_ENV - name: Checkout ${{ env.BASENAME }}-wiki - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: repository: "${{ GITHUB.repository_owner }}/${{ env.BASENAME }}-wiki" token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/twoslash-repros.yaml b/.github/workflows/twoslash-repros.yaml index 3ff59cf2e56e2..5abf2d8e4f7fa 100644 --- a/.github/workflows/twoslash-repros.yaml +++ b/.github/workflows/twoslash-repros.yaml @@ -24,6 +24,8 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/setup-node@v3 + with: + cache: npm # TODO(jakebailey): No checkout; remove? - uses: microsoft/TypeScript-Twoslash-Repro-Action@master with: github-token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} @@ -36,6 +38,8 @@ jobs: with: fetch-depth: 0 - uses: actions/setup-node@v3 + with: + cache: npm - uses: microsoft/TypeScript-Twoslash-Repro-Action@master with: github-token: ${{ secrets.TS_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/update-lkg.yml b/.github/workflows/update-lkg.yml index 53e3aaa750aa8..286939ec0ba3f 100644 --- a/.github/workflows/update-lkg.yml +++ b/.github/workflows/update-lkg.yml @@ -8,8 +8,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 + with: + cache: npm - name: Configure Git and Update LKG run: | diff --git a/.github/workflows/update-package-lock.yaml b/.github/workflows/update-package-lock.yaml index 55961561d7b64..bd12b26aded60 100644 --- a/.github/workflows/update-package-lock.yaml +++ b/.github/workflows/update-package-lock.yaml @@ -13,10 +13,11 @@ jobs: if: github.repository == 'microsoft/TypeScript' steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: node-version: 16 + cache: npm - name: Configure git and update package-lock.json run: |