diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 3b700a32..8ceb6a8e 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -1,7 +1,6 @@ name: Linting -on: - - pull_request +on: pull_request jobs: lint: @@ -13,7 +12,7 @@ jobs: - ubuntu-latest runs-on: ${{ matrix.os }} steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install Node.js uses: actions/setup-node@v3 diff --git a/.github/workflows/publish-chains-config.yaml b/.github/workflows/publish-chains-config.yaml index 962fb44f..4613ab6a 100644 --- a/.github/workflows/publish-chains-config.yaml +++ b/.github/workflows/publish-chains-config.yaml @@ -1,23 +1,23 @@ name: 'Publish Axelar Chains Config to NPM' on: - workflow_dispatch: + workflow_dispatch: jobs: - publish-to-npm: - name: 'Publish to NPM' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: '18.x' - registry-url: 'https://registry.npmjs.org' - - run: npm ci - working-directory: ./axelar-chains-config - - run: npm run build - working-directory: ./axelar-chains-config - - run: npm publish - working-directory: ./axelar-chains-config - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + publish-to-npm: + name: 'Publish to NPM' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v3 + with: + node-version: '18.x' + registry-url: 'https://registry.npmjs.org' + - run: npm ci + working-directory: ./axelar-chains-config + - run: npm run build + working-directory: ./axelar-chains-config + - run: npm publish + working-directory: ./axelar-chains-config + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} diff --git a/.github/workflows/test-chains-config.yaml b/.github/workflows/test-chains-config.yaml index 7853f41b..5957734b 100644 --- a/.github/workflows/test-chains-config.yaml +++ b/.github/workflows/test-chains-config.yaml @@ -3,25 +3,27 @@ name: Run Axelar Chains Config Tests on: pull_request jobs: - test: - runs-on: ${{ matrix.os }} - strategy: - matrix: - os: [ubuntu-22.04] - arch: [amd64] - steps: - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version: 18 + test: + strategy: + matrix: + node-version: + - 18.x + os: + - ubuntu-latest + runs-on: ${{ matrix.os }} + steps: + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} - - name: Checkout code - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v4 - - name: Install - run: npm ci - working-directory: axelar-chains-config + - name: Install + run: npm ci + working-directory: axelar-chains-config - - name: Test - run: npm run test - working-directory: axelar-chains-config + - name: Test + run: npm run test + working-directory: axelar-chains-config diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 00000000..676f7896 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,64 @@ +name: Test + +on: pull_request + +jobs: + test: + strategy: + matrix: + node-version: + - 18.x + os: + - ubuntu-latest + runs-on: ${{ matrix.os }} + steps: + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install + run: npm ci + + - name: Spin up Hardhat Network + run: npx hardhat node & + + - name: Prepare local.json + run: | + echo '{ + "chains": { + "test": { + "name": "Test", + "id": "test", + "chainId": 31337, + "rpc": "http://127.0.0.1:8545", + "tokenSymbol": "TEST", + "contracts": {} + } + } + }' > ./axelar-chains-config/info/local.json + + # Create .env file with default hardhat private key that's prefunded + - name: Prepare .env + run: | + echo 'PRIVATE_KEY=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' >> .env + echo 'ENV=local' >> .env + echo 'CHAINS=test' >> .env + + - name: Display local.json + run: cat ./axelar-chains-config/info/local.json + + - name: Deploy ConstAddressDeployer + run: node evm/deploy-contract.js -a ../node_modules/@axelar-network/axelar-gmp-sdk-solidity/artifacts/contracts/deploy/ -c ConstAddressDeployer -m create -y + + - name: Deploy Create3Deployer + run: node evm/deploy-contract.js -a ../node_modules/@axelar-network/axelar-gmp-sdk-solidity/artifacts/contracts/deploy/ -c Create3Deployer -m create2 -y + + - name: Deploy AxelarGateway + run: node evm/deploy-gateway-v6.2.x.js -m create3 -s "AxelarGateway v6.2" -g 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -m 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --keyID 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 -y + + - name: Call Method on Gateway + run: node evm/gateway.js --action callContract --destinationChain test2 -y diff --git a/.prettierrc b/.prettierrc index a775ca18..a2194d80 100644 --- a/.prettierrc +++ b/.prettierrc @@ -22,6 +22,12 @@ "options": { "tabWidth": 2 } + }, + { + "files": "*.yaml", + "options": { + "tabWidth": 2 + } } ] } diff --git a/evm/balances.js b/evm/balances.js index 0728fe0a..c02b0ce9 100644 --- a/evm/balances.js +++ b/evm/balances.js @@ -33,7 +33,7 @@ if (require.main === module) { .makeOptionMandatory(true) .env('ENV'), ); - program.addOption(new Option('-n, --chainNames ', 'chain names').makeOptionMandatory(true)); + program.addOption(new Option('-n, --chainNames ', 'chain names').makeOptionMandatory(true).env('CHAINS')); program.addOption(new Option('-p, --privateKey ', 'private key').makeOptionMandatory(true).env('PRIVATE_KEY')); program.action((options) => { diff --git a/evm/deploy-contract.js b/evm/deploy-contract.js index 993974b5..d03c77b7 100644 --- a/evm/deploy-contract.js +++ b/evm/deploy-contract.js @@ -349,7 +349,7 @@ program.addOption( ); program.addOption(new Option('-a, --artifactPath ', 'artifact path').makeOptionMandatory(true)); program.addOption(new Option('-c, --contractName ', 'contract name').makeOptionMandatory(true)); -program.addOption(new Option('-n, --chainNames ', 'chain names').makeOptionMandatory(true)); +program.addOption(new Option('-n, --chainNames ', 'chain names').makeOptionMandatory(true).env('CHAINS')); program.addOption(new Option('--skipChains ', 'chains to skip over')); program.addOption( new Option('-m, --deployMethod ', 'deployment method').choices(['create', 'create2', 'create3']).default('create2'), diff --git a/evm/gateway.js b/evm/gateway.js index edac25c4..ec4a68f8 100644 --- a/evm/gateway.js +++ b/evm/gateway.js @@ -339,7 +339,7 @@ program.addOption( ); program.addOption(new Option('-c, --contractName ', 'contract name').default('Multisig')); program.addOption(new Option('-a, --address
', 'override address')); -program.addOption(new Option('-n, --chainNames ', 'chain names').makeOptionMandatory(true)); +program.addOption(new Option('-n, --chainNames ', 'chain names').makeOptionMandatory(true).env('CHAINS')); program.addOption(new Option('--skipChains ', 'chains to skip over')); program.addOption( new Option('--action ', 'gateway action') diff --git a/package.json b/package.json index ae82c3c9..8aecd090 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "scripts": { "lint": "eslint '**/*.js'", - "prettier": "prettier --write '**/*.js' 'axelar-chains-config/info/*.json' 'package.json' 'evm/**/*.json'" + "prettier": "prettier --write '**/*.js' 'axelar-chains-config/info/*.json' 'package.json' 'evm/**/*.json' '.github/**/*.yaml'" }, "repository": { "type": "git",