Skip to content

Commit 4dbc88d

Browse files
committed
Extract usage tests into separate GitHub Actions workflow
Primarily to group similar kinds of "usage" tests together, which are all either verifying the use of mustache.js from consuming party' point of view.
1 parent a11bfc8 commit 4dbc88d

2 files changed

Lines changed: 94 additions & 63 deletions

File tree

.github/workflows/usage.yml

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Package usage
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
package:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v2
11+
- name: Setup Node.js
12+
uses: actions/setup-node@v1
13+
with:
14+
node-version: 14.x
15+
- name: Create package tarball
16+
run: |
17+
export ARCHIVE_FILENAME=$(npm pack | tail -n 1)
18+
mv $ARCHIVE_FILENAME mustache.tgz
19+
- name: Store package tarball for later
20+
uses: actions/upload-artifact@v2
21+
with:
22+
name: package-output
23+
path: mustache.tgz
24+
25+
common-js-usage:
26+
runs-on: ubuntu-latest
27+
28+
needs: package
29+
steps:
30+
- uses: actions/checkout@v1
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v1
33+
with:
34+
node-version: 12.x
35+
- name: Get package tarball from package step
36+
uses: actions/download-artifact@v2
37+
with:
38+
name: package-output
39+
- name: Package, install and test
40+
run: |
41+
export UNPACK_DESTINATION=$(mktemp -d)
42+
mv mustache.tgz $UNPACK_DESTINATION
43+
cp test/module-systems/commonjs-test.js $UNPACK_DESTINATION
44+
cd $UNPACK_DESTINATION
45+
npm install mustache.tgz
46+
node commonjs-test.js
47+
48+
esm-usage:
49+
runs-on: ubuntu-latest
50+
51+
needs: package
52+
steps:
53+
- uses: actions/checkout@v1
54+
- name: Setup Node.js
55+
uses: actions/setup-node@v1
56+
with:
57+
node-version: '>=13.2.0'
58+
- name: Get package tarball from package step
59+
uses: actions/download-artifact@v2
60+
with:
61+
name: package-output
62+
- name: Package, install and test
63+
run: |
64+
export UNPACK_DESTINATION=$(mktemp -d)
65+
mv mustache.tgz $UNPACK_DESTINATION
66+
cp test/module-systems/esm-test.mjs $UNPACK_DESTINATION
67+
cd $UNPACK_DESTINATION
68+
npm install mustache.tgz
69+
node esm-test.mjs
70+
71+
browser-usage:
72+
runs-on: ubuntu-latest
73+
74+
steps:
75+
- uses: actions/checkout@v1
76+
- name: Setup Node.js
77+
uses: actions/setup-node@v1
78+
with:
79+
node-version: 12.x
80+
- name: Install and test
81+
run: |
82+
npm ci
83+
npx mocha test/module-systems/browser-test.js
84+
85+
deno-usage:
86+
runs-on: ubuntu-latest
87+
88+
steps:
89+
- uses: actions/checkout@v1
90+
- uses: denolib/setup-deno@master
91+
with:
92+
deno-version: 'v1.0.0'
93+
- run: deno --version
94+
- run: deno test --allow-net=deno.land test/module-systems/deno-test.ts

.github/workflows/verify.yml

Lines changed: 0 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -43,69 +43,6 @@ jobs:
4343
npm install mocha@3 chai@3
4444
npm run test-unit
4545
46-
common-js-usage:
47-
runs-on: ubuntu-latest
48-
49-
steps:
50-
- uses: actions/checkout@v1
51-
- name: Setup Node.js
52-
uses: actions/setup-node@v1
53-
with:
54-
node-version: 12.x
55-
- name: Package, install and test
56-
run: |
57-
export ARCHIVE_FILENAME=$(npm pack | tail -n 1)
58-
export UNPACK_DESTINATION=$(mktemp -d)
59-
mv $ARCHIVE_FILENAME $UNPACK_DESTINATION
60-
cp test/module-systems/commonjs-test.js $UNPACK_DESTINATION
61-
cd $UNPACK_DESTINATION
62-
npm install $ARCHIVE_FILENAME
63-
node commonjs-test.js
64-
65-
esm-usage:
66-
runs-on: ubuntu-latest
67-
68-
steps:
69-
- uses: actions/checkout@v1
70-
- name: Setup Node.js
71-
uses: actions/setup-node@v1
72-
with:
73-
node-version: '>=13.2.0'
74-
- name: Package, install and test
75-
run: |
76-
export ARCHIVE_FILENAME=$(npm pack | tail -n 1)
77-
export UNPACK_DESTINATION=$(mktemp -d)
78-
mv $ARCHIVE_FILENAME $UNPACK_DESTINATION
79-
cp test/module-systems/esm-test.mjs $UNPACK_DESTINATION
80-
cd $UNPACK_DESTINATION
81-
npm install $ARCHIVE_FILENAME
82-
node esm-test.mjs
83-
84-
browser-usage:
85-
runs-on: ubuntu-latest
86-
87-
steps:
88-
- uses: actions/checkout@v1
89-
- name: Setup Node.js
90-
uses: actions/setup-node@v1
91-
with:
92-
node-version: 12.x
93-
- name: Install and test
94-
run: |
95-
npm ci
96-
npx mocha test/module-systems/browser-test.js
97-
98-
deno-usage:
99-
runs-on: ubuntu-latest
100-
101-
steps:
102-
- uses: actions/checkout@v1
103-
- uses: denolib/setup-deno@master
104-
with:
105-
deno-version: 'v1.0.0'
106-
- run: deno --version
107-
- run: deno test --allow-net=deno.land test/module-systems/deno-test.ts
108-
10946
build-output-sync:
11047
runs-on: ubuntu-latest
11148

0 commit comments

Comments
 (0)