Docs test #10
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: [18] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v3 | |
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@v3 | |
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: [18] | |
# node versions on which code was built and should be tested | |
nodeBuild: [18] | |
include: | |
- os: ubuntu-latest | |
nodeRun: 20 | |
nodeBuild: 18 | |
steps: | |
- name: Configure pagefile | |
if: matrix.os == 'windows-latest' | |
uses: al-cheb/[email protected] | |
with: | |
minimum-size: 16GB | |
maximum-size: 16GB | |
disk-root: "C:" | |
- uses: actions/download-artifact@v3 | |
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@v3 | |
with: | |
node-version: ${{ matrix.nodeRun }} | |
registry-url: 'https://registry.npmjs.org' | |
- name: Cache node modules | |
id: cache | |
uses: actions/cache@v3 | |
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@18 | |
if: matrix.nodeRun == 18 | |
run: npm test | |
- name: Test without coverage | |
# we want to run tests on older Node versions to ensure that code works | |
if: matrix.nodeRun != 18 | |
run: npm run test:test | |
- name: Compress output (non-Windows) | |
if: matrix.nodeRun == 18 && matrix.os != 'windows-latest' && always() | |
run: tar -cvf coverage.tar coverage | |
- name: Compress output (Windows) | |
if: matrix.nodeRun == 18 && matrix.os == 'windows-latest' && always() | |
run: 7z a -ttar -r coverage.tar coverage | |
- uses: actions/upload-artifact@v3 | |
if: matrix.nodeRun == 18 && always() | |
with: | |
name: coverage-${{ matrix.os }}-${{ matrix.nodeRun }} | |
path: coverage.tar | |
test_docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
working-directory: docs | |
- name: Build docs | |
run: npm run build | |
working-directory: docs |