-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bump node version, add tests and code coverage
- Loading branch information
1 parent
d30432d
commit 92bb496
Showing
26 changed files
with
3,749 additions
and
3,328 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"exclude": [ | ||
"**/*.spec.js" | ||
], | ||
"reporter": [ | ||
"lcov", | ||
"text", | ||
"text-summary" | ||
], | ||
"check-coverage": true, | ||
"branches": 100, | ||
"functions": 100, | ||
"lines": 100, | ||
"statements": 100, | ||
"skip-full": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"root": true, | ||
"extends": [ | ||
"eslint:recommended", | ||
"plugin:@typescript-eslint/recommended" | ||
], | ||
"parser": "@typescript-eslint/parser", | ||
"parserOptions": { | ||
"project": [ | ||
"./tsconfig.json" | ||
] | ||
}, | ||
"plugins": [ | ||
"@typescript-eslint" | ||
], | ||
"rules": { | ||
"indent": "off", | ||
"@typescript-eslint/indent": [ | ||
"error", | ||
2 | ||
], | ||
"quotes": "off", | ||
"@typescript-eslint/quotes": [ | ||
"error", | ||
"single", | ||
{ | ||
"allowTemplateLiterals": true | ||
} | ||
] | ||
}, | ||
"ignorePatterns": [ | ||
"node_modules/", | ||
"dist/", | ||
"coverage/", | ||
"lib/" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
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] | ||
nodeRun: [18] | ||
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 without coverage | ||
run: npm test | ||
|
||
- name: Test with coverage | ||
run: npm run test:cov | ||
|
||
- uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage-${{ matrix.os }}-${{ matrix.nodeRun }} | ||
path: coverage.tar |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
cli_deploy_job: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
name: CLI Deploy Job | ||
|
||
steps: | ||
- name: Login to tenant | ||
uses: pnp/action-cli-login@v2 | ||
id: login | ||
with: | ||
ADMIN_USERNAME: ${{ secrets.ADMIN_USERNAME }} | ||
ADMIN_PASSWORD: ${{ secrets.ADMIN_PASSWORD }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: CLI for Microsoft 365 Deploy | ||
uses: ./ | ||
id: deploy | ||
with: | ||
APP_FILE_PATH: sharepoint/solution/test.sppkg | ||
SKIP_FEATURE_DEPLOYMENT: true | ||
OVERWRITE: true | ||
|
||
- name: Get the id of the app deployed | ||
run: echo "The id of the app deployed is ${{ steps.deploy.outputs.APP_ID }}" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
on: [workflow_dispatch] | ||
|
||
jobs: | ||
cli_deploy_job_site: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [18.x] | ||
|
||
name: CLI Deploy Job | ||
|
||
steps: | ||
- name: Login to tenant | ||
uses: pnp/action-cli-login@v2 | ||
id: login | ||
with: | ||
ADMIN_USERNAME: ${{ secrets.ADMIN_USERNAME }} | ||
ADMIN_PASSWORD: ${{ secrets.ADMIN_PASSWORD }} | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: CLI for Microsoft 365 Deploy | ||
uses: ./ | ||
id: deploy | ||
with: | ||
APP_FILE_PATH: sharepoint/solution/test.sppkg | ||
SCOPE: sitecollection | ||
SITE_COLLECTION_URL: https://tenant.sharepoint.com/sites/siteapps | ||
|
||
- name: Get the id of the app deployed | ||
run: echo "The id of the app deployed is ${{ steps.deploy.outputs.APP_ID }}" |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"extension": [ | ||
"ts" | ||
], | ||
"spec": "lib/**/*.spec.js", | ||
"reporter": "min", | ||
"require": "source-map-support/register", | ||
"watch": "lib/**/*.js", | ||
"timeout": 10000, | ||
"logpanel": true | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,9 @@ Create a workflow `.yml` file in your `.github/workflows` directory. An [example | |
|
||
#### Optional requirement | ||
Since `action-cli-login` requires user name and password which are sensitive pieces of information, it would be ideal to store them securely. We can achieve this in a GitHub repo by using [secrets](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/creating-and-using-encrypted-secrets). So, click on `settings` tab in your repo and add 2 new secrets: | ||
- `adminUsername` - store the admin user name in this (e.g. [email protected]) | ||
- `adminPassword` - store the password of that user in this. | ||
- `ADMIN_USERNAME` - store the admin user name in this (e.g. [email protected]) | ||
- `ADMIN_PASSWORD` - store the password of that user in this. | ||
|
||
These secrets are encrypted and can only be used by GitHub actions. | ||
|
||
### Compatibility matrix | ||
|
@@ -25,7 +26,7 @@ The following table lists which versions of the GitHub action are compatible wit | |
|
||
Version | CLI for Microsoft 365 version | ||
--- | --- | ||
v3.0.0 | v6.0.0 | ||
^v3.0.0 | v6.0.0 | ||
v2.0.2 | v5.8.0 | ||
v1.0.0 | v2.5.0 | ||
|
||
|
@@ -58,7 +59,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [10.x] | ||
node-version: [18.x] | ||
|
||
steps: | ||
|
||
|
@@ -68,18 +69,18 @@ jobs: | |
|
||
# CLI for Microsoft 365 login action | ||
- name: Login to tenant | ||
uses: pnp/action-cli-login@v2.0.0 | ||
uses: pnp/action-cli-login@v2 | ||
with: | ||
ADMIN_USERNAME: ${{ secrets.adminUsername }} | ||
ADMIN_PASSWORD: ${{ secrets.adminPassword }} | ||
ADMIN_USERNAME: ${{ secrets.ADMIN_USERNAME }} | ||
ADMIN_PASSWORD: ${{ secrets.ADMIN_PASSWORD }} | ||
|
||
# CLI for Microsoft 365 deploy app action | ||
# Use either option 1 or option 2 | ||
|
||
# Option 1 - Deploy app at tenant level | ||
- name: Option 1 - Deploy app to tenant | ||
id: climicrosoft365deploy # optional - use if output needs to be used | ||
uses: pnp/action-cli-deploy@v2.0.0 | ||
uses: pnp/action-cli-deploy@v4 | ||
with: | ||
APP_FILE_PATH: sharepoint/solution/spfx-cli-microsoft365-action.sppkg | ||
SKIP_FEATURE_DEPLOYMENT: true | ||
|
@@ -88,7 +89,7 @@ jobs: | |
|
||
# Option 2 - Deploy app to a site collection | ||
- name: Option 2 - Deploy app to a site collection | ||
uses: pnp/action-cli-deploy@v2.0.0 | ||
uses: pnp/action-cli-deploy@v4 | ||
with: | ||
APP_FILE_PATH: sharepoint/solution/spfx-cli-microsoft365-action.sppkg | ||
SCOPE: sitecollection | ||
|
@@ -100,30 +101,5 @@ jobs: | |
run: echo "The id of the app deployed is ${{ steps.climicrosoft365deploy.outputs.APP_ID }}" | ||
``` | ||
#### Self-hosted runners | ||
If self-hosted runners are used for running the workflow, then please make sure that they have `PowerShell` or `bash` installed on them. | ||
|
||
## Release notes | ||
|
||
### v3.0.1 | ||
|
||
- Fixes compatibility bug with CLI for Microsoft 365 v6.0.0 | ||
|
||
### v3.0.0 | ||
|
||
- Ensured compatibility with CLI for Microsoft 365 v6.0.0 | ||
|
||
### v2.0.2 | ||
|
||
- Fixes bug where app ID was invalid | ||
|
||
### v2.0.0 | ||
|
||
- Renames action to 'CLI for Microsoft 365' | ||
|
||
### v1.0.1 | ||
- Fixed 'skipFeatureDeployment not included in spo app deploy command for Windows' solving #4 | ||
|
||
### v1.0.0 | ||
- Added inital 'CLI for Microsoft 365 deploy' GitHub action solving #2 |
Oops, something went wrong.