Skip to content

Commit

Permalink
Merge branch 'unstable' into cayman/yamux
Browse files Browse the repository at this point in the history
  • Loading branch information
wemeetagain committed Jul 17, 2024
2 parents e39a348 + c6369ee commit 3766b37
Show file tree
Hide file tree
Showing 685 changed files with 17,875 additions and 11,017 deletions.
2 changes: 2 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
// Upgrade the container to Node 22
// https://github.com/ChainSafe/lodestar/issues/6742
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
"features": {
"ghcr.io/devcontainers/features/python:1": {}
Expand Down
12 changes: 11 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module.exports = {
project: "./tsconfig.json",
sourceType: "module",
},
ignorePatterns: [
"webEsmBundle.browser.test.ts"
],
plugins: ["@typescript-eslint", "eslint-plugin-import", "@chainsafe/eslint-plugin-node", "prettier"],
extends: [
"eslint:recommended",
Expand Down Expand Up @@ -194,7 +197,14 @@ module.exports = {
},
overrides: [
{
files: ["**/*.config.js", "**/*.config.mjs", "**/*.config.cjs", "**/*.config.ts"],
files: [
"**/*.config.js",
"**/*.config.mjs",
"**/*.config.cjs",
"**/*.config.ts",
"scripts/vitest/**/*.ts",
"scripts/vite/**/*.ts",
],
rules: {
"@typescript-eslint/naming-convention": "off",
// Allow require in CJS modules
Expand Down
12 changes: 10 additions & 2 deletions .github/actions/setup-and-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-node-${{ inputs.node }}-${{ github.sha }}
key: ${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node }}-${{ github.sha }}

- name: Install & build
if: steps.cache-build-restore.outputs.cache-hit != 'true'
Expand All @@ -46,6 +46,14 @@ runs:
shell: bash
run: yarn check-build

- name: Build bundle
shell: bash
run: yarn build:bundle

- name: Check bundle
shell: bash
run: yarn check-bundle

- name: Cache build artifacts
uses: actions/cache@master
with:
Expand All @@ -55,4 +63,4 @@ runs:
lib/
packages/*/lib
packages/*/.git-data.json
key: ${{ runner.os }}-node-${{ inputs.node }}-${{ github.sha }}
key: ${{ runner.os }}-${{ runner.arch }}-node-${{ inputs.node }}-${{ github.sha }}
2 changes: 1 addition & 1 deletion .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
check-latest: true
cache: yarn
- name: Node.js version
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/binaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build binaries

on:
workflow_dispatch:
inputs:
version:
required: true
type: string
workflow_call:
inputs:
version:
required: true
type: string

jobs:
binaries:
name: Build lodestar binaries
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
platform: linux
arch: amd64
- os: lodestar-arm64-runner
platform: linux
arch: arm64
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@v4
- name: Install arm64 specifics
if: matrix.arch == 'arm64'
run: |-
# Install missing yarn
# See https://github.com/github-early-access/arm-runners-beta/issues/5
curl -fsSL --create-dirs -o $HOME/bin/yarn \
https://github.com/yarnpkg/yarn/releases/download/v1.22.22/yarn-1.22.22.js
chmod +x $HOME/bin/yarn
echo "$HOME/bin" >> $GITHUB_PATH
# Install missing build-essential
sudo apt-get update
sudo apt-get install -y build-essential python3
- uses: "./.github/actions/setup-and-build"
with:
node: 22
- run: |
mkdir -p dist
yarn global add caxa@3.0.1
npx caxa -m "Unpacking Lodestar binary, please wait..." -e "dashboards/**" -e "docs/**" -D -p "yarn install --frozen-lockfile --production" --input . --output "lodestar" -- "{{caxa}}/node_modules/.bin/node" "--max-old-space-size=8192" "{{caxa}}/node_modules/.bin/lodestar"
tar -czf "dist/lodestar-${{ inputs.version }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz" "lodestar"
- name: Upload binaries
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.os }}
path: dist/
if-no-files-found: error
- name: Sanity check binary
uses: actions/github-script@v7
with:
script: |
exec.exec('./lodestar dev');
await new Promise(resolve => setTimeout(resolve, 30000));
const resp = await fetch('http://127.0.0.1:9596/eth/v1/node/version').catch(err => {
core.setFailed(`Error accessing the API ${err}`);
process.exit(1);
});
if (resp.status !== 200) {
core.setFailed(`Failed to access API: ${resp.status}`);
process.exit(1);
}
process.exit(0);
2 changes: 1 addition & 1 deletion .github/workflows/docs-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
cache: yarn
- name: Node.js version
id: node
Expand Down
5 changes: 1 addition & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
check-latest: true
cache: yarn

Expand Down Expand Up @@ -62,9 +62,6 @@ jobs:
- name: Lint built docs
run: yarn docs:lint:fix

- name: Set up Python
uses: actions/setup-python@v1

- name: Build docs
working-directory: docs
run: yarn && yarn build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
registry-url: "https://registry.npmjs.org"
check-latest: true
cache: yarn
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/publish-rc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,17 @@ jobs:
tag: ${{ steps.get_tag.outputs.tag }}
prev_tag: ${{ steps.get_prev_tag.outputs.prev_tag }}

binaries:
name: Build lodestar binaries
uses: ./.github/workflows/binaries.yml
needs: tag
with:
version: ${{ needs.tag.outputs.tag }}

npm:
name: Publish to NPM & Github
runs-on: buildjet-4vcpu-ubuntu-2204
needs: tag
needs: [tag, binaries]
if: needs.tag.outputs.is_rc == 'true'
steps:
- uses: actions/checkout@v4
Expand All @@ -54,17 +61,25 @@ jobs:

- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22

- name: Generate changelog
run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md

- name: Get binaries
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
fail_on_unmatched_files: true
tag_name: ${{ needs.tag.outputs.tag }}
body_path: "CHANGELOG.md"
name: Release ${{ needs.tag.outputs.tag }}
Expand Down
19 changes: 17 additions & 2 deletions .github/workflows/publish-stable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,17 @@ jobs:
tag: ${{ steps.get_tag.outputs.tag }}
prev_tag: ${{ steps.get_prev_tag.outputs.prev_tag }}

binaries:
name: Build lodestar binaries
uses: ./.github/workflows/binaries.yml
needs: tag
with:
version: ${{ needs.tag.outputs.tag }}

npm:
name: Publish to NPM & Github
runs-on: buildjet-4vcpu-ubuntu-2204
needs: tag
needs: [tag, binaries]
if: needs.tag.outputs.is_stable == 'true'
steps:
- uses: actions/checkout@v4
Expand All @@ -60,17 +67,25 @@ jobs:

- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22

- name: Generate changelog
run: node scripts/generate_changelog.mjs ${{ needs.tag.outputs.prev_tag }} ${{ needs.tag.outputs.tag }} CHANGELOG.md

- name: Get binaries
uses: actions/download-artifact@v4
with:
path: dist/
merge-multiple: true

- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: dist/*
fail_on_unmatched_files: true
tag_name: ${{ needs.tag.outputs.tag }}
body_path: "CHANGELOG.md"
name: Release ${{ needs.tag.outputs.tag }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-sim-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
node-version: 22
check-latest: true
cache: yarn
- name: Node.js version
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test-sim.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22

sim-test-multifork:
name: Multifork sim test
Expand All @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -100,7 +100,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down Expand Up @@ -158,7 +158,7 @@ jobs:
- uses: actions/checkout@v4
- uses: "./.github/actions/setup-and-build"
with:
node: 20
node: 22
- name: Load env variables
uses: ./.github/actions/dotenv
- name: Download required docker images before running tests
Expand Down
Loading

0 comments on commit 3766b37

Please sign in to comment.