Skip to content

Commit 484960c

Browse files
committed
mpt -> monorepo transition: added CI configuration (also for node tests), aligned dependencies for hoisting, updated package-lock.json, added lerna bootstrap and build commands
1 parent 4c14bc2 commit 484960c

File tree

8 files changed

+12274
-2037
lines changed

8 files changed

+12274
-2037
lines changed

.github/workflows/node-versions.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
run: npm run test
6969
working-directory: packages/ethash
7070

71+
- name: Test Trie
72+
run: npm run test
73+
working-directory: packages/trie
74+
7175
- name: Test Tx
7276
run: npm run test
7377
working-directory: packages/tx

.github/workflows/trie-build.yml

Lines changed: 65 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build
1+
name: Trie
22
on:
33
push:
44
branches:
@@ -7,47 +7,81 @@ on:
77
- '*'
88
pull_request:
99
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
1810

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
2917

30-
test:
18+
jobs:
19+
test-trie:
3120
runs-on: ubuntu-latest
3221
strategy:
3322
matrix:
34-
node-version: [10.x, 12.x, 13.x]
23+
node-version: [12]
3524
steps:
3625
- name: Use Node.js ${{ matrix.node-version }}
3726
uses: actions/setup-node@v1
3827
with:
3928
node-version: ${{ matrix.node-version }}
4029
- 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}}
4349

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:
4561
runs-on: ubuntu-latest
4662
steps:
4763
- uses: actions/setup-node@v1
64+
with:
65+
node-version: 12.x
4866
- 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+
5083
- run: npm run benchmarks | tee output.txt
84+
working-directory: ${{ env.cwd }}
5185

5286
- name: Set auto-push for benchmarks to true if on master
5387
id: auto_push
@@ -63,15 +97,18 @@ jobs:
6397

6498
- name: Compare benchmarks
6599
uses: rhysd/github-action-benchmark@v1
100+
if: github.ref == 'refs/heads/master'
66101
with:
67102
tool: 'benchmarkjs'
68103
# Where the output from the benchmark tool is stored
69-
output-file-path: ./output.txt
104+
output-file-path: ${{ env.cwd }}/output.txt
70105
# Enable alert commit comment
71106
comment-on-alert: true
72-
# Always leave a commit comment comparing the current benchmark with previous
73-
comment-always: true
74107
# GitHub API token to make a commit comment
75108
github-token: ${{ secrets.GITHUB_TOKEN }}
76109
# Push and deploy to GitHub pages branch automatically (if on master)
77110
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

Comments
 (0)