Skip to content

fix: rlp encode and decode of Proposal struct (#1485) #1166

fix: rlp encode and decode of Proposal struct (#1485)

fix: rlp encode and decode of Proposal struct (#1485) #1166

Workflow file for this run

name: v3 Core Tests
on:
push:
branches:
- main
workflow_dispatch:
inputs:
dispatch:
type: string
description: "Dispatch contains pr context that want to trigger V3 core test"
required: true
jobs:
v3-core-test:
strategy:
matrix:
# Supported GitHub-hosted runners and hardware resources
# see https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
outputs:
output-sha: ${{ steps.escape_multiple_lines_test_inputs.outputs.result }}
steps:
- name: Generate axon-bot token
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
id: generate_axon_bot_token
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.AXON_BOT_APP_ID }}
private_key: ${{ secrets.AXON_BOT_PRIVATE_KEY }}
- name: Event is dispatch
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
uses: actions/github-script@v6
id: get_sha
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
script: |
const dispatch = JSON.parse(`${{ github.event.inputs.dispatch }}`);
const pr = (
await github.rest.pulls.get({
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
pull_number: dispatch.issue.number,
})
).data.head;
github.rest.repos.createCommitStatus({
state: 'pending',
owner: dispatch.repo.owner,
repo: dispatch.repo.repo,
context: '${{ github.workflow }}',
sha: pr.sha,
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})
return pr.sha
- name: Escape multiple lines test inputs
if: contains(github.event_name, 'workflow_dispatch') &&
github.repository_owner == 'axonweb3' && github.event.inputs.dispatch != 'regression'
id: escape_multiple_lines_test_inputs
run: |
inputs=${{ steps.get_sha.outputs.result}}
inputs="${inputs//'%'/'%25'}"
inputs="${inputs//'\n'/'%0A'}"
inputs="${inputs//'\r'/'%0D'}"
echo "result=$inputs" >> $GITHUB_OUTPUT
- name: Git checkout
uses: actions/checkout@v4
with:
ref: ${{ steps.escape_multiple_lines_test_inputs.outputs.result || 'main' }}
- uses: actions/checkout@v4
with:
repository: gpBlockchain/v3-core
path: v3-core
- uses: actions/setup-node@v3
with:
node-version: 20.x
- id: yarn-cache
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Cache of Cargo
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-cargo-build
- name: Build Axon in the development profile
run: cargo build
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon init \
--config devtools/chain/config.toml \
--chain-spec devtools/chain/specs/single_node/chain-spec.toml \
> /tmp/log 2>&1
./target/debug/axon run \
--config devtools/chain/config.toml \
>> /tmp/log 2>&1 &
- name: Check Axon Status Before Test
run: |
MAX_RETRIES=10
for i in $(seq 1 $MAX_RETRIES); do
sleep 10
response=$(curl -s -w "\n%{http_code}" http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"web3_clientVersion","params": [],"id":1}')
http_code=$(echo "$response" | tail -n1)
response_body=$(echo "$response" | sed '$d')
if [[ "$http_code" -eq 200 ]]; then
echo "$response_body"
exit 0
else
echo "Axon status check failed with HTTP status code: $http_code, retrying ($i/$MAX_RETRIES)"
if [[ "$i" -eq $MAX_RETRIES ]]; then
echo "Axon status check failed after $MAX_RETRIES attempts."
exit 1
fi
fi
done
- name: Install dependencies
run: |
cd /home/runner/work/axon/axon/v3-core
yarn install
# This is required separately from yarn test because it generates the typechain definitions
- name: Compile
run: |
cd /home/runner/work/axon/axon/v3-core
yarn compile
- name: Run tests 0
if: success() || failure()
id: runtest
run: |
cd /home/runner/work/axon/axon/v3-core
yarn test:prepare
yarn test:runAll0
- name: Run test 1
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/v3-core
yarn test:runAll1
- name: Run test 2
if: success() || failure()
run: |
cd /home/runner/work/axon/axon/v3-core
yarn test:runAll2
- name: Check Axon Status
if: success() || failure()
run: |
curl http://localhost:8000 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params": [],"id":1}'
- name: Publish reports
if: always()
uses: actions/upload-artifact@v3
with:
name: jfoa-build-reports-${{ runner.os }}
path: v3-core/mochawesome-report/
finally:
name: Finally
needs: [ v3-core-test ]
if: always() && contains(github.event_name, 'workflow_dispatch') &&
github.event.inputs.dispatch != 'regression' && github.repository_owner == 'axonweb3'
runs-on: ubuntu-latest
steps:
- name: Generate axon-bot token
id: generate_axon_bot_token
uses: wow-actions/use-app-token@v2
with:
app_id: ${{ secrets.AXON_BOT_APP_ID }}
private_key: ${{ secrets.AXON_BOT_PRIVATE_KEY }}
- if: contains(join(needs.*.result, ';'), 'failure') || contains(join(needs.*.result, ';'), 'cancelled')
run: exit 1
- uses: actions/github-script@v6
if: ${{ always() }}
with:
github-token: ${{ steps.generate_axon_bot_token.outputs.BOT_TOKEN }}
script: |
github.rest.repos.createCommitStatus({
state: '${{ job.status }}',
owner: context.repo.owner,
repo: context.repo.repo,
context: '${{ github.workflow }}',
sha: '${{ needs.v3-core-test.outputs.output-sha }}',
target_url: 'https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}'
})