Skip to content

Commit

Permalink
feat: jsonrpc ci test
Browse files Browse the repository at this point in the history
  • Loading branch information
Barber0 committed Feb 20, 2024
1 parent 849064d commit 56f8442
Show file tree
Hide file tree
Showing 7 changed files with 97 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .github/dockerfiles/aspect/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM simonalphafang/artela-client:0.0.1

RUN git clone https://github.com/artela-network/aspect-tooling.git
RUN /bin/bash -c "source ~/.nvm/nvm.sh && cd /aspect-tooling/packages/testcases && npm i && npm run contract:build"
RUN /bin/bash -c "source ~/.nvm/nvm.sh && cd /aspect-tooling/packages/testcases && sh build.sh || true"
20 changes: 20 additions & 0 deletions .github/dockerfiles/base/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu
WORKDIR /
RUN apt update && apt -y upgrade && apt -y install build-essential cmake libboost-all-dev curl git
RUN git clone https://github.com/artela-network/artela-web3.js.git

RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash

RUN /bin/bash -c "source ~/.nvm/nvm.sh && nvm install v16.17.0"
RUN /bin/bash -c "source ~/.nvm/nvm.sh && cd /artela-web3.js && npm i && npm run build"

RUN git clone https://github.com/artela-network/artela-solidity.git && sed -i '705s/if (Expression const\* value = _return.expression())/if (_return.expression())/g' /artela-solidity/libsolidity/codegen/ir/IRGeneratorForStatements.cpp
RUN cd /artela-solidity && cmake -B build . && make -j4 -C build && make -C build install

RUN SOLC_PATH=$(which solc) && ASOLC_PATH=$(echo $SOLC_PATH | sed "s/solc/asolc/g") && ln -s $SOLC_PATH $ASOLC_PATH



# RUN git clone https://github.com/artela-network/aspect-tooling.git
# RUN /bin/bash -c "source ~/.nvm/nvm.sh && cd /aspect-tooling/packages/testcases && npm i && npm run contract:build"
# RUN /bin/bash -c "source ~/.nvm/nvm.sh && cd /aspect-tooling/packages/testcases && sh build.sh || true"
4 changes: 4 additions & 0 deletions .github/dockerfiles/json-rpc/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
FROM simonalphafang/artela-client:0.0.1

RUN git clone -b feat-ci https://github.com/luketheart/test-scripts
RUN /bin/bash -c "source ~/.nvm/nvm.sh && cd /test-scripts/pre_public_testnet/json-rpc && npm i"
18 changes: 17 additions & 1 deletion .github/workflows/aspect-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,20 @@ jobs:
key_privateKey: "0x08a144f99aeae08b9582eef04c82f51528d6fc9ac0680ce4f967b872bbb3ab0e"
key_aspect_accounts: "0x7e026200e55f7fd162ba0bc8dbb8ae5e37c11ebf808c7981c4eba3aa6fe4c91c"

#
context-aspect:
uses: ./.github/workflows/reuseable-aspect-test.yaml
with:
test_node_addr: "http://47.254.27.97:8545"
test_script: "context-aspect.test.js"
key_attack_accounts: "0x6b8fdf2fe277f04f2b4b79695cac237e6bfcfa711f8d374404d4fbb1e8891865"
key_privateKey: ""
key_aspect_accounts: ""

context-key-check:
uses: ./.github/workflows/reuseable-aspect-test.yaml
with:
test_node_addr: "http://47.254.27.97:8545"
test_script: "context-key-check.test.js"
key_attack_accounts: "0x91f6dc1e7bd0d5c1b2810865825bfaa926062a5d0f8f608019efc051365b8c91"
key_privateKey: ""
key_aspect_accounts: ""
15 changes: 15 additions & 0 deletions .github/workflows/jsonrpc-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: JsonRPC Test

on:
push:
branches: [ ci_test ]
pull_request:
branches: [ ci_test ]

jobs:
jsonrpc-ci-call:
uses: ./.github/workflows/reuseable-jsonrpc-test.yaml
with:
test_node_addr: "http://47.254.27.97:8545"
test_script: "ci_call.cjs"
key_privateKey: "0x8778bb32408d744cfc2c9da02499783b65d0261895acb3e27e0b4f63c07f9329"
2 changes: 1 addition & 1 deletion .github/workflows/reuseable-aspect-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,4 +44,4 @@ jobs:
EOF
chmod +x test_scripts/init_env.sh
docker run --name testenv -v $(pwd)/test_scripts:/test_scripts -i simonalphafang/aspect-tooling:0.0.3 /bin/bash -c /test_scripts/init_env.sh
docker run --name testenv -v $(pwd)/test_scripts:/test_scripts -i simonalphafang/aspect-tooling:0.0.4 /bin/bash -c /test_scripts/init_env.sh
35 changes: 35 additions & 0 deletions .github/workflows/reuseable-jsonrpc-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Reusable JsonRPC Test

on:
workflow_call:
inputs:
test_node_addr:
required: true
type: string
test_script:
required: true
type: string
key_privateKey:
required: true
type: string

jobs:
test-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Aspect Test
run: |
mkdir -p ci_scripts
cat > ci_scripts/init_env.sh <<EOF
source ~/.nvm/nvm.sh
set -ex
cd /test-scripts/pre_public_testnet/json-rpc
sed -i "s|\"node\": \".*\"|\"node\": \"${{ inputs.test_node_addr }}\"|g" project.config.json && cat project.config.json
echo '${{ inputs.key_privateKey }}' > privateKey.txt
node ${{ inputs.test_script }}
EOF
chmod +x ci_scripts/init_env.sh
docker run --name testenv -v $(pwd)/ci_scripts:/ci_scripts -i simonalphafang/artela-jsonrpc-testenv:0.0.1 /bin/bash -c /ci_scripts/init_env.sh

0 comments on commit 56f8442

Please sign in to comment.