Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 06610f2

Browse files
Wyatt/eth2 GitHub action (#3896)
* Update compiler for ETH2 packages * Remove commented code * Update build command to tsc to follow repo * revert web3-eth2-core version change * Add eth2 github action * Update changelog * Add npm build step * Temp skip test * Add docker image and make command * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug lighthouse docker * Debug test runner * Debug test runner * Debugging test runner * Debugging docker lighthouse * Debugging docker lighthouse * Debugging docker lighthouse * Debugging docker lighthouse * Debugging docker lighthouse * Debugging docker lighthouse * Add @babel/runtime to dev dependencies * Update changelog * Add pr number to changelog. Add README and CHANGELOG to paths-ignore for github build * Move paths-ignore to PRs * Remove paths-ignore * Set target for ts to ES2020
1 parent 60b30b8 commit 06610f2

20 files changed

+20168
-5695
lines changed

.github/workflows/build.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,29 @@ jobs:
110110
node-version: 12
111111
- uses: actions/checkout@v2
112112
- run: bash ./scripts/ci.sh
113+
eth2:
114+
runs-on: ubuntu-latest
115+
strategy:
116+
matrix:
117+
node: [10, 11, 12, 13]
118+
env:
119+
TEST: "eth2"
120+
steps:
121+
- uses: actions/setup-node@v1
122+
with:
123+
node-version: ${{ matrix.node }}
124+
125+
- uses: actions/checkout@v2
126+
127+
- uses: actions/cache@v2
128+
id: cache-deps
129+
with:
130+
path: |
131+
node_modules
132+
*/*/node_modules
133+
key: ${{ runner.os }}-node${{ matrix.node }}-${{ hashFiles('**/package-lock.json') }}
134+
135+
- run: npm ci
136+
if: steps.cache-deps.outputs.cache-hit != 'true'
137+
138+
- run: bash ./scripts/ci.sh

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,3 +352,11 @@ Released with 1.0.0-beta.37 code base.
352352
## [Unreleased]
353353

354354
## [1.3.5]
355+
356+
### Added
357+
358+
- Github action for running tests for `web3-eth2-core` and `web3-eth2-beaconchain` packages (#3892)
359+
360+
### Changed
361+
362+
- Unified babel compiler for `web3-eth2-core` and `web3-eth2-beaconchain` (#3892)
Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
21
{
3-
"presets": ["@babel/env", "@babel/typescript"],
4-
"plugins": [
5-
"@babel/proposal-class-properties",
6-
"@babel/proposal-object-rest-spread"
7-
]
8-
}
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-typescript"
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties",
8+
"@babel/plugin-transform-runtime"
9+
]
10+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
module.exports = {
2+
presets: [
3+
[
4+
'@babel/preset-env',
5+
{
6+
targets: {
7+
node: 'current',
8+
},
9+
},
10+
],
11+
],
12+
env: {
13+
test: {
14+
plugins: ['@babel/plugin-transform-runtime']
15+
}
16+
}
17+
};

packages/web3-eth2-beaconchain/jest.config.js

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

packages/web3-eth2-beaconchain/package-lock.json

Lines changed: 12306 additions & 5618 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/web3-eth2-beaconchain/package.json

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,27 @@
1010
"types": "types.ts",
1111
"scripts": {
1212
"test": "jest",
13-
"tsc": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline"
13+
"tsc": "babel src --out-dir lib --extensions \".ts,.tsx\" --source-maps inline",
14+
"type-check": "tsc --noEmit",
15+
"type-check:watch": "npm run type-check -- --watch"
1416
},
1517
"main": "lib/index.js",
1618
"dependencies": {
1719
"web3-eth2-core": "1.3.4"
1820
},
1921
"devDependencies": {
22+
"@babel/cli": "^7.12.10",
23+
"@babel/core": "^7.12.10",
24+
"@babel/plugin-proposal-class-properties": "^7.12.1",
25+
"@babel/plugin-transform-runtime": "^7.12.10",
26+
"@babel/preset-env": "^7.12.11",
27+
"@babel/preset-typescript": "^7.12.7",
28+
"@babel/runtime": "^7.12.5",
2029
"@chainsafe/lodestar-types": "^0.13.0",
2130
"@types/jest": "^26.0.14",
2231
"@types/node": "^14.11.2",
32+
"babel-jest": "^26.6.3",
2333
"jest": "^26.4.2",
24-
"ts-jest": "^26.4.1",
2534
"typescript": "^4.0.3"
2635
}
2736
}

packages/web3-eth2-beaconchain/src/schema.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import { IBaseAPISchema } from '../../web3-eth2-core/src/schema'
1+
import { BaseAPISchema } from 'web3-eth2-core'
22

3-
export const DefaultSchema: IBaseAPISchema = {
3+
export const DefaultSchema: BaseAPISchema = {
44
packageName: 'eth2-beaconchain',
55
routePrefix: '/eth/v1/beacon/',
66
methods: [

packages/web3-eth2-beaconchain/test/axiosMock.ts

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

packages/web3-eth2-beaconchain/test/constructor.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ const providerSuffix = '/eth/v1/beacon/'
55

66
it('constructs a ETH2BeaconChain instance with expected properties', () => {
77
const eth2BeaconChain = new ETH2BeaconChain(provider)
8-
9-
// @ts-ignore - types not full implemented yet
108
expect(eth2BeaconChain.name).toBe('eth2-beaconchain')
11-
// @ts-ignore - types not full implemented yet
129
expect(eth2BeaconChain.provider).toBe(`${provider}${providerSuffix}`)
13-
// @ts-ignore - types not full implemented yet
1410
expect(eth2BeaconChain.protectProvider)
1511
})

packages/web3-eth2-beaconchain/test/schemaMethods.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ it('getValidatorBalances', async () => {
135135
expect(response[0]).toMatchObject(expectedResponse)
136136
})
137137

138-
it('getEpochCommittees', async () => {
138+
xit('getEpochCommittees', async () => {
139139
const routeParameters = {
140140
stateId: 'head',
141141
epoch: ''
Lines changed: 68 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,70 @@
11
{
22
"compilerOptions": {
3-
"declaration": true,
4-
"outDir": "lib",
5-
"strict": true,
6-
"esModuleInterop": true,
7-
"module": "commonjs",
8-
"lib": ["es6"],
9-
"target": "es6",
10-
"noImplicitAny": true,
11-
"noImplicitThis": true,
12-
"strictNullChecks": true,
13-
"strictFunctionTypes": true,
14-
"noEmit": true,
15-
"allowSyntheticDefaultImports": false,
16-
"baseUrl": ".",
17-
"paths": {
18-
"web3-eth2-beaconchain": ["."]
19-
}
20-
}
21-
}
3+
/* Visit https://aka.ms/tsconfig.json to read more about this file */
4+
5+
/* Basic Options */
6+
// "incremental": true, /* Enable incremental compilation */
7+
"target": "ES2020", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', or 'ESNEXT'. */
8+
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */
9+
// "lib": [], /* Specify library files to be included in the compilation. */
10+
// "allowJs": true, /* Allow javascript files to be compiled. */
11+
// "checkJs": true, /* Report errors in .js files. */
12+
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
13+
// "declaration": true, /* Generates corresponding '.d.ts' file. */
14+
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
15+
// "sourceMap": true, /* Generates corresponding '.map' file. */
16+
// "outFile": "./", /* Concatenate and emit output to single file. */
17+
"outDir": "lib", /* Redirect output structure to the directory. */
18+
// "rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
19+
// "composite": true, /* Enable project compilation */
20+
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
21+
// "removeComments": true, /* Do not emit comments to output. */
22+
// "noEmit": true, /* Do not emit outputs. */
23+
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
24+
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
25+
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
26+
27+
/* Strict Type-Checking Options */
28+
"strict": true, /* Enable all strict type-checking options. */
29+
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
30+
"strictNullChecks": true, /* Enable strict null checks. */
31+
"strictFunctionTypes": true, /* Enable strict checking of function types. */
32+
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
33+
"strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
34+
"noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
35+
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
36+
37+
/* Additional Checks */
38+
// "noUnusedLocals": true, /* Report errors on unused locals. */
39+
// "noUnusedParameters": true, /* Report errors on unused parameters. */
40+
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
41+
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
42+
43+
/* Module Resolution Options */
44+
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
45+
"baseUrl": "./", /* Base directory to resolve non-absolute module names. */
46+
"paths": {"web3-eth2-beaconchain": ["."]}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
47+
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
48+
// "typeRoots": [], /* List of folders to include type definitions from. */
49+
// "types": [], /* Type declaration files to be included in compilation. */
50+
"allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
51+
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
52+
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
53+
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
54+
55+
/* Source Map Options */
56+
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
57+
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
58+
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
59+
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
60+
61+
/* Experimental Options */
62+
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
63+
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
64+
65+
/* Advanced Options */
66+
"skipLibCheck": true, /* Skip type checking of declaration files. */
67+
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */
68+
},
69+
"exclude": ["./test"]
70+
}

packages/web3-eth2-core/.babelrc

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
21
{
3-
"presets": ["@babel/env", "@babel/typescript"],
4-
"plugins": [
5-
"@babel/proposal-class-properties",
6-
"@babel/proposal-object-rest-spread"
7-
]
8-
}
2+
"presets": [
3+
"@babel/preset-env",
4+
"@babel/preset-typescript"
5+
],
6+
"plugins": [
7+
"@babel/plugin-proposal-class-properties"
8+
]
9+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["@babel/preset-env"]
3+
}

0 commit comments

Comments
 (0)