Skip to content

Commit

Permalink
updates for CI for release (#90)
Browse files Browse the repository at this point in the history
* update ci for release

* update deploy script

* add deployment status

* use reqwest

* commit state file to framework/

* add networks var

* typo

* Update WASM binaries [skip ci]

---------

Co-authored-by: CircleCI <circleci@example.com>
Co-authored-by: cyberhoward <cyberhoward@protonmail.com>
  • Loading branch information
3 people committed Sep 26, 2023
1 parent 1dfcd93 commit a3bf251
Show file tree
Hide file tree
Showing 27 changed files with 165 additions and 59 deletions.
47 changes: 44 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,26 @@ workflows:
equal: [ "build_wasms", << pipeline.parameters.GHA_Meta >>]
jobs:
- build

modules-coverage:
when:
equal: [ "modules_coverage", << pipeline.parameters.GHA_Meta >>]
jobs:
- coverage
# Add this to give green CI when nothing is ran
# add this to give green ci when nothing is ran
pass:
jobs:
- pass

build-commit-deploy:
when:
equal: ["build_commit_deploy", << pipeline.parameters.GHA_Meta >>]
jobs:
- build
- deploy:
requires:
- build

jobs:
build:
docker:
Expand All @@ -52,13 +62,44 @@ jobs:
command: |
git config --global user.name 'CircleCI'
git config --global user.email 'circleci@example.com'
# Check for changes
git add framework/artifacts --force
git add modules/artifacts --force
git commit -m 'Update WASM artifacts [skip ci]'
git commit -m 'Update WASM binaries [skip ci]'
git push origin $CIRCLE_BRANCH
deploy:
docker:
- image: cimg/rust:1.72.0
resource_class: large
steps:
- checkout
- run:
name: Decode and Deploy
command: |
decoded_value=$(echo "$TEST_MNEMONIC_BASE64" | base64 --decode)
export TEST_MNEMONIC="$decoded_value"
cd framework
cargo run --bin full_deploy -- --network-ids $NETWORKS
- run:
name: Commit and push deploy file
command: |
git config --global user.name 'CircleCI'
git config --global user.email 'circleci@example.com'
git add framework/scripts --force
git commit -m 'Update deploy deploy file [skip ci]'
git push origin $CIRCLE_BRANCH
- run:
name: Commit and push state file
command: |
git config --global user.name 'CircleCI'
git config --global user.email 'circleci@example.com'
cp ~/.cw-orchestrator/state.json ./framework/scripts/
git add ./framework/scripts/state.json
git commit -m 'Update deploy deploy file [skip ci]'
git push origin $CIRCLE_BRANCH
coverage:
# https://circleci.com/developer/images?imageType=machine
docker:
- image: cimg/rust:1.72.0
resource_class: xlarge
Expand Down
25 changes: 25 additions & 0 deletions .github/workflows/manual-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Manual CircleCI Wasm Builder

# Job that updates the wasms of the mono-repo only if it is triggered manually.

on:
workflow_dispatch: # Trigger manually on any branch

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Tickle CircleCI
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
run: |
curl -X POST \
-H "Circle-Token: ${CCI_TOKEN}" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"branch": "${{ github.ref }}",
"parameters": {
"GHA_Meta": "build_wasms"
}
}' https://circleci.com/api/v2/project/gh/AbstractSDK/abstract/pipeline
38 changes: 10 additions & 28 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
name: release-deploy-publish

# Job that updates the wasms of the mono-repo after a PR is merged to main.
# Or if it is triggerd manually.
name: Release and Publish

on:
workflow_dispatch:
Expand All @@ -14,38 +11,23 @@ on:
jobs:
build:
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
if: startsWith(github.ref, 'refs/heads/release/') || github.event_name == 'workflow_dispatch'
steps:
- name: Tickle CircleCI
- name: Tickle CircleCI to Build Wasm Binaries
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
run: |
curl -X POST \
BRANCH_NAME=$(echo "${GITHUB_REF}" | sed -e "s/refs\/heads\///")
RESPONSE=$(curl -s -X POST \
-H "Circle-Token: ${CCI_TOKEN}" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"branch": "release",
"parameters": {
"GHA_Meta": "build_wasms"
}
}' https://circleci.com/api/v2/project/gh/AbstractSDK/abstract/pipeline
"branch": "'"$BRANCH_NAME"'",
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Tickle CircleCI for Deploy
env:
CCI_TOKEN: ${{ secrets.CCI_TOKEN }}
run: |
curl -X POST \
-H "Circle-Token: ${CCI_TOKEN}" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
-d '{
"branch": "release",
"parameters": {
"GHA_Meta": "deploy_all"
"GHA_Meta": "build_commit_deploy"
}
}' https://circleci.com/api/v2/project/gh/AbstractSDK/abstract/pipeline
}' https://circleci.com/api/v2/project/gh/AbstractSDK/abstract/pipeline)
echo "CircleCI Response: $RESPONSE"
Binary file modified framework/artifacts/abstract_ibc_client.wasm
Binary file not shown.
2 changes: 1 addition & 1 deletion framework/artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
f7750d3cdbcc88fd778ab52b8848a2c856341f6cc4f5e4e4c8bac1097a1a57d8 abstract_account_factory.wasm
6778124e0e686569e6bf32556ae453fa6f11612eac5f173c6500cd9f5db76330 abstract_ans_host.wasm
8e032c7dc22f20a55e31f243ee580126d539aec47a62384ddcb8c17cddd209bd abstract_ibc_client.wasm
68db689904f7ddf3e75275be127dfa3261acd96a67ebeb1abffcb4ba4d4e9e16 abstract_ibc_client.wasm
8f6d455aa2ffd7304a0f7a932b6a8743103c34487c5dc0afdd100ddbb9e5d6cc abstract_manager.wasm
563032c3b249142685f3e836ade62d17fa43f66f99eb0a9c2495843659a5ad50 abstract_module_factory.wasm
74a45fd1288266609450b46c548d02d2abf8458e4f88fd1591137b7c0c966409 abstract_proxy.wasm
Expand Down
2 changes: 1 addition & 1 deletion framework/artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
b37945c0f758e3b6b926e992dac882fce086d15fe6c12052bfb7bcf0bcbf1c25 target/wasm32-unknown-unknown/release/abstract_account_factory.wasm
9ac13adeac5142dbbfd592468913053c1f03e046915ca3528da224a52a3f30dc target/wasm32-unknown-unknown/release/abstract_ans_host.wasm
ee0eb7eeac5866ccbe7f22af364bdaaa926f1bc8353d0455d2f92fb9022bb08d target/wasm32-unknown-unknown/release/abstract_ibc_client.wasm
6d4938a798bf174df19cf0403a33e0b34cac39e9f806ce50c207bbc075c285bd target/wasm32-unknown-unknown/release/abstract_ibc_client.wasm
51c784d2fd94f7fbd469e11ca00fe4f797a1ae8e62579318257d498603122da0 target/wasm32-unknown-unknown/release/abstract_manager.wasm
904378992a46348b7ed0b7ec41873b5ad4435e64b9de4cb6f7647636a723c6a8 target/wasm32-unknown-unknown/release/abstract_module_factory.wasm
22c8f76ce751ad24588d5e272b74e6bc96d078a2a4d8ee0183572e7a8845f250 target/wasm32-unknown-unknown/release/abstract_proxy.wasm
Expand Down
55 changes: 53 additions & 2 deletions framework/scripts/src/bin/full_deploy.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
use reqwest::Url;
use std::{fs, net::TcpStream, path::Path};

use abstract_core::objects::gov_type::GovernanceDetails;
use abstract_interface::Abstract;

use abstract_interface_scripts::assert_wallet_balance;
use abstract_interface_scripts::{assert_wallet_balance, DeploymentStatus};
use clap::Parser;
use cw_orch::{
deploy::Deploy,
Expand All @@ -21,12 +24,34 @@ fn full_deploy(networks: Vec<ChainInfo>) -> anyhow::Result<()> {
let networks = rt.block_on(assert_wallet_balance(&networks));

for network in networks {
let urls = network.grpc_urls.to_vec();
for url in urls {
rt.block_on(ping_grpc(url))?;
}

let chain = DaemonBuilder::default()
.handle(rt.handle())
.chain(network.clone())
.build()?;

let sender = chain.sender();
let deployment = Abstract::deploy_on(chain, sender.to_string())?;

let mut deployment_status = DeploymentStatus {
chain_id: network.chain_id.to_string(),
success: false, // Default to false
};

let deployment = match Abstract::deploy_on(chain, sender.to_string()) {
Ok(deployment) => {
deployment_status.success = true;
write_deployment(&deployment_status)?;
deployment
}
Err(e) => {
write_deployment(&deployment_status)?;
return Err(e.into());
}
};

// Create the Abstract Account because it's needed for the fees for the dex module
deployment
Expand All @@ -38,6 +63,32 @@ fn full_deploy(networks: Vec<ChainInfo>) -> anyhow::Result<()> {
Ok(())
}

async fn ping_grpc(url_str: &str) -> anyhow::Result<()> {
let parsed_url = Url::parse(url_str)?;

let host = parsed_url
.host_str()
.ok_or_else(|| anyhow::anyhow!("No host in url"))?;

let port = parsed_url.port_or_known_default().ok_or_else(|| {
anyhow::anyhow!(
"No port in url, and no default for scheme {:?}",
parsed_url.scheme()
)
})?;
let socket_addr = format!("{}:{}", host, port);

let _ = TcpStream::connect(socket_addr);
Ok(())
}

fn write_deployment(status: &DeploymentStatus) -> anyhow::Result<()> {
let path = Path::new("scripts").join("deployments.json");
let status_str = serde_json::to_string_pretty(status)?;
fs::write(path, status_str)?;
Ok(())
}

#[derive(Parser, Default, Debug)]
#[command(author, version, about, long_about = None)]
struct Arguments {
Expand Down
7 changes: 7 additions & 0 deletions framework/scripts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use cw_orch::{
*,
},
};
use serde::{Deserialize, Serialize};

const GAS_TO_DEPLOY: u64 = 60_000_000;
pub const SUPPORTED_CHAINS: &[ChainInfo] =
Expand All @@ -21,6 +22,12 @@ pub const NEUTRON_1: ChainInfo = ChainInfo {
fcd_url: None,
};

#[derive(Debug, Serialize, Deserialize)]
pub struct DeploymentStatus {
pub chain_id: String,
pub success: bool,
}

pub async fn assert_wallet_balance<'a>(mut chains: &'a [ChainInfo<'a>]) -> &'a [ChainInfo<'a>] {
if chains.is_empty() {
chains = SUPPORTED_CHAINS;
Expand Down
Binary file modified modules/artifacts/abstract_challenge_app.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_cw_staking-juno.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_cw_staking-kujira.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_cw_staking-neutron.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_cw_staking-osmosis.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_cw_staking-terra.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_cw_staking.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dca_app.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dex_adapter-juno.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dex_adapter-kujira.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dex_adapter-neutron.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dex_adapter-osmosis.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dex_adapter-terra.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_dex_adapter.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_etf.wasm
Binary file not shown.
Binary file modified modules/artifacts/abstract_tendermint_staking_adapter.wasm
Binary file not shown.
34 changes: 17 additions & 17 deletions modules/artifacts/checksums.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
401b4df9f002a609983217c6264dae5c4c7ee87b4a13df8cb12d58576b824534 abstract_challenge_app.wasm
367ad8493655f2b16e515a49c608a3f50f1f3e3f86ae6b35e5327d3801e80248 abstract_cw_staking-juno.wasm
0a49878f978dc612486696d9b58dc6290803423ea613d00de6a60c48e37580ff abstract_cw_staking-kujira.wasm
e6ae0f7e3430aff3ca6b41423d07f46db28585e2bb0397e5b9e11f41e5b657f5 abstract_cw_staking-neutron.wasm
2055d31a8ce7c386c0eae535cab3d143e5c907d32c252a0e1a1c0b765c5f3c2b abstract_cw_staking-osmosis.wasm
8f2ba0342d3504198bafc0c41e6ef903febd93c0b3b6291f80d9d173386f35fb abstract_cw_staking-terra.wasm
e1ca400c4c7aa78baff1c5cd68050c6a458fcdafd524bde094f94ecd02fa0685 abstract_cw_staking.wasm
30f84f092f4790f3e8ff6909be3781a0a4b3e4cb4b484d133a52eb2cff459a28 abstract_dca_app.wasm
f4411ddd7e6db0ae2213da20dd8244586c5b662375e44740bf22d5c9e73afdaa abstract_dex_adapter-juno.wasm
13832726b6aeb1bdf05bfb035e5afef6a3aec352703d2a15069bb9146008547f abstract_dex_adapter-kujira.wasm
b2d71daac4b8984f839b0de34f47a559299d5764c4a7ee8f29f56cb4083a2afc abstract_dex_adapter-neutron.wasm
d1f772fe7877e8fe93af9e5f929cbed2ae7ee14a18538e00ba20f44c8953c37e abstract_dex_adapter-osmosis.wasm
4e9ecca1184f7a72b9da4e4f993887624d3ce1480298125f3488cc26f7c8b428 abstract_dex_adapter-terra.wasm
ed39dfd8f418c9d0dca83a09f33c1af3bef2fca847d492abfe32b7c396445f06 abstract_dex_adapter.wasm
5c1225279128a67ec0c39be6a23c1d7c76b0475de4874ed9517dd4d552edce7f abstract_etf.wasm
3dbbb0b8ec8363c87c3493074fd52b3e070a560e0943a9703e0089c39ee55328 abstract_tendermint_staking_adapter.wasm
c60b4f7f15d07952b189a9b802a17e0dfede6c7e656082921f0407a7ec40f1e1 croncat_app.wasm
354c35e2ffaa951c64c3801f00532680517b5520a9046159f778e4dc0e1480fa abstract_challenge_app.wasm
00d9945d659cb969d11f9cc350a2201c2ecde46e3263f6e4c9bd8492439fd9d9 abstract_cw_staking-juno.wasm
b2c22aefdab72ece234a32b154fefadb61669b0811c452c0364f19ebf6448a1a abstract_cw_staking-kujira.wasm
4160cf02d973117da571d8541faf634c2f94bc9197ddb440de8bb9b7372e0e15 abstract_cw_staking-neutron.wasm
5b4ff0134bddd603887f9aac3ab5039f140a6a438d3e5ffea4157a8278a4207a abstract_cw_staking-osmosis.wasm
9cf5d062af3bc49c713792e8cc544552ea6e35a35cbf47813cb0cfc5dc46792e abstract_cw_staking-terra.wasm
0c0d707c497c42443b0ca906af0a88d1e59ff2b54c1bade2646520fbc4de1ce5 abstract_cw_staking.wasm
ff0a1e009f275265f714bf43f596434bcddbabe3b8cd0e43329537b911a68d64 abstract_dca_app.wasm
8ee77a770017a54bbc3927cdce4cd4fc44f5828a626c829fe931dcc72ecc1d78 abstract_dex_adapter-juno.wasm
bfcc3c8c050db67cb96fb4cc4e2b6f09230b9a23059e648136463ff553380327 abstract_dex_adapter-kujira.wasm
61995f395aad8b5d078482cfc0ee960467b8a7892dc0b9eb53116d7172a7ea7f abstract_dex_adapter-neutron.wasm
c7086e516a9438eb69b021b02e9c409bd59a231935a5dd48be64a5ac9568ae54 abstract_dex_adapter-osmosis.wasm
e157b1f643cc736b4fc2507e7c0ff229d5eb793f3b720a3de69817d1a16a34d2 abstract_dex_adapter-terra.wasm
54ad8f9f1fe5406b28f43ca5adde7495e654d9ac00716af798c87f4da5775def abstract_dex_adapter.wasm
9c22c8179a45e23c3a87aa451c3fb09d471fac7920dc81a52db0c8187396a8bf abstract_etf.wasm
eddbd3a6096a00d2d7cc76af7ad3b71dc577fd7e86976f5a7c0a264e116e57a5 abstract_tendermint_staking_adapter.wasm
f5ae321588c4e8927de140c40ffbea5edc9de5bbc43b968b32163f760e34ba61 croncat_app.wasm
14 changes: 7 additions & 7 deletions modules/artifacts/checksums_intermediate.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
438b89472a32eb05b03fa82b0938ec749edb21a0b4697d20598767a2daec82d6 target/wasm32-unknown-unknown/release/abstract_challenge_app.wasm
7f0dbbf49c9dc5ac95736c4481e4b0062fc6e7a88da57ebc14fd2c2409d7abf2 target/wasm32-unknown-unknown/release/abstract_cw_staking.wasm
ad09ae00f3dcdfb6041515c0a49a144060c58f9feccbc52db7f237135beb1882 target/wasm32-unknown-unknown/release/abstract_dca_app.wasm
1453f7a354504e9e01a9c5b44ef49bd32de2277db5afffd70d48e99e9c81d1c6 target/wasm32-unknown-unknown/release/abstract_dex_adapter.wasm
7c14c237bf753096691b0ad6956cec3943d05b5b7880960ee39f6ced32d6f7f5 target/wasm32-unknown-unknown/release/abstract_etf.wasm
9329e07fb453dc812f0ac3ea3937caf076cc60f3dbb9e8314cc14bc1824cdc35 target/wasm32-unknown-unknown/release/abstract_tendermint_staking_adapter.wasm
178c904aa1ff737fe23610cb4ea45454eaac7845c096e4f43528420cf9d59c82 target/wasm32-unknown-unknown/release/croncat_app.wasm
5cf4de430e7e04df8e77d697454028fb6248182c47e2e5a2002d936f34900d6c target/wasm32-unknown-unknown/release/abstract_challenge_app.wasm
2e98d43c8be5449fa418b6e2b65294765dd8973a50d14cb3edc7ce4f9028b390 target/wasm32-unknown-unknown/release/abstract_cw_staking.wasm
b09a312fab29079401a7ce10b3012621dccdc464d7f7ac4b919ca1a3aa2be4eb target/wasm32-unknown-unknown/release/abstract_dca_app.wasm
57f5fabecd111773ce80a77040f1e9c448a1748e099e69567bf615db4228ba1c target/wasm32-unknown-unknown/release/abstract_dex_adapter.wasm
203b98ea9bc396136fab8f363a36dac9ff5f7c1709f78fd6ae5a54d858f5951b target/wasm32-unknown-unknown/release/abstract_etf.wasm
93c29495e3ddb34f77b37c74a8145aca968adabbd01e7f6d83440b64b1971720 target/wasm32-unknown-unknown/release/abstract_tendermint_staking_adapter.wasm
94183300730ee27df2e958a1b59f9215b57e04ec70fdfbc4c02b2ad9c98dab4f target/wasm32-unknown-unknown/release/croncat_app.wasm
Binary file modified modules/artifacts/croncat_app.wasm
Binary file not shown.

0 comments on commit a3bf251

Please sign in to comment.