Skip to content

Commit 0b4c9dd

Browse files
committed
Combine all node CI jobs happening on push
Moved node tests execution to one workflow so it is faster. We execute just one `npm ci` to install dependencies and then use resolved `node_modules` in all jobs.
1 parent 80fa4f6 commit 0b4c9dd

File tree

2 files changed

+41
-23
lines changed

2 files changed

+41
-23
lines changed
Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Run linters
1+
name: Node.js CI
22

33
on: [push]
44

@@ -101,3 +101,43 @@ jobs:
101101

102102
- name: Run Solidity linter
103103
run: npm run lint:sol
104+
105+
run-tests:
106+
needs: install
107+
runs-on: ubuntu-latest
108+
steps:
109+
- uses: actions/checkout@v2
110+
- uses: actions/setup-node@v2
111+
with:
112+
node-version: "12.x"
113+
114+
## Restore `node_nodules` from cache initialized in `install` job.
115+
# Get exact Node version.
116+
- name: Get Node version
117+
id: node-version
118+
run: echo "::set-output name=version::$(node --version)"
119+
# Restore cache for specific OS, Node version and `package-lock.json` files hash.
120+
# It is expected that the cache will always be found as it was initialized
121+
# in `install` job executed as a requirement of this job.
122+
- name: Restore cached node modules
123+
id: node-cache
124+
uses: actions/cache@v2
125+
env:
126+
cache-name: node-modules
127+
with:
128+
path: node_modules
129+
key: ${{ runner.os }}-${{ env.cache-name }}-${{ steps.node-version.outputs.version }}-${{ hashFiles('**/package-lock.json') }}
130+
# As a fallback to not found cached node_modules directory execute `npm ci`
131+
# to install dependencies. It's not expected to happen, but better be safe
132+
# than sorry.
133+
- name: Install dependencies
134+
if: steps.node-cache.outputs.cache-hit != 'true'
135+
run: npm ci
136+
137+
- name: Run tests
138+
# Runs ganache in background
139+
run: |
140+
npm run buidler-vm &
141+
npm test
142+
env:
143+
CI: true

.github/workflows/solidity-test.yml

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

0 commit comments

Comments
 (0)