Skip to content

Commit f6e4120

Browse files
authored
V1 (#14)
1 parent 0d06b45 commit f6e4120

File tree

10 files changed

+1767
-2461
lines changed

10 files changed

+1767
-2461
lines changed

Diff for: .github/workflows/ci.yml

+135
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
release:
8+
types: [ published ]
9+
pull_request:
10+
branches:
11+
- '**'
12+
13+
env:
14+
PRIMARY_NODE_VERSION: 18.x
15+
PRIMARY_OS: ubuntu-latest
16+
REGISTRY: https://registry.npmjs.org/
17+
18+
jobs:
19+
test:
20+
name: CI
21+
runs-on: ${{ matrix.os }}
22+
strategy:
23+
matrix:
24+
os: [ ubuntu-latest ]
25+
node-version: [ 14.x, 16.x, 18.x, 20.x ]
26+
27+
steps:
28+
29+
- name: Echo env variables
30+
run: |
31+
echo ref: ${{ github.event.client_payload.ref || github.ref }}
32+
echo sha: ${{ github.event.client_payload.sha || github.sha }}
33+
echo head ref: ${{ github.event.client_payload.head_ref || github.head_ref }}
34+
echo base ref: ${{ github.event.client_payload.base_ref || github.base_ref }}
35+
echo action: ${{ github.action }}
36+
echo event: ${{ github.event_name }}
37+
38+
- uses: actions/checkout@v2
39+
name: Checkout
40+
with:
41+
ref: ${{ github.event.client_payload.ref || github.ref }}
42+
43+
- name: Use Node.js ${{ matrix.node-version }}
44+
uses: actions/setup-node@v2
45+
with:
46+
node-version: ${{ matrix.node-version }}
47+
48+
- name: Get yarn cache directory
49+
id: yarn-cache-dir
50+
run: |
51+
echo "::set-output name=dir::$(yarn cache dir)"
52+
53+
- uses: actions/cache@v2
54+
id: yarn-cache
55+
with:
56+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
57+
key: ${{ matrix.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
58+
restore-keys: |
59+
${{ matrix.os }}-${{ matrix.node-version }}-yarn-
60+
61+
- name: Install dependencies and build
62+
run: |
63+
yarn install --ignore-engines
64+
yarn build
65+
66+
- name: Snyk security check
67+
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
68+
uses: snyk/actions/node@master
69+
env:
70+
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }}
71+
72+
- name: Run linter
73+
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
74+
run: |
75+
yarn lint
76+
77+
- name: Run unit tests with coverage
78+
if: matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS
79+
uses: paambaati/[email protected]
80+
env:
81+
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
82+
with:
83+
coverageCommand: yarn cover
84+
85+
- name: Run unit tests
86+
if: "!(matrix.node-version == env.PRIMARY_NODE_VERSION && matrix.os == env.PRIMARY_OS)"
87+
run: yarn mocha
88+
89+
publish_version:
90+
name: Publish
91+
runs-on: ${{ matrix.os }}
92+
strategy:
93+
matrix:
94+
os: [ ubuntu-latest ]
95+
node-version: [ 18.x ]
96+
needs: [ test ]
97+
if: github.event_name == 'release' && github.event.action == 'published'
98+
steps:
99+
100+
- name: Checkout
101+
uses: actions/checkout@v2
102+
103+
- name: fetch
104+
run: |
105+
git fetch --prune --unshallow
106+
107+
- name: Use Node.js ${{ matrix.node-version }}
108+
uses: actions/setup-node@v2
109+
with:
110+
node-version: ${{ matrix.node-version }}
111+
registry-url: ${{ env.REGISTRY }}
112+
113+
- name: Get yarn cache directory
114+
id: yarn-cache-dir
115+
run: |
116+
echo "::set-output name=dir::$(yarn cache dir)"
117+
118+
- uses: actions/cache@v2
119+
id: yarn-cache
120+
with:
121+
path: ${{ steps.yarn-cache-dir.outputs.dir }}
122+
key: ${{ matrix.os }}-${{ matrix.node-version }}-yarn-${{ hashFiles('**/yarn.lock') }}
123+
restore-keys: |
124+
${{ matrix.os }}-${{ matrix.node-version }}-yarn-
125+
126+
- name: Install dependencies and build
127+
run: |
128+
yarn install --ignore-engines
129+
yarn build
130+
131+
- name: Publish
132+
uses: JS-DevTools/npm-publish@v1
133+
with:
134+
token: ${{ secrets.NPM_AUTH_TOKEN }}
135+
registry: ${{ env.REGISTRY }}

Diff for: .travis.yml

-27
This file was deleted.

0 commit comments

Comments
 (0)