Skip to content

Commit 1258d15

Browse files
authored
CI Coverage (#5)
1 parent 7906a08 commit 1258d15

File tree

5 files changed

+21085
-237
lines changed

5 files changed

+21085
-237
lines changed

.github/workflows/nodejs.yml

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,53 @@
1+
12
name: nodejs
23

34
on:
45
push:
5-
pull_request:
6+
paths:
7+
- '**/**'
8+
- '!**/docs/**'
9+
10+
11+
env:
12+
CI: true
13+
FORCE_COLOR: 2
14+
615

716
jobs:
8-
build:
9-
runs-on: ubuntu-latest
17+
run:
18+
name: Node ${{ matrix.node }} on ${{ matrix.os }}
19+
runs-on: ${{ matrix.os }}
1020

1121
strategy:
22+
fail-fast: false
1223
matrix:
13-
node-version: ['10', '12', '14']
24+
node: ["10.x", "12.x", "14.x"]
25+
os: ["ubuntu-latest"]
1426

1527
steps:
16-
- uses: actions/checkout@v2
28+
- uses: actions/checkout@v2.3.4
1729
- name: Use Node.js ${{ matrix.node-version }}
18-
uses: actions/setup-node@v1
30+
uses: actions/setup-node@v2.1.4
1931
with:
2032
node-version: ${{ matrix.node-version }}
21-
- run: npm install
33+
34+
35+
- name: Get npm cache directory
36+
id: npm-cache-dir
37+
run: |
38+
echo "::set-output name=dir::$(npm config get cache)"
39+
- uses: actions/cache@v2
40+
id: npm-cache # use this to check for `cache-hit` ==> if: steps.npm-cache.outputs.cache-hit != 'true'
41+
with:
42+
path: ${{ steps.npm-cache-dir.outputs.dir }}
43+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
44+
restore-keys: |
45+
${{ runner.os }}-node-
46+
47+
48+
- name: npm install, build, and test
49+
run: |
50+
npm install
51+
npm run ci
52+
env:
53+
CI: true

.gitignore

Lines changed: 6 additions & 225 deletions
Original file line numberDiff line numberDiff line change
@@ -1,228 +1,9 @@
1-
# -*- mode: gitignore; -*-
2-
*~
3-
\#*\#
4-
/.emacs.desktop
5-
/.emacs.desktop.lock
6-
*.elc
7-
auto-save-list
8-
tramp
9-
.\#*
10-
11-
# Org-mode
12-
.org-id-locations
13-
*_archive
14-
15-
# flymake-mode
16-
*_flymake.*
17-
18-
# eshell files
19-
/eshell/history
20-
/eshell/lastdir
21-
22-
# elpa packages
23-
/elpa/
24-
25-
# reftex files
26-
*.rel
27-
28-
# AUCTeX auto folder
29-
/auto/
30-
31-
# cask packages
32-
.cask/
33-
dist/
34-
35-
# Flycheck
36-
flycheck_*.el
37-
38-
# server auth directory
39-
/server/
40-
41-
# projectiles files
42-
.projectile
43-
44-
# directory configuration
45-
.dir-locals.el
46-
47-
# network security
48-
/network-security.data
49-
50-
51-
### macOS ###
52-
# General
531
.DS_Store
54-
.AppleDouble
55-
.LSOverride
56-
57-
# Icon must end with two \r
58-
Icon
59-
60-
# Thumbnails
61-
._*
62-
63-
# Files that might appear in the root of a volume
64-
.DocumentRevisions-V100
65-
.fseventsd
66-
.Spotlight-V100
67-
.TemporaryItems
68-
.Trashes
69-
.VolumeIcon.icns
70-
.com.apple.timemachine.donotpresent
71-
72-
# Directories potentially created on remote AFP share
73-
.AppleDB
74-
.AppleDesktop
75-
Network Trash Folder
76-
Temporary Items
77-
.apdisk
78-
79-
### Node ###
80-
# Logs
81-
logs
2+
node_modules
3+
.nyc*
4+
nyc*
825
*.log
83-
npm-debug.log*
84-
yarn-debug.log*
85-
yarn-error.log*
86-
lerna-debug.log*
87-
88-
# Diagnostic reports (https://nodejs.org/api/report.html)
89-
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
90-
91-
# Runtime data
92-
pids
93-
*.pid
94-
*.seed
95-
*.pid.lock
96-
97-
# Directory for instrumented libs generated by jscoverage/JSCover
98-
lib-cov
99-
100-
# Coverage directory used by tools like istanbul
101-
coverage
102-
*.lcov
103-
104-
# nyc test coverage
105-
.nyc_output
106-
107-
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
108-
.grunt
109-
110-
# Bower dependency directory (https://bower.io/)
111-
bower_components
112-
113-
# node-waf configuration
114-
.lock-wscript
115-
116-
# Compiled binary addons (https://nodejs.org/api/addons.html)
117-
build/Release
118-
119-
# Dependency directories
120-
node_modules/
121-
jspm_packages/
122-
123-
# TypeScript v1 declaration files
124-
typings/
125-
126-
# TypeScript cache
127-
*.tsbuildinfo
128-
129-
# Optional npm cache directory
130-
.npm
131-
132-
# Optional eslint cache
133-
.eslintcache
134-
135-
# Microbundle cache
136-
.rpt2_cache/
137-
.rts2_cache_cjs/
138-
.rts2_cache_es/
139-
.rts2_cache_umd/
140-
141-
# Optional REPL history
142-
.node_repl_history
143-
144-
# Output of 'npm pack'
6+
*.coverage
7+
coverage/
1458
*.tgz
146-
147-
# Yarn Integrity file
148-
.yarn-integrity
149-
150-
# dotenv environment variables file
151-
.env
152-
.env.test
153-
.env*.local
154-
155-
# parcel-bundler cache (https://parceljs.org/)
156-
.cache
157-
.parcel-cache
158-
159-
# Next.js build output
160-
.next
161-
162-
# Nuxt.js build / generate output
163-
.nuxt
164-
dist
165-
166-
# Gatsby files
167-
.cache/
168-
# Comment in the public line in if your project uses Gatsby and not Next.js
169-
# https://nextjs.org/blog/next-9-1#public-directory-support
170-
# public
171-
172-
# vuepress build output
173-
.vuepress/dist
174-
175-
# Serverless directories
176-
.serverless/
177-
178-
# FuseBox cache
179-
.fusebox/
180-
181-
# DynamoDB Local files
182-
.dynamodb/
183-
184-
# TernJS port file
185-
.tern-port
186-
187-
# Stores VSCode versions used for testing VSCode extensions
188-
.vscode-test
189-
190-
### VisualStudioCode ###
191-
.vscode/*
192-
!.vscode/settings.json
193-
!.vscode/tasks.json
194-
!.vscode/launch.json
195-
!.vscode/extensions.json
196-
*.code-workspace
197-
198-
### VisualStudioCode Patch ###
199-
# Ignore all local history of files
200-
.history
201-
.ionide
202-
203-
### Windows ###
204-
# Windows thumbnail cache files
205-
Thumbs.db
206-
Thumbs.db:encryptable
207-
ehthumbs.db
208-
ehthumbs_vista.db
209-
210-
# Dump file
211-
*.stackdump
212-
213-
# Folder config file
214-
[Dd]esktop.ini
215-
216-
# Recycle Bin used on file shares
217-
$RECYCLE.BIN/
218-
219-
# Windows Installer files
220-
*.cab
221-
*.msi
222-
*.msix
223-
*.msm
224-
*.msp
225-
226-
# Windows shortcuts
227-
*.lnk
228-
9+
*.tar.gz

entrypoint.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,20 @@
22
set -o errexit
33
export NODE_ENV='production'
44
export SOURCE_COMMIT="${SOURCE_COMMIT:-$(git rev-parse HEAD)}"
5-
5+
mkdir -p build
66
DIR="node_modules/.bin"
77
if [ -d "$DIR" ]; then
88
echo "Building Solidity Parser..."
99
echo "Parser SOURCE_COMMIT"
1010
echo "SOURCE_COMMIT: $SOURCE_COMMIT"
1111
sleep 1
12+
rm -rf build/
13+
mkdir -p build/
1214
npx peggy --cache -o ./build/parser.js ./solidity.pegjs
1315
npx peggy -o ./build/imports_parser.js ./imports.pegjs
1416
echo "Geneated parser successfully"
1517
exit 0
1618
else
17-
echo "Error: ${DIR} not found. Try installing with npm and not yarn"
19+
echo "::error file=${DIR} not found. Try installing with npm and not yarn"
1820
exit 1
1921
fi

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,13 @@
2727
"prettier": "^2.3.2"
2828
},
2929
"scripts": {
30-
"build": "sh entrypoint.sh",
31-
"ci": "rm -rf build/ && sh entrypoint.sh && npx nyc --reporter=lcov npm test && npx codecov",
30+
"build": "npx peggy --cache -o ./build/parser.js ./solidity.pegjs",
31+
"compile": "npx peggy -o ./build/imports_parser.js ./imports.pegjs",
32+
"ci": "./entrypoint.sh && npx nyc --reporter=lcov npm test && npx codecov",
33+
"tracer": "./node_modules/.bin/peggy --trace --output parser-trace.js solidity.pegjs",
3234
"lint": "npx eslint .",
35+
"run": "npm run build && npm run compile",
3336
"format": "npx prettier --config .prettierrc.json --write .",
34-
"run": "npm run build",
3537
"test": "npx mocha --timeout 5000 --reporter spec"
3638
},
3739
"repository": {

0 commit comments

Comments
 (0)