Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: integration test gh action #95

Merged
merged 13 commits into from
Oct 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
name: Linting

on:
- pull_request
on: pull_request

jobs:
lint:
Expand All @@ -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
Expand Down
36 changes: 18 additions & 18 deletions .github/workflows/publish-chains-config.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
40 changes: 21 additions & 19 deletions .github/workflows/test-chains-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
64 changes: 64 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -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
6 changes: 6 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@
"options": {
"tabWidth": 2
}
},
{
"files": "*.yaml",
"options": {
"tabWidth": 2
}
}
]
}
2 changes: 1 addition & 1 deletion evm/balances.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ if (require.main === module) {
.makeOptionMandatory(true)
.env('ENV'),
);
program.addOption(new Option('-n, --chainNames <chainNames>', 'chain names').makeOptionMandatory(true));
program.addOption(new Option('-n, --chainNames <chainNames>', 'chain names').makeOptionMandatory(true).env('CHAINS'));
program.addOption(new Option('-p, --privateKey <privateKey>', 'private key').makeOptionMandatory(true).env('PRIVATE_KEY'));

program.action((options) => {
Expand Down
2 changes: 1 addition & 1 deletion evm/deploy-contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ program.addOption(
);
program.addOption(new Option('-a, --artifactPath <artifactPath>', 'artifact path').makeOptionMandatory(true));
program.addOption(new Option('-c, --contractName <contractName>', 'contract name').makeOptionMandatory(true));
program.addOption(new Option('-n, --chainNames <chainNames>', 'chain names').makeOptionMandatory(true));
program.addOption(new Option('-n, --chainNames <chainNames>', 'chain names').makeOptionMandatory(true).env('CHAINS'));
program.addOption(new Option('--skipChains <skipChains>', 'chains to skip over'));
program.addOption(
new Option('-m, --deployMethod <deployMethod>', 'deployment method').choices(['create', 'create2', 'create3']).default('create2'),
Expand Down
2 changes: 1 addition & 1 deletion evm/gateway.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ program.addOption(
);
program.addOption(new Option('-c, --contractName <contractName>', 'contract name').default('Multisig'));
program.addOption(new Option('-a, --address <address>', 'override address'));
program.addOption(new Option('-n, --chainNames <chainNames>', 'chain names').makeOptionMandatory(true));
program.addOption(new Option('-n, --chainNames <chainNames>', 'chain names').makeOptionMandatory(true).env('CHAINS'));
program.addOption(new Option('--skipChains <skipChains>', 'chains to skip over'));
program.addOption(
new Option('--action <action>', 'gateway action')
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Loading