-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
9 changed files
with
150 additions
and
50 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,129 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
release: | ||
types: [published] | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
env: | ||
PRIMARY_NODE_VERSION: 16.x | ||
PRIMARY_OS: ubuntu-latest | ||
REGISTRY: https://registry.npmjs.org/ | ||
|
||
jobs: | ||
test: | ||
name: CI | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, macos-latest] | ||
node-version: [6.x, 8.x, 10.x, 12.x, 14.x, 16.x] | ||
|
||
steps: | ||
|
||
- name: Echo env variables | ||
run: | | ||
echo ref: ${{ github.event.client_payload.ref || github.ref }} | ||
echo sha: ${{ github.event.client_payload.sha || github.sha }} | ||
echo head ref: ${{ github.event.client_payload.head_ref || github.head_ref }} | ||
echo base ref: ${{ github.event.client_payload.base_ref || github.base_ref }} | ||
echo action: ${{ github.action }} | ||
echo event: ${{ github.event_name }} | ||
- uses: actions/checkout@v2 | ||
name: Checkout | ||
with: | ||
ref: ${{ github.event.client_payload.ref || github.ref }} | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Get npm cache directory | ||
id: npm-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(npm config get cache)" | ||
- uses: actions/cache@v2 | ||
id: npm-cache | ||
with: | ||
path: ${{ steps.npm-cache-dir.outputs.dir }} | ||
key: ${{ matrix.os }}-${{ matrix.node-version }}-node | ||
restore-keys: | | ||
${{ matrix.os }}-${{ matrix.node-version }}-node | ||
- name: Install dependencies and build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Snyk security check | ||
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS | ||
uses: snyk/actions/node@master | ||
env: | ||
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | ||
|
||
- name: Run unit tests with coverage | ||
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS | ||
uses: paambaati/[email protected] | ||
env: | ||
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} | ||
with: | ||
coverageCommand: npm run cover | ||
|
||
- name: Run unit tests | ||
if: "!(matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS)" | ||
run: npm run test | ||
|
||
publish_version: | ||
name: Publish | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [6.x] | ||
needs: [test] | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: fetch | ||
run: | | ||
git fetch --prune --unshallow | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
registry-url: ${{ env.REGISTRY }} | ||
|
||
- name: Get npm cache directory | ||
id: npm-cache-dir | ||
run: | | ||
echo "::set-output name=dir::$(npm config get cache)" | ||
- uses: actions/cache@v2 | ||
id: npm-cache | ||
with: | ||
path: ${{ steps.npm-cache-dir.outputs.dir }} | ||
key: ${{ matrix.os }}-${{ matrix.node-version }}-node | ||
restore-keys: | | ||
${{ matrix.os }}-${{ matrix.node-version }}-node | ||
- name: Install dependencies and build | ||
run: | | ||
npm install | ||
npm run build | ||
- name: Publish | ||
uses: JS-DevTools/npm-publish@v1 | ||
with: | ||
token: ${{ secrets.NPM_AUTH_TOKEN }} | ||
registry: ${{ env.REGISTRY }} |
This file was deleted.
Oops, something went wrong.
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
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
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
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