Skip to content
Open
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
40 changes: 40 additions & 0 deletions .github/workflows/ci-data-wasm-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: ci-data-wasm-node

on:
push:
branches:
- master
pull_request:


jobs:
npm-install-1:
strategy:
fail-fast: false
matrix:
net: ['testnet_v1']
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: prepare env
id: runtest
run: |
bash prepare_wasm_node.sh
npm install --save-dev mocha @types/mocha chai @types/chai
- name: run test
id: ci-test
run: |
npm run test-data

- name: Publish reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: jfoa-build-reports-${{ runner.os }}
path: mochawesome-report/
54 changes: 54 additions & 0 deletions .github/workflows/ckb-light-client-ci-wasm-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: ci-ckb-node-wasm

on:
workflow_dispatch:
push:
branches:
- master
pull_request:


jobs:
npm-install-1:
strategy:
fail-fast: false
matrix:
net: ['testnet_v1']
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-node@v3
with:
node-version: '16'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Node Cache
uses: actions/cache@v4
id: npm-and-yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: |
${{ steps.yarn-cache-dir-path.outputs.dir }}
~/.npm
key: ${{ runner.os }}-node_modules-${{ hashFiles('/home/runner/work/**/package-lock.json', '/home/runner/work/**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: prepare env
id: runtest
run: |
npm install --save-dev mocha @types/mocha chai @types/chai
bash prepare_wasm_node.sh
- name: run test
id: ci-test
run: |
npm run test-wasm

- name: Publish reports
if: failure()
uses: actions/upload-artifact@v4
with:
name: jfoa-build-reports-${{ runner.os }}
path: mochawesome-report/
1 change: 1 addition & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "ckb-light-wasm-demo"]
path = ckb-light-wasm-demo
url = https://github.com/gpBlockchain/ckb-light-wasm-demo.git
branch = gp/support-wasm-node
11 changes: 11 additions & 0 deletions prepare_wasm_node.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
set -x
git submodule init
git submodule update
cd ckb-light-wasm-demo
git log -1
git submodule init
git submodule update
cd ckb-light-client
git log -1
cd ../
bash build_node.sh
2 changes: 1 addition & 1 deletion test/get_header.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('get_header', function () {
let response = await lightClientRPC.getCells({
script:script,
scriptType:"lock"
}, "asc", "0xfff")
}, "asc", "0xff")

let block = await rpcCLient.getBlockByNumber(response.objects[0].blockNumber.toString())
if (block == undefined) {
Expand Down
2 changes: 1 addition & 1 deletion test/get_transactions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('get_transactions', function () {
let txs = await rpcCLient.getTransactions({
"script": test_scripts[0].script, "scriptType": test_scripts[0].scriptType,
"groupByTransaction": true
}, "asc", "0xfff")
}, "asc", "0xff")
console.log(txs.objects[0].blockNumber)
console.log(txs.objects[txs.objects.length - 1].blockNumber)
await lightClientRPC.setScripts([
Expand Down
36 changes: 36 additions & 0 deletions update_submodule.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash
set -e

if [ $# -lt 2 ]; then
echo "Usage: $0 <url> <branch>"
exit 1
fi

URL=$1
BRANCH=$2

echo "Updating submodule 'ckb-light-client' configuration..."
echo " URL: $URL"
echo " Branch: $BRANCH"

# Ensure we are in the script's directory
cd "$(dirname "$0")"

# Update .gitmodules
git config -f .gitmodules submodule.ckb-light-wasm-demo.url "$URL"
git config -f .gitmodules submodule.ckb-light-wasm-demo.branch "$BRANCH"

# Sync configuration to .git/config
git submodule sync ckb-light-wasm-demo

# Initialize and update the submodule
git submodule update --init --recursive --remote ckb-light-wasm-demo

# Checkout the specific branch
cd ckb-light-wasm-demo
git fetch origin
git checkout "$BRANCH"
git pull origin "$BRANCH"

echo "Submodule 'ckb-light-wasm-demo' updated successfully."

Loading