Skip to content

Commit

Permalink
chore: reuse workflow from axelar-cgp-sui
Browse files Browse the repository at this point in the history
  • Loading branch information
npty committed Sep 5, 2024
1 parent 4e472c5 commit 27a81e7
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 35 deletions.
26 changes: 8 additions & 18 deletions .github/actions/setup-sui/action.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Setup Sui CLI
description: 'Setup Sui CLI and install dependencies'

inputs:
SUI_VERSION:
description: 'The version of Sui CLI to install'
required: true

runs:
using: 'composite'

steps:
- name: Get Sui Version
shell: bash
run: |
SUI_VERSION=$(jq -r '.SUI_VERSION' sui/version.json)
echo "SUI_VERSION=$SUI_VERSION" >> $GITHUB_ENV
- name: Debug Action Input
shell: bash
run: echo "SUI_VERSION=${{ inputs.SUI_VERSION }}"
Expand All @@ -25,7 +26,7 @@ runs:
uses: actions/cache@v4
with:
path: sui-cli/sui-binaries/
key: sui-${{ inputs.SUI_VERSION }}
key: sui-${{ env.SUI_VERSION }}

- name: Download and Install Sui
shell: bash
Expand All @@ -45,21 +46,10 @@ runs:
uses: actions/cache@v4
with:
path: sui-cli/sui-binaries/
key: sui-${{ inputs.SUI_VERSION }}
key: sui-${{ env.SUI_VERSION }}

- name: Add Sui binaries to PATH
shell: bash
run: |
sudo cp ./sui-cli/sui-binaries/sui /usr/local/bin/sui
sudo cp ./sui-cli/sui-binaries/sui-debug /usr/local/bin/sui-debug
- name: Setup Sui Wallet
shell: bash
run: |
echo -e "y\n\n1" | sui client envs
sui client new-address secp256k1 wallet
sui client switch --address wallet
SUI_PRIVATE_KEY=$(sui keytool export --key-identity wallet --json | jq .exportedPrivateKey | sed 's/"//g')
SUI_ADDRESS=$(sui keytool export --key-identity wallet --json | jq .key.suiAddress | sed 's/"//g')
echo "SUI_PRIVATE_KEY=${SUI_PRIVATE_KEY}" >> $GITHUB_ENV
echo "SUI_ADDRESS=${SUI_ADDRESS}" >> $GITHUB_ENV
28 changes: 11 additions & 17 deletions .github/workflows/test-sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,25 +35,19 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: useblacksmith/setup-node@v5
with:
node-version: 18.x
cache: 'npm'

- name: Install
run: npm ci
- name: Setup Sui CLI and install dependencies
uses: axelarnetwork/axelar-cgp-sui/.github/actions/install/[email protected]

- name: Read SUI_VERSION from JSON
id: read-json
- name: Setup Sui Wallet
shell: bash
run: |
SUI_VERSION=$(jq -r '.SUI_VERSION' sui/version.json)
echo "SUI_VERSION=${SUI_VERSION}" >> $GITHUB_ENV
- name: Setup Sui CLI and install dependencies
uses: ./.github/actions/setup-sui
with:
SUI_VERSION: ${{ env.SUI_VERSION }}
echo -e "y\n\n1" | sui client envs
sui client new-address secp256k1 wallet
sui client switch --address wallet
SUI_PRIVATE_KEY=$(sui keytool export --key-identity wallet --json | jq .exportedPrivateKey | sed 's/"//g')
SUI_ADDRESS=$(sui keytool export --key-identity wallet --json | jq .key.suiAddress | sed 's/"//g')
echo "SUI_PRIVATE_KEY=${SUI_PRIVATE_KEY}" >> $GITHUB_ENV
echo "SUI_ADDRESS=${SUI_ADDRESS}" >> $GITHUB_ENV
- name: Spin up Sui Network
# sui-test-validator will be deprecated in the future.
Expand Down

0 comments on commit 27a81e7

Please sign in to comment.