Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
191 changes: 167 additions & 24 deletions .github/workflows/test-report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,29 +9,172 @@ permissions:
actions: read
checks: write
jobs:
test-fabric:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Run mocha tests and generate json report
run: |
set -e
mkdir -p reports
NODE_ENV=testing BDK_PATH=$(pwd)/test/bdk BDK_DOCKER_HOST_PATH=$(pwd)/test/bdk npx nyc --silent --temp-dir ./coverage/fabric/.nyc_output --report-dir ./coverage/fabric npx mocha --reporter json --require ts-node/register './test/fabric/**/*.test.ts' --exit > reports/fabric.json || echo '{}' > reports/fabric.json
echo 'Coverage summary:'
npx nyc report --temp-dir ./coverage/fabric/.nyc_output --report-dir ./coverage/fabric --reporter=text

- name: Upload Fabric JSON
uses: actions/upload-artifact@v4
with:
name: mocha-fabric
path: reports/fabric.json
retention-days: 1

- name: Show Fabric test
run: cat reports/fabric.json

test-besu:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Install solc 0.8.17
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl
pip3 install solc-select
solc-select install 0.8.17
solc-select use 0.8.17
solc --version

- name: Run mocha tests and generate json report
run: |
set -e
mkdir -p reports
echo '--- List test files ---'
ls -lR test/eth/besu || true
echo '--- Mocha version ---'
npx mocha --version || true
echo '--- Run Mocha with nyc and env ---'
NODE_ENV=testing BDK_PATH=$(pwd)/test/bdk BDK_DOCKER_HOST_PATH=$(pwd)/test/bdk npx nyc --silent --temp-dir ./coverage/besu/.nyc_output --report-dir ./coverage/besu npx mocha --reporter json --require ts-node/register './test/eth/besu/**/*.test.ts' --exit > reports/besu.json || echo '{}' > reports/besu.json
echo 'Coverage summary:'
npx nyc report --temp-dir ./coverage/besu/.nyc_output --report-dir ./coverage/besu --reporter=text

- name: Upload Besu JSON
uses: actions/upload-artifact@v4
with:
name: mocha-besu
path: reports/besu.json
retention-days: 1

- name: Show Besu test
run: cat reports/besu.json

test-quorum:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Install solc 0.8.17
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl
pip3 install solc-select
solc-select install 0.8.17
solc-select use 0.8.17
solc --version

- name: Run mocha tests and generate json report
run: |
set -e
mkdir -p reports
NODE_ENV=testing BDK_PATH=$(pwd)/test/bdk BDK_DOCKER_HOST_PATH=$(pwd)/test/bdk npx nyc --silent --temp-dir ./coverage/quorum/.nyc_output --report-dir ./coverage/quorum npx mocha --reporter json --require ts-node/register './test/eth/quorum/**/*.test.ts' --exit > reports/quorum.json || echo '{}' > reports/quorum.json
echo 'Coverage summary:'
npx nyc report --temp-dir ./coverage/quorum/.nyc_output --report-dir ./coverage/quorum --reporter=text

- name: Upload Quorum JSON
uses: actions/upload-artifact@v4
with:
name: mocha-quorum
path: reports/quorum.json
retention-days: 1

- name: Show Quorum test
run: cat reports/quorum.json

test-others:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: ./
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Run mocha tests and generate json report
run: |
set -e
mkdir -p reports
NODE_ENV=testing BDK_PATH=$(pwd)/test/bdk BDK_DOCKER_HOST_PATH=$(pwd)/test/bdk npx nyc --silent --temp-dir ./coverage/others/.nyc_output --report-dir ./coverage/others npx mocha --reporter json --require ts-node/register './test/{hello,wallet,bdk}/**/*.test.ts' --exit > reports/others.json || echo '{}' > reports/others.json
echo 'Coverage summary:'
npx nyc report --temp-dir ./coverage/others/.nyc_output --report-dir ./coverage/others --reporter=text

- name: Upload Others JSON
uses: actions/upload-artifact@v4
with:
name: mocha-others
path: reports/others.json
retention-days: 1

- name: Show Others test
run: cat reports/others.json

report:
runs-on: ubuntu-22.04 # ubuntu-latest | ubuntu-22.04
runs-on: ubuntu-22.04
needs: [test-fabric, test-besu, test-quorum, test-others]
if: success() || failure()

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console
- name: Install solc 0.8.17
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl
pip3 install solc-select
solc-select install 0.8.17
solc-select use 0.8.17
solc --version
- run: npm run test:json

- uses: dorny/test-reporter@v1
if: success() || failure()
with:
name: mocha-report # Name of the check run which will be created
path: 'test-*.json' # Path to test results (inside artifact .zip)
reporter: mocha-json # Format of test results
- uses: actions/checkout@v3

- uses: actions/download-artifact@v4
with:
pattern: mocha-*
path: reports/

- uses: dorny/test-reporter@v1
with:
name: mocha-report
path: 'reports/**/*.json'
reporter: mocha-json
159 changes: 155 additions & 4 deletions .github/workflows/unit-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ on:
branches: [ master ]

jobs:
unit-test:
runs-on: ubuntu-22.04 # ubuntu-latest | ubuntu-22.04
test-fabric:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
Expand All @@ -17,6 +17,7 @@ jobs:
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Install solc 0.8.17
run: |
sudo apt-get update
Expand All @@ -25,9 +26,159 @@ jobs:
solc-select install 0.8.17
solc-select use 0.8.17
solc --version
- run: npm run test:coverage

- uses: VeryGoodOpenSource/very_good_coverage@v2
- name: Run Fabric tests
run: npm run test:fabric

- name: Upload Fabric coverage
uses: actions/upload-artifact@v4
with:
name: coverage-fabric
path: ./coverage/fabric/lcov.info
retention-days: 1

- name: Upload Fabric JSON report
uses: actions/upload-artifact@v4
with:
name: mocha-fabric
path: ./reports/fabric.json
retention-days: 1

test-besu:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Install solc 0.8.17
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl
pip3 install solc-select
solc-select install 0.8.17
solc-select use 0.8.17
solc --version

- name: Run Besu tests
run: npm run test:besu

- name: Upload Besu coverage
uses: actions/upload-artifact@v4
with:
name: coverage-besu
path: ./coverage/besu/lcov.info
retention-days: 1

- name: Upload Besu JSON report
uses: actions/upload-artifact@v4
with:
name: mocha-besu
path: ./reports/besu.json
retention-days: 1

test-quorum:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Install solc 0.8.17
run: |
sudo apt-get update
sudo apt-get install -y python3 python3-pip curl
pip3 install solc-select
solc-select install 0.8.17
solc-select use 0.8.17
solc --version

- name: Run Quorum tests
run: npm run test:quorum

- name: Upload Quorum coverage
uses: actions/upload-artifact@v4
with:
name: coverage-quorum
path: ./coverage/quorum/lcov.info
retention-days: 1

- name: Upload Quorum JSON report
uses: actions/upload-artifact@v4
with:
name: mocha-quorum
path: ./reports/quorum.json
retention-days: 1

test-others:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci
- run: npm run build:console

- name: Run other tests
run: npm run test:others

- name: Upload Others coverage
uses: actions/upload-artifact@v4
with:
name: coverage-others
path: ./coverage/others/lcov.info
retention-days: 1

- name: Upload Others JSON report
uses: actions/upload-artifact@v4
with:
name: mocha-others
path: ./reports/others.json
retention-days: 1

coverage-check:
runs-on: ubuntu-22.04
needs: [test-fabric, test-besu, test-quorum, test-others]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
cache: 'npm'
- run: npm ci

- name: Install lcov
run: |
sudo apt-get update
sudo apt-get install -y lcov

- name: Download all coverage files
uses: actions/download-artifact@v4
with:
pattern: "coverage-*"
path: ./coverage/

- name: Merge coverage files
run: |
lcov -a ./coverage/coverage-fabric/lcov.info \
-a ./coverage/coverage-besu/lcov.info \
-a ./coverage/coverage-quorum/lcov.info \
-a ./coverage/coverage-others/lcov.info \
-o ./coverage/lcov.info
lcov --summary ./coverage/lcov.info

- name: Verify Coverage ≥ 70%
uses: VeryGoodOpenSource/very_good_coverage@v2
with:
path: './coverage/lcov.info'
min_coverage: 70
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,17 @@
這份文件將記錄 BDK 專案的變更日誌

All notable changes to BDK project will be documented here.
## [v3.4.1](https://github.com/cathayddt/bdk/releases/tag/v3.4.1) - 2025-11-21

### Fixes

* Fixed project safety warning
* Fixed remote `solc` compilation path issue and missing `get` command display
* Fixed quick setup for Besu chain to build a Quorum network

### Documentation

* Update EXAMPLE.md

## [v3.4.0](https://github.com/cathayddt/bdk/releases/tag/v3.4.0) - 2025-08-04

Expand Down
Loading
Loading