Skip to content

Uses SharePoint APIs in 'spo contenttype sync'. Closes #7251 #7247

Uses SharePoint APIs in 'spo contenttype sync'. Closes #7251

Uses SharePoint APIs in 'spo contenttype sync'. Closes #7251 #7247

Workflow file for this run

name: Check PR
on: pull_request
env:
NODE_VERSION: &node_version 24
jobs:
build:
if: github.repository_owner == 'pnp'
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
node: [*node_version]
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- name: Use Node.js ${{ matrix.node }}
uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.node }}
registry-url: 'https://registry.npmjs.org'
- name: Cache node modules
id: cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
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: [*node_version]
# node version on which code was built and should be tested
nodeBuild: [*node_version]
include:
- os: ubuntu-latest
nodeRun: 20
nodeBuild: *node_version
- os: ubuntu-latest
nodeRun: 22
nodeBuild: *node_version
- os: ubuntu-latest
nodeRun: 25
nodeBuild: *node_version
steps:
- name: Configure pagefile
if: matrix.os == 'windows-latest'
uses: al-cheb/configure-pagefile-action@9b6da52fb72a3c6147c1aad2df22d8d905681adc # v1.5
with:
minimum-size: 16GB
disk-root: "C:"
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
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@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ matrix.nodeRun }}
registry-url: 'https://registry.npmjs.org'
- name: Cache node modules
id: cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
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: Cache .eslintcache
if: matrix.nodeRun == matrix.nodeBuild
id: eslintcache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
with:
path: |
.eslintcache
key: eslintcache-${{ matrix.os }}-${{ hashFiles('npm-shrinkwrap.json', 'eslint.config.mjs') }}
- name: Test with coverage
# we run coverage only on Node that was used to build
if: matrix.nodeRun == matrix.nodeBuild
run: npm test
env:
NODE_OPTIONS: '--max_old_space_size=4096'
- 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@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # 7.0.1
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@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
# Number of commits to fetch. 0 indicates all history for all branches and tags. Default: 1
fetch-depth: 0
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: ${{ env.NODE_VERSION }}
- name: Cache node modules
id: cache
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # 6.1.0
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: Prepare docs versioning
run: node scripts/create-docs-versioning.mjs
- name: Build docs
run: npm run build
working-directory: docs