Updates dependencies #5537
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Check PR | |
on: pull_request | |
jobs: | |
build: | |
if: github.repository_owner == 'pnp' | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
node: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Use Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: node_modules-${{ matrix.os }}-${{ matrix.node }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | |
- name: Restore dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Compress output (non-Windows) | |
if: matrix.os != 'windows-latest' | |
run: tar -cvf build.tar --exclude node_modules ./ | |
- name: Compress output (Windows) | |
if: matrix.os == 'windows-latest' | |
run: 7z a -ttar -xr!node_modules -r build.tar . | |
- name: Upload build artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build-${{ matrix.os }}-${{ matrix.node }} | |
path: build.tar | |
test: | |
if: github.repository_owner == 'pnp' | |
needs: build | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest, ubuntu-latest] | |
# node versions to run tests on | |
nodeRun: [20] | |
# node version on which code was built and should be tested | |
nodeBuild: [20] | |
include: | |
- os: ubuntu-latest | |
nodeRun: 18 | |
nodeBuild: 20 | |
- os: ubuntu-latest | |
nodeRun: 22 | |
nodeBuild: 20 | |
steps: | |
- name: Configure pagefile | |
if: matrix.os == 'windows-latest' | |
uses: al-cheb/[email protected] | |
with: | |
minimum-size: 16GB | |
disk-root: "C:" | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-${{ matrix.os }}-${{ matrix.nodeBuild }} | |
- name: Unpack build artifact (non-Windows) | |
if: matrix.os != 'windows-latest' | |
run: tar -xvf build.tar && rm build.tar | |
- name: Unpack build artifact (Windows) | |
if: matrix.os == 'windows-latest' | |
run: 7z x build.tar && del build.tar | |
- name: Use Node.js ${{ matrix.nodeRun }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.nodeRun }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
**/node_modules | |
key: node_modules-${{ matrix.os }}-${{ matrix.nodeBuild }}-${{ hashFiles('**/npm-shrinkwrap.json') }} | |
- name: Restore dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
- name: Test with coverage | |
# we run coverage only on Node that was used to build | |
if: matrix.nodeRun == matrix.nodeBuild | |
run: npm test | |
- name: Test without coverage | |
# we want to run tests on older Node versions to ensure that code works | |
if: matrix.nodeRun != matrix.nodeBuild | |
run: npm run test:test | |
- name: Compress output (non-Windows) | |
if: matrix.nodeRun == matrix.nodeBuild && matrix.os != 'windows-latest' && always() | |
run: tar -cvf coverage.tar coverage | |
- name: Compress output (Windows) | |
if: matrix.nodeRun == matrix.nodeBuild && matrix.os == 'windows-latest' && always() | |
run: 7z a -ttar -r coverage.tar coverage | |
- uses: actions/upload-artifact@v4 | |
if: matrix.nodeRun == matrix.nodeBuild && always() | |
with: | |
name: coverage-${{ matrix.os }}-${{ matrix.nodeRun }} | |
path: coverage.tar | |
test_docs: | |
if: github.repository_owner == 'pnp' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
**/docs/node_modules | |
key: docs_node_modules-${{ hashFiles('**/docs/package-lock.json') }} | |
- name: Restore dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm ci | |
working-directory: docs | |
- name: Build docs | |
run: npm run build | |
working-directory: docs |