15
15
schedule :
16
16
- cron : " 0 0 1 * *"
17
17
18
- env :
19
- CI : true
20
-
21
18
jobs :
22
- test :
19
+ node_tests :
23
20
name : Node ${{ matrix.node }} on ${{ matrix.os }}
24
21
runs-on : ${{ matrix.os }}
25
22
timeout-minutes : 10
46
43
- name : Install dependencies
47
44
run : npm ci
48
45
49
- - name : Run linters
46
+ - name : Run linter
50
47
run : npm run lint
51
48
52
49
- name : Build the code
@@ -55,10 +52,49 @@ jobs:
55
52
- name : Run TypeScript tests
56
53
run : npm run test:typescript
57
54
58
- - name : Run JavaScript tests
59
- run : npm run coverage
55
+ - name : Run Node tests
56
+ run : npm run coverage:node
57
+
58
+ - name : Send code coverage results to Coveralls
59
+ uses : coverallsapp/github-action@v1.0.1
60
+ with :
61
+ github-token : ${{ secrets.GITHUB_TOKEN }}
62
+ parallel : true
63
+
64
+ browser_tests :
65
+ name : Browser Tests
66
+ runs-on : ${{ matrix.os }}
67
+ timeout-minutes : 10
68
+ strategy :
69
+ fail-fast : true
70
+ matrix :
71
+ os :
72
+ - ubuntu-latest # Chrome, Firefox, Safari (via SauceLabs), Edge (via SauceLabs)
73
+ - windows-latest # Internet Explorer
74
+
75
+ steps :
76
+ - name : Checkout source
77
+ uses : actions/checkout@v2
78
+
79
+ - name : Install Node
80
+ uses : actions/setup-node@v1
81
+ with :
82
+ node-version : 12
83
+
84
+ - name : Install dependencies
85
+ run : npm ci
86
+
87
+ - name : Build the code
88
+ run : npm run build
89
+
90
+ - name : Run tests
91
+ run : npm run coverage:browser
92
+ env :
93
+ SAUCE_USERNAME : ${{ secrets.SAUCE_USERNAME }}
94
+ SAUCE_ACCESS_KEY : ${{ secrets.SAUCE_ACCESS_KEY }}
60
95
61
96
- name : Combine code coverage data into a single file
97
+ shell : bash
62
98
run : |
63
99
ls -Rlh coverage/*/lcov.info
64
100
cat coverage/*/lcov.info > ./coverage/lcov.info
@@ -73,10 +109,39 @@ jobs:
73
109
name : Code Coverage
74
110
runs-on : ubuntu-latest
75
111
timeout-minutes : 10
76
- needs : test
112
+ needs :
113
+ - node_tests
114
+ - browser_tests
77
115
steps :
78
116
- name : Let Coveralls know that all tests have finished
79
117
uses : coverallsapp/github-action@v1.0.1
80
118
with :
81
119
github-token : ${{ secrets.GITHUB_TOKEN }}
82
120
parallel-finished : true
121
+
122
+ deploy :
123
+ name : Publish to NPM
124
+ if : github.ref == 'refs/heads/master'
125
+ runs-on : ubuntu-latest
126
+ timeout-minutes : 10
127
+ needs :
128
+ - node_tests
129
+ - browser_tests
130
+
131
+ steps :
132
+ - name : Checkout source
133
+ uses : actions/checkout@v2
134
+
135
+ - name : Install Node
136
+ uses : actions/setup-node@v1
137
+
138
+ - name : Install dependencies
139
+ run : npm ci
140
+
141
+ - name : Build the code
142
+ run : npm run build
143
+
144
+ - name : Publish to NPM
145
+ uses : JS-DevTools/npm-publish@v1
146
+ with :
147
+ token : ${{ secrets.NPM_TOKEN }}
0 commit comments