Skip to content

Commit

Permalink
Combine all node CI jobs happening on push
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
nkuba committed Jan 13, 2021
1 parent e4d04e8 commit ab282e1
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 23 deletions.
42 changes: 41 additions & 1 deletion .github/workflows/lint.yml → .github/workflows/node.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Run linters
name: Node.js CI

on: [push]

Expand Down Expand Up @@ -101,3 +101,43 @@ jobs:

- name: Run Solidity linter
run: npm run lint:sol

run-tests:
needs: install
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: "12.x"

## Restore `node_nodules` from cache initialized in `install` job.
# Get exact Node version.
- name: Get Node version
id: node-version
run: echo "::set-output name=version::$(node --version)"
# Restore cache for specific OS, Node version and `package-lock.json` files hash.
# It is expected that the cache will always be found as it was initialized
# in `install` job executed as a requirement of this job.
- name: Restore cached node modules
id: node-cache
uses: actions/cache@v2
env:
cache-name: node-modules
with:
path: node_modules
key: ${{ runner.os }}-${{ env.cache-name }}-${{ steps.node-version.outputs.version }}-${{ hashFiles('**/package-lock.json') }}
# As a fallback to not found cached node_modules directory execute `npm ci`
# to install dependencies. It's not expected to happen, but better be safe
# than sorry.
- name: Install dependencies
if: steps.node-cache.outputs.cache-hit != 'true'
run: npm ci

- name: Run tests
# Runs ganache in background
run: |
npm run buidler-vm &
npm test
env:
CI: true
22 changes: 0 additions & 22 deletions .github/workflows/solidity-test.yml

This file was deleted.

0 comments on commit ab282e1

Please sign in to comment.