From fab22e8ab7b60edbf34b163264c074c1c3069d2a Mon Sep 17 00:00:00 2001 From: liyukun Date: Mon, 30 Oct 2023 14:30:14 +0800 Subject: [PATCH] chore: trigger while push request --- .github/workflows/ibc-packet-trigger.yaml | 66 ++++++++++++----------- 1 file changed, 35 insertions(+), 31 deletions(-) diff --git a/.github/workflows/ibc-packet-trigger.yaml b/.github/workflows/ibc-packet-trigger.yaml index 0a512fd03..ea5621552 100644 --- a/.github/workflows/ibc-packet-trigger.yaml +++ b/.github/workflows/ibc-packet-trigger.yaml @@ -4,6 +4,14 @@ on: workflow_dispatch: schedule: - cron: '0 */2 * * *' # runs every 2 hour + pull_request: + paths: + - .github/workflows/ibc-packet-trigger.yaml + - Cargo.toml + - Cargo.lock + - ci/** + - crates/** + - e2e/** jobs: schedule-run-packet-send: @@ -11,29 +19,36 @@ jobs: env: # for forcerelay-ckb-sdk FORCERELAY_CKB_SDK_COMMIT: f02969f920fa48234959fd25c771992a85619eb6 - AXON_RECEIVER: f39fd6e51aad88f6f4ce6ab8827279cfffb92266 + AXON_RECEIVER: "f39fd6e51aad88f6f4ce6ab8827279cfffb92266" SUDT_AMOUNT: 1000 SDK_WORKSPACE: ${{ github.workspace }}/forcerelay-ckb-sdk SDK_CONFIG: ${{ github.workspace }}/e2e/schedule/sdk.config.toml + SUDT_TRANSFER_PRIVATE_KEY: 63d86723e08f0f813a36ce6aa123bb2289d90680ae1e99d4de8cdb334553f24d # for ibc-solidity-contract AXON_HTTP_RPC_URL: https://rpc-alphanet-axon.ckbapp.dev IBC_SOLIDITY_CONTRACT_COMMIT: e0d1f4bf20c40aad721bff5838d8a3fa80c94585 CONTRACT_WORKSPACE: ${{ github.workspace }}/ibc-solidity-contract - RECEIVER: 0xc219351b150b900e50a7039f1e448b844110927e - TRANSFER_CONTRACT_ADDRESS: 0x9E545E3C0baAB3E08CdfD552C960A1050f373042 + RECEIVER: "0xc219351b150b900e50a7039f1e448b844110927e" + TRANSFER_CONTRACT_ADDRESS: "0x9E545E3C0baAB3E08CdfD552C960A1050f373042" CHANNEL: channel-8 DENOM: f2a14f50a56b9aab8e960cb1b2c7f1152d7523e6cacb45b1ab2a94acb83e0233 - AMOUNT: 1000 + AMOUNT: 990 # 1. firstly, run ibc-solidity-contract script to send SendPacket to Axon and then, trigger RecvPacket process via forcerleay-ckb-sdk # 2. secondly, directly run forcerelay-ckb-sdk to send SendPacket to CKB, and then, it'll automatically listen AckPacket steps: - name: Prepare start-time for ibc-solidity-contract uses: actions/github-script@v6 - id: solidity-start-time + id: start-time with: script: return Date.now() result-encoding: string + - uses: actions/checkout@v3 + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Set Node.js 16.x uses: actions/setup-node@v3 with: @@ -42,42 +57,31 @@ jobs: - name: Install yarn run: npm install --global yarn - - name: Prepare IBC contracts + - name: Prepare IBC solidity contracts run: git clone --recursive https://github.com/synapseweb3/ibc-solidity-contract.git $CONTRACT_WORKSPACE && cd $CONTRACT_WORKSPACE && git checkout $IBC_SOLIDITY_CONTRACT_COMMIT - - name: Print schedule start-time of ibc-solidity-contract - run: echo "${{ steps.solidity-start-time.outputs.result }}" - - - name: 1. Trigger SendPacket event on Axon (ERC20) - run: yarn send - - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true + - name: Build and compile IBC solidity contracts + working-directory: ${{ env.CONTRACT_WORKSPACE }} + run: yarn install && yarn compile - name: Download forcerelay-ckb-sdk run: git clone --recursive https://github.com/synapseweb3/forcerelay-ckb-sdk.git $SDK_WORKSPACE && cd $SDK_WORKSPACE && git checkout $FORCERELAY_CKB_SDK_COMMIT - - name: Build forcerelay-ckb-sdk example (sudt-transfer) + - name: Install forcerelay-ckb-sdk example (sudt-transfer) uses: actions-rs/cargo@v1 with: - command: build - args: --example sudt-transfer --manifest-path ${{ env.SDK_WORKSPACE }}/Cargo.toml + command: install + args: --path ${{ env.SDK_WORKSPACE }} --example sudt-transfer - - name: 2. Listen RecvPacket event on CKB - run: $SDK_WORKSPACE/target/debug/example/sudt-transfer --config $SDK_CONFIG recv + - name: Print schedule start-time + run: echo "${{ steps.start-time.outputs.result }}" - - name: Prepare start-time for ibc-solidity-contract - uses: actions/github-script@v6 - id: sdk-start-time - with: - script: return Date.now() - result-encoding: string + - name: 1. Trigger SendPacket event on Axon (ERC20) + working-directory: ${{ env.CONTRACT_WORKSPACE }} + run: yarn send - - name: Print schedule start-time of forcerelay-ckb-sdk - run: echo "${{ steps.sdk-start-time.outputs.result }}" + - name: 2. Listen RecvPacket event on CKB + run: sudt-transfer --config $SDK_CONFIG recv - name: 3. Trigger SendPacket on CKB (sUDT) - run: $SDK_WORKSPACE/target/debug/example/sudt-transfer --config $SDK_CONFIG send --receiver &AXON_RECEIVER --amount $SUDT_AMOUNT --sudt yukun_li + run: sudt-transfer --config $SDK_CONFIG send --receiver $AXON_RECEIVER --amount $SUDT_AMOUNT --sudt yukun_li