1
- name : Build
1
+ name : Trie
2
2
on :
3
3
push :
4
4
branches :
7
7
- ' *'
8
8
pull_request :
9
9
types : [opened, reopened, synchronize]
10
- jobs :
11
- lint :
12
- runs-on : ubuntu-latest
13
- steps :
14
- - uses : actions/setup-node@v1
15
- - uses : actions/checkout@v2
16
- - run : npm install
17
- - run : npm run lint
18
10
19
- coverage :
20
- runs-on : ubuntu-latest
21
- steps :
22
- - uses : actions/setup-node@v1
23
- - uses : actions/checkout@v2
24
- - run : npm install
25
- - run : npm run coverage
26
- - uses : codecov/codecov-action@v1
27
- with :
28
- file : ./coverage/lcov.info
11
+ env :
12
+ cwd : ${{github.workspace}}/packages/trie
13
+
14
+ defaults :
15
+ run :
16
+ working-directory : packages/trie
29
17
30
- test :
18
+ jobs :
19
+ test-trie :
31
20
runs-on : ubuntu-latest
32
21
strategy :
33
22
matrix :
34
- node-version : [10.x, 12.x, 13.x ]
23
+ node-version : [12 ]
35
24
steps :
36
25
- name : Use Node.js ${{ matrix.node-version }}
37
26
uses : actions/setup-node@v1
38
27
with :
39
28
node-version : ${{ matrix.node-version }}
40
29
- uses : actions/checkout@v2
41
- - run : npm install
42
- - run : npm run test
30
+ with :
31
+ submodules : recursive
32
+
33
+ - name : Dependency cache
34
+ uses : actions/cache@v2
35
+ id : cache
36
+ with :
37
+ key : Trie-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
38
+ path : ' **/node_modules'
39
+
40
+ # Installs root dependencies, ignoring Bootstrap All script.
41
+ # Bootstraps the current package only
42
+ - run : npm install --ignore-scripts && npm run bootstrap:trie
43
+ if : steps.cache.outputs.cache-hit != 'true'
44
+ working-directory : ${{github.workspace}}
45
+
46
+ # Builds current package and the ones it depends from.
47
+ - run : npm run build:trie
48
+ working-directory : ${{github.workspace}}
43
49
44
- benchmarks :
50
+ - run : npm run coverage
51
+
52
+ - uses : codecov/codecov-action@v1
53
+ with :
54
+ file : ${{ env.cwd }}/coverage/lcov.info
55
+ flags : trie
56
+ if : ${{ matrix.node-version == 12 }}
57
+
58
+ - run : npm run lint
59
+
60
+ trie-benchmarks :
45
61
runs-on : ubuntu-latest
46
62
steps :
47
63
- uses : actions/setup-node@v1
64
+ with :
65
+ node-version : 12.x
48
66
- uses : actions/checkout@v1
49
- - run : npm install
67
+ with :
68
+ submodules : recursive
69
+
70
+ - name : Dependency cache
71
+ uses : actions/cache@v2
72
+ id : cache
73
+ with :
74
+ key : Trie-${{ runner.os }}-${{ matrix.node-version }}-${{ hashFiles('**/package-lock.json') }}
75
+ path : ' **/node_modules'
76
+
77
+ # Installs root dependencies, ignoring Bootstrap All script.
78
+ # Bootstraps the current package only
79
+ - run : npm install --ignore-scripts && npm run bootstrap:trie
80
+ if : steps.cache.outputs.cache-hit != 'true'
81
+ working-directory : ${{github.workspace}}
82
+
50
83
- run : npm run benchmarks | tee output.txt
84
+ working-directory : ${{ env.cwd }}
51
85
52
86
- name : Set auto-push for benchmarks to true if on master
53
87
id : auto_push
@@ -63,15 +97,18 @@ jobs:
63
97
64
98
- name : Compare benchmarks
65
99
uses : rhysd/github-action-benchmark@v1
100
+ if : github.ref == 'refs/heads/master'
66
101
with :
67
102
tool : ' benchmarkjs'
68
103
# Where the output from the benchmark tool is stored
69
- output-file-path : . /output.txt
104
+ output-file-path : ${{ env.cwd }} /output.txt
70
105
# Enable alert commit comment
71
106
comment-on-alert : true
72
- # Always leave a commit comment comparing the current benchmark with previous
73
- comment-always : true
74
107
# GitHub API token to make a commit comment
75
108
github-token : ${{ secrets.GITHUB_TOKEN }}
76
109
# Push and deploy to GitHub pages branch automatically (if on master)
77
110
auto-push : ${{ steps.auto_push.outputs.auto_push }}
111
+
112
+ # Re-apply git stash to prepare for saving back to cache.
113
+ # Avoids exit code 1 by checking if there are changes to be stashed first
114
+ - run : STASH_LIST=`git stash list` && [ ! -z $STASH_LIST ] && git stash apply || echo "No files to stash-apply. Skipping…"
0 commit comments