Skip to content

Commit

Permalink
chore(cli): apply new cli to documents and scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yangby-cryptape committed Sep 5, 2023
1 parent c4911e1 commit b89083f
Show file tree
Hide file tree
Showing 13 changed files with 66 additions and 26 deletions.
37 changes: 27 additions & 10 deletions .github/workflows/axon-start-with-short-genesis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,13 @@ jobs:
LOG_FILE: ${{ runner.temp }}/${{ matrix.os }}-single-axon-node.log
run: |
target/debug/axon --version | tee ${{ env.LOG_FILE }}
target/debug/axon run \
target/debug/axon init \
--config devtools/chain/config.toml \
--chain-spec devtools/chain/specs/single_node/chain-spec.toml \
| tee ${{ env.LOG_FILE }} &
| tee -a ${{ env.LOG_FILE }}
target/debug/axon run \
--config devtools/chain/config.toml \
| tee -a ${{ env.LOG_FILE }} &
sleep 10
Expand Down Expand Up @@ -85,22 +88,36 @@ jobs:
mkdir -p ${{ env.LOG_PATH }}
target/debug/axon --version
target/debug/axon run \
target/debug/axon init \
--config devtools/chain/nodes/node_1.toml \
--chain-spec devtools/chain/specs/multi_nodes_short_epoch_len/chain-spec.toml \
> ${{ env.LOG_PATH }}/node_1.log &
target/debug/axon run \
> ${{ env.LOG_PATH }}/node_1.log
target/debug/axon init \
--config devtools/chain/nodes/node_2.toml \
--chain-spec devtools/chain/specs/multi_nodes_short_epoch_len/chain-spec.toml \
> ${{ env.LOG_PATH }}/node_2.log &
target/debug/axon run \
> ${{ env.LOG_PATH }}/node_2.log
target/debug/axon init \
--config devtools/chain/nodes/node_3.toml \
--chain-spec devtools/chain/specs/multi_nodes_short_epoch_len/chain-spec.toml \
> ${{ env.LOG_PATH }}/node_3.log &
target/debug/axon run \
> ${{ env.LOG_PATH }}/node_3.log
target/debug/axon init \
--config devtools/chain/nodes/node_4.toml \
--chain-spec devtools/chain/specs/multi_nodes_short_epoch_len/chain-spec.toml \
> ${{ env.LOG_PATH }}/node_4.log &
> ${{ env.LOG_PATH }}/node_4.log
target/debug/axon run \
--config devtools/chain/nodes/node_1.toml \
>> ${{ env.LOG_PATH }}/node_1.log &
target/debug/axon run \
--config devtools/chain/nodes/node_2.toml \
>> ${{ env.LOG_PATH }}/node_2.log &
target/debug/axon run \
--config devtools/chain/nodes/node_3.toml \
>> ${{ env.LOG_PATH }}/node_3.log &
target/debug/axon run \
--config devtools/chain/nodes/node_4.toml \
>> ${{ env.LOG_PATH }}/node_4.log &
npx zx <<'EOF'
import { waitXBlocksPassed } from './devtools/ci/scripts/helper.js'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/openzeppelin_test_11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ jobs:
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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: Run prepare
id: runtest
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/openzeppelin_test_16_19.yml
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ jobs:
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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: Run prepare
id: runtest
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/openzeppelin_test_1_5_and_12_15.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ jobs:
key: ${{ runner.os }}-node_modules-${{ hashFiles('/home/runner/work/**/package-lock.json', '/home/runner/work/**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node_modules-
- name: Cache of the axon binary
uses: actions/cache@v3
with:
Expand All @@ -109,7 +109,8 @@ jobs:
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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: Run prepare
id: runtest
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/openzeppelin_test_6_10.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,12 @@ jobs:
target/debug/axon
target/release/axon
key: ${{ matrix.os }}-${{ runner.os }}-${{ runner.arch }}-axon-${{ github.sha }}

- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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: Run prepare
id: runtest
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/somking_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ jobs:
- name: Start axon
run: |
cd ${{ github.workspace }}/axon
./axon run --config ${{ github.workspace }}/axon/config.toml --chain-spec ${{ github.workspace }}/axon/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./axon init --config ${{ github.workspace }}/axon/config.toml --chain-spec ${{ github.workspace }}/axon/specs/single_node/chain-spec.toml > /tmp/log 2>&1
./axon run --config ${{ github.workspace }}/axon/config.toml >> /tmp/log 2>&1 &
sleep 120
- name: Check Axon Status
run: |
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/v3_core_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ jobs:
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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: Install dependencies
run: |
cd /home/runner/work/axon/axon/v3-core
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/web3_compatible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
os: [ubuntu-22.04]
fail-fast: false
runs-on: ${{ matrix.os }}
env:
env:
IS_DISPATCH: ${{ github.event_name == 'workflow_dispatch' }}
IS_REGRESSION: ${{ github.event.inputs.dispatch == 'regression' }}

Expand Down Expand Up @@ -66,10 +66,13 @@ jobs:
- name: Deploy Local Network of Axon
run: |
rm -rf ./devtools/chain/data
./target/debug/axon run \
./target/debug/axon init \
--config devtools/chain/config.toml \
--chain-spec devtools/chain/specs/single_node/chain-spec.toml \
> /tmp/log 2>&1 &
> /tmp/log 2>&1
./target/debug/axon run \
--config devtools/chain/config.toml \
>> /tmp/log 2>&1 &
- name: Checkout gpBlockchain/axon-test
uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ RUN set -eux; \
COPY --from=builder /build/target/release/axon /app/axon
COPY --from=builder /build/devtools /app/devtools

CMD ./axon run -c=/app/devtools/chain/config.toml -s=/app/devtools/chain/specs/single_node/chain-spec.toml
CMD /app/devtools/docker/docker-entrypoint.sh
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ e2e-test-lint:
e2e-test:
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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 &
cd tests/e2e && yarn
cd tests/e2e/src && yarn exec http-server &
cd tests/e2e && yarn exec wait-on -t 5000 tcp:8000 && yarn exec wait-on -t 5000 tcp:8080 && yarn test
Expand All @@ -73,7 +74,8 @@ e2e-test:
e2e-test-ci:
cargo build
rm -rf ./devtools/chain/data
./target/debug/axon run --config devtools/chain/config.toml --chain-spec devtools/chain/specs/single_node/chain-spec.toml > /tmp/log 2>&1 &
./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 &
cd tests/e2e && yarn
cd tests/e2e/src && yarn exec http-server &
cd tests/e2e && yarn exec wait-on -t 5000 tcp:8000 && yarn exec wait-on -t 5000 tcp:8080 && HEADLESS=true yarn test
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ Axon provides the compiled binary on the [release page](`https://github.com/axon
# Clone from GitHub
git clone https://github.com/axonweb3/axon.git && cd axon
# Run release binary for single node
cargo run --release -- run -c devtools/chain/config.toml -s devtools/chain/specs/single_node/chain-spec.toml
cargo run --release -- init -c devtools/chain/config.toml -s devtools/chain/specs/single_node/chain-spec.toml
cargo run --release -- run -c devtools/chain/config.toml

```

Expand Down
3 changes: 2 additions & 1 deletion devtools/chain/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ services:
- axon-net
restart: unless-stopped
command: |
/app/axon run --config=/app/config.toml --chain-spec=/app/single_node_spec/chain-spec.toml
/app/axon init --config=/app/config.toml --chain-spec=/app/single_node_spec/chain-spec.toml
/app/axon run --config=/app/config.toml
explorer:
container_name: blockscan
Expand Down
10 changes: 10 additions & 0 deletions devtools/docker/docker-entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh

DATA_DIR="/app/devtools/chain/data"
CONFIG_FILE="/app/devtools/chain/config.toml"
CHAIN_SPEC_FILE="/app/devtools/chain/specs/single_node/chain-spec.toml"

if [ ! -e "${DATA_DIR}" ]; then
/app/axon init -c=${CONFIG_FILE} -s=${CHAIN_SPEC_FILE}
fi
/app/axon run -c=${CONFIG_FILE}

0 comments on commit b89083f

Please sign in to comment.