Skip to content

Commit 3f64348

Browse files
Switched from Travis CI to GitHub Actions
1 parent cd7adc0 commit 3f64348

File tree

2 files changed

+150
-66
lines changed

2 files changed

+150
-66
lines changed

.github/workflows/CI-CD.yaml

Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
# GitHub Actions workflow
2+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions
3+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-github-actions
4+
# https://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions
5+
6+
name: CI-CD
7+
8+
on:
9+
push:
10+
branches:
11+
- "*"
12+
tags-ignore:
13+
- "*"
14+
15+
schedule:
16+
- cron: "0 0 1 * *"
17+
18+
jobs:
19+
node_tests:
20+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
21+
runs-on: ${{ matrix.os }}
22+
timeout-minutes: 10
23+
strategy:
24+
fail-fast: true
25+
matrix:
26+
os:
27+
- ubuntu-latest
28+
- macos-latest
29+
- windows-latest
30+
node:
31+
- 10
32+
- 12
33+
34+
steps:
35+
- name: Checkout source
36+
uses: actions/checkout@v2
37+
38+
- name: Install Node ${{ matrix.node }}
39+
uses: actions/setup-node@v1
40+
with:
41+
node-version: ${{ matrix.node }}
42+
43+
- name: Install dependencies
44+
run: npm ci
45+
46+
- name: Run linter
47+
run: npm run lint
48+
49+
- name: Run TypeScript tests
50+
run: npm run test:typescript
51+
52+
- name: Run Node tests
53+
run: npm run coverage:node
54+
55+
- name: Send code coverage results to Coveralls
56+
uses: coverallsapp/[email protected]
57+
with:
58+
github-token: ${{ secrets.GITHUB_TOKEN }}
59+
parallel: true
60+
61+
browser_tests:
62+
name: Browser Tests
63+
runs-on: ${{ matrix.os }}
64+
timeout-minutes: 10
65+
strategy:
66+
fail-fast: true
67+
matrix:
68+
os:
69+
- ubuntu-latest # Chrome, Firefox, Safari (via SauceLabs), Edge (via SauceLabs)
70+
- windows-latest # Internet Explorer
71+
72+
steps:
73+
- name: Checkout source
74+
uses: actions/checkout@v2
75+
76+
- name: Install Node
77+
uses: actions/setup-node@v1
78+
with:
79+
node-version: 12
80+
81+
- name: Install dependencies
82+
run: npm ci
83+
84+
- name: Run tests
85+
run: npm run coverage:browser
86+
env:
87+
SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }}
88+
SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }}
89+
90+
- name: Combine code coverage data into a single file
91+
shell: bash
92+
run: |
93+
ls -Rlh coverage/*/lcov.info
94+
cat coverage/*/lcov.info > ./coverage/lcov.info
95+
96+
- name: Send code coverage results to Coveralls
97+
uses: coverallsapp/[email protected]
98+
with:
99+
github-token: ${{ secrets.GITHUB_TOKEN }}
100+
parallel: true
101+
102+
coverage:
103+
name: Code Coverage
104+
runs-on: ubuntu-latest
105+
timeout-minutes: 10
106+
needs:
107+
- node_tests
108+
- browser_tests
109+
steps:
110+
- name: Let Coveralls know that all tests have finished
111+
uses: coverallsapp/[email protected]
112+
with:
113+
github-token: ${{ secrets.GITHUB_TOKEN }}
114+
parallel-finished: true
115+
116+
deploy:
117+
name: Publish to NPM
118+
if: github.ref == 'refs/heads/master'
119+
runs-on: ubuntu-latest
120+
timeout-minutes: 10
121+
needs:
122+
- node_tests
123+
- browser_tests
124+
125+
steps:
126+
- name: Checkout source
127+
uses: actions/checkout@v2
128+
129+
- name: Install Node
130+
uses: actions/setup-node@v1
131+
132+
- name: Install dependencies
133+
run: npm ci
134+
135+
- name: Publish to NPM
136+
uses: JS-DevTools/npm-publish@v1
137+
with:
138+
token: ${{ secrets.NPM_TOKEN }}
139+
140+
- name: Prepare the non-scoped packaged
141+
run: |
142+
cp LICENSE *.md dist
143+
VERSION=$(node -e "console.log(require('./package.json').version)")
144+
sed -i "s/X.X.X/${VERSION}/g" dist/package.json
145+
146+
- name: Publish the non-scoped package to NPM
147+
uses: JS-DevTools/npm-publish@v1
148+
with:
149+
token: ${{ secrets.NPM_TOKEN }}
150+
package: dist/package.json

.travis.yml

Lines changed: 0 additions & 66 deletions
This file was deleted.

0 commit comments

Comments
 (0)