[cosmwasm] osmosis release (#767)

* update contract version

* update script to build for osmosis

* update pyth sdk cw version

* update release pipeline

* fix pipeline
This commit is contained in:
Dev Kalra 2023-04-17 18:25:09 +05:30 committed by GitHub
parent 6126db74fc
commit ec65d3ca81
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 50 additions and 22 deletions

View File

@ -26,6 +26,11 @@ jobs:
npm run build-contract -- --injective npm run build-contract -- --injective
mv ../artifacts ../injective mv ../artifacts ../injective
zip -r injective.zip ../injective zip -r injective.zip ../injective
- name: Build osmosis cosmwasm contract
run: |
npm run build-contract -- --osmosis
mv ../artifacts ../osmosis
zip -r osmosis.zip ../osmosis
- name: Set env - name: Set env
run: | run: |
@ -38,10 +43,12 @@ jobs:
files: | files: |
target_chains/cosmwasm/tools/cosmwasm.zip target_chains/cosmwasm/tools/cosmwasm.zip
target_chains/cosmwasm/tools/injective.zip target_chains/cosmwasm/tools/injective.zip
target_chains/cosmwasm/tools/osmosis.zip
body: | body: |
Contracts Contracts
- cosmwasm.zip contains the generic cosmwasm contract for most Cosmos SDK chains. - cosmwasm.zip contains the generic cosmwasm contract for most Cosmos SDK chains.
- injective.zip contains injectives specific contract. - injective.zip contains injective specific contract.
- osmosis.zip contains osmosis specific contract.
draft: false draft: false
# Setting VERSION in set env step and hence it will be available # Setting VERSION in set env step and hence it will be available
name: Pyth Cosmwasm Contract ${{ env.VERSION }} name: Pyth Cosmwasm Contract ${{ env.VERSION }}

View File

@ -1316,7 +1316,7 @@ dependencies = [
[[package]] [[package]]
name = "pyth-cosmwasm" name = "pyth-cosmwasm"
version = "1.1.0" version = "1.2.0"
dependencies = [ dependencies = [
"bigint", "bigint",
"byteorder", "byteorder",
@ -1369,7 +1369,7 @@ dependencies = [
[[package]] [[package]]
name = "pyth-sdk-cw" name = "pyth-sdk-cw"
version = "1.1.0" version = "1.2.0"
dependencies = [ dependencies = [
"cosmwasm-schema", "cosmwasm-schema",
"cosmwasm-std", "cosmwasm-std",
@ -1511,9 +1511,9 @@ dependencies = [
[[package]] [[package]]
name = "rustc-demangle" name = "rustc-demangle"
version = "0.1.22" version = "0.1.23"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d4a36c42d1873f9a77c53bde094f9664d9891bc604a45b4798fd2c389ed12e5b" checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76"
[[package]] [[package]]
name = "rustc-hash" name = "rustc-hash"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "pyth-cosmwasm" name = "pyth-cosmwasm"
version = "1.1.0" version = "1.2.0"
authors = ["Wormhole Contributors <contact@certus.one>"] authors = ["Wormhole Contributors <contact@certus.one>"]
edition = "2018" edition = "2018"
description = "Pyth price receiver" description = "Pyth price receiver"

View File

@ -1,6 +1,6 @@
[package] [package]
name = "pyth-sdk-cw" name = "pyth-sdk-cw"
version = "1.1.0" version = "1.2.0"
authors = ["Pyth Data Foundation"] authors = ["Pyth Data Foundation"]
edition = "2018" edition = "2018"
license = "Apache-2.0" license = "Apache-2.0"

View File

@ -12,20 +12,26 @@ const argv = yargs(hideBin(process.argv))
.option("injective", { .option("injective", {
type: "boolean", type: "boolean",
}) })
.option("osmosis", {
type: "boolean",
})
.option("arm64", {
type: "boolean",
})
.help() .help()
.alias("help", "h") .alias("help", "h")
.wrap(yargs.terminalWidth()) .wrap(yargs.terminalWidth())
.parseSync(); .parseSync();
// we need to update the toml file to have a feature on - default=['injective'] // we need to update the toml file to have a feature on - default=[feature (passed as parameter)]
// editing and writing the toml file before building the contract for injective // editing and writing the toml file before building the contract for other than cosmwasm
function injectivePreSetup(contractTomlFilePath: string) { function cargoPreSetup(contractTomlFilePath: string, feature: string) {
const originalTomlContentStr = readFileSync(contractTomlFilePath, "utf-8"); const originalTomlContentStr = readFileSync(contractTomlFilePath, "utf-8");
const parsedToml = toml.parse(originalTomlContentStr); const parsedToml = toml.parse(originalTomlContentStr);
// add injective feature to the cargo.toml // add default feature to the cargo.toml
// @ts-ignore // @ts-ignore
parsedToml.features.default = ["injective"]; parsedToml.features.default = [feature];
// @ts-ignore // @ts-ignore
const updatedToml = toml.stringify(parsedToml, { const updatedToml = toml.stringify(parsedToml, {
@ -40,29 +46,44 @@ function injectivePreSetup(contractTomlFilePath: string) {
writeFileSync(contractTomlFilePath, updatedToml); writeFileSync(contractTomlFilePath, updatedToml);
// after contract compilation we need to reset the original content of the toml file // after contract compilation we need to reset the original content of the toml file
return function injectivePostCleanup() { return function cargoPostCleanup() {
writeFileSync(contractTomlFilePath, originalTomlContentStr); writeFileSync(contractTomlFilePath, originalTomlContentStr);
}; };
} }
function build() { function build() {
if (argv.cosmwasm !== true && argv.injective !== true) {
console.log("Please provide one of the options: ['cosmwasm', 'injective']");
return;
}
const contractTomlFilePath = "../contracts/pyth/Cargo.toml"; const contractTomlFilePath = "../contracts/pyth/Cargo.toml";
let cleanup = () => {}; let cleanup = () => {};
if (argv.injective === true) if (argv.cosmwasm !== true) {
cleanup = injectivePreSetup(contractTomlFilePath); const feature =
argv.osmosis === true
? "osmosis"
: argv.injective === true
? "injective"
: undefined;
if (feature === undefined) {
console.log(
"Please provide one of the options: ['cosmwasm', 'injective', 'osmosis']"
);
return;
}
cleanup = cargoPreSetup(contractTomlFilePath, feature);
}
const dockerImage =
argv.arm64 === true
? "cosmwasm/workspace-optimizer-arm64:0.12.11"
: "cosmwasm/workspace-optimizer:0.12.11";
const buildCommand = ` const buildCommand = `
docker run --rm -v "$(cd ..; pwd)":/code \ docker run --rm -v "$(cd ..; pwd)":/code \
-v $(cd ../../../wormhole_attester; pwd):/wormhole_attester \ -v "$(cd ../../../wormhole_attester; pwd)":/wormhole_attester \
--mount type=volume,source="$(basename "$(cd ..; pwd)")_cache",target=/code/target \ --mount type=volume,source="$(basename "$(cd ..; pwd)")_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/workspace-optimizer:0.12.11 ${dockerImage}
`; `;
// build contract by running the command // build contract by running the command