From 27307751592b3311256d9ee95b1250ee457980c0 Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Thu, 7 Mar 2024 23:23:02 +0100 Subject: [PATCH 1/2] ci(release): use cw optimizer to build wasm assets --- .releaserc.yml | 4 ++-- Makefile.toml | 22 ++++++++++------------ contracts/okp4-cognitarium/Cargo.toml | 7 ------- contracts/okp4-dataverse/Cargo.toml | 7 ------- contracts/okp4-law-stone/Cargo.toml | 7 ------- contracts/okp4-objectarium/Cargo.toml | 7 ------- 6 files changed, 12 insertions(+), 42 deletions(-) diff --git a/.releaserc.yml b/.releaserc.yml index 50f8eeec..0946b1e8 100644 --- a/.releaserc.yml +++ b/.releaserc.yml @@ -18,14 +18,14 @@ plugins: to: version = "${nextRelease.version}" - - "@semantic-release/exec" - prepareCmd: | - cargo make schema && cargo make docs-generate && cargo make release-assets + cargo make schema && cargo make docs-generate && cargo make release-wasm - - "@semantic-release/github" - assets: - path: "./target/wasm32-unknown-unknown/release/okp4_objectarium.wasm" - path: "./target/wasm32-unknown-unknown/release/okp4_law_stone.wasm" - path: "./target/wasm32-unknown-unknown/release/okp4_cognitarium.wasm" - path: "./target/wasm32-unknown-unknown/release/okp4_dataverse.wasm" - - path: "./target/wasm32-unknown-unknown/release/sha256sum.txt" + - path: "./target/wasm32-unknown-unknown/release/checksums.txt" - path: "./contracts/okp4-objectarium/schema/okp4-objectarium.json" - path: "./contracts/okp4-law-stone/schema/okp4-law-stone.json" - path: "./contracts/okp4-cognitarium/schema/okp4-cognitarium.json" diff --git a/Makefile.toml b/Makefile.toml index 67b88c49..1fd29e41 100644 --- a/Makefile.toml +++ b/Makefile.toml @@ -208,19 +208,17 @@ npx --yes prettier@3.1.1 docs/*.md --write echo "📖 Documentation has been successfully generated and available at $(pwd)/$DOCS_FOLDER/README.md" ''' -[tasks.release-assets] -dependencies = ["wasm"] +[tasks.release-wasm] +description = "Build optimized wasm using CosmWasm optimizer and provide checksums" script = ''' -echo "🐾 Generating release binary checksums into ${DIR_WASM}" -{ - cd ${DIR_WASM} - rm sha256sum.txt || true - touch sha256sum.txt - - for asset in `ls *.wasm`; do - shasum -a 256 ${asset} >> sha256sum.txt - done -} +echo "📦 Generating release binaries and checksums into ${DIR_WASM}" +docker run --rm -v "$(pwd)":/code \ + --mount type=volume,source="$(basename "$(pwd)")_cache",target=/target \ + --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ + cosmwasm/optimizer:0.15.1 + +mv artifacts/* ${DIR_WASM} +rmdir artifacts ''' [tasks.scaffold-smart-contract] diff --git a/contracts/okp4-cognitarium/Cargo.toml b/contracts/okp4-cognitarium/Cargo.toml index ba91d215..687a50a1 100644 --- a/contracts/okp4-cognitarium/Cargo.toml +++ b/contracts/okp4-cognitarium/Cargo.toml @@ -53,10 +53,3 @@ cw-multi-test.workspace = true backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] - -[package.metadata.scripts] -optimize = """docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.10 -""" diff --git a/contracts/okp4-dataverse/Cargo.toml b/contracts/okp4-dataverse/Cargo.toml index 1b7320ad..216817b6 100644 --- a/contracts/okp4-dataverse/Cargo.toml +++ b/contracts/okp4-dataverse/Cargo.toml @@ -59,10 +59,3 @@ url = "2.5.0" backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] - -[package.metadata.scripts] -optimize = """docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.10 -""" diff --git a/contracts/okp4-law-stone/Cargo.toml b/contracts/okp4-law-stone/Cargo.toml index e574b93f..bf6da8da 100644 --- a/contracts/okp4-law-stone/Cargo.toml +++ b/contracts/okp4-law-stone/Cargo.toml @@ -51,10 +51,3 @@ url = "2.5.0" backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] - -[package.metadata.scripts] -optimize = """docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.10 -""" diff --git a/contracts/okp4-objectarium/Cargo.toml b/contracts/okp4-objectarium/Cargo.toml index 8de68f4a..a9925d0a 100644 --- a/contracts/okp4-objectarium/Cargo.toml +++ b/contracts/okp4-objectarium/Cargo.toml @@ -55,10 +55,3 @@ cw-multi-test.workspace = true backtraces = ["cosmwasm-std/backtraces"] # use library feature to disable all instantiate/execute/query exports library = [] - -[package.metadata.scripts] -optimize = """docker run --rm -v "$(pwd)":/code \ - --mount type=volume,source="$(basename "$(pwd)")_cache",target=/code/target \ - --mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \ - cosmwasm/rust-optimizer:0.12.10 -""" From 0e607f1cb71925108c5ed008fbc1389c0f44ad9a Mon Sep 17 00:00:00 2001 From: Arnaud Mimart <33665250+amimart@users.noreply.github.com> Date: Fri, 8 Mar 2024 09:30:54 +0100 Subject: [PATCH 2/2] ci(release): force jq version for proper doc generation --- .github/workflows/release.yml | 6 ++++++ docs/okp4-cognitarium.md | 2 +- docs/okp4-dataverse.md | 2 +- docs/okp4-law-stone.md | 2 +- docs/okp4-objectarium.md | 2 +- 5 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b9bb79e0..a4f4ab30 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -43,6 +43,12 @@ jobs: with: node-version: 20 + - name: Setup jq + uses: dcarbone/install-jq-action@v2 + with: + version: 1.7 + force: true + - name: Setup rust uses: actions-rs/toolchain@v1 with: diff --git a/docs/okp4-cognitarium.md b/docs/okp4-cognitarium.md index 89874fbf..e0b5d1d3 100644 --- a/docs/okp4-cognitarium.md +++ b/docs/okp4-cognitarium.md @@ -876,4 +876,4 @@ Represents a condition in a [WhereClause]. --- -_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-cognitarium.json` (`e2226c4b5e5780b5`)_ +_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-cognitarium.json` (`a0e0b72e96074ba9`)_ diff --git a/docs/okp4-dataverse.md b/docs/okp4-dataverse.md index d10d48e6..3959f9bc 100644 --- a/docs/okp4-dataverse.md +++ b/docs/okp4-dataverse.md @@ -223,5 +223,5 @@ let b = Uint64::from(70u32); assert_eq!(b.u64(), 70); ``` --- -*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-dataverse.json` (`200eea4bacd8654a`)* +*Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-dataverse.json` (`c007ecd2b9eeb04a`)* ```` diff --git a/docs/okp4-law-stone.md b/docs/okp4-law-stone.md index 4aa9ef2f..69c79a95 100644 --- a/docs/okp4-law-stone.md +++ b/docs/okp4-law-stone.md @@ -128,4 +128,4 @@ A string containing Base64-encoded data. --- -_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-law-stone.json` (`b66539ab7e1aaf9c`)_ +_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-law-stone.json` (`d7f05e6c973e01e6`)_ diff --git a/docs/okp4-objectarium.md b/docs/okp4-objectarium.md index 7a09230e..e05eb3eb 100644 --- a/docs/okp4-objectarium.md +++ b/docs/okp4-objectarium.md @@ -511,4 +511,4 @@ A string containing a 128-bit integer in decimal representation. --- -_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-objectarium.json` (`6e145d8e13059aaa`)_ +_Rendered by [Fadroma](https://fadroma.tech) ([@fadroma/schema 1.1.0](https://www.npmjs.com/package/@fadroma/schema)) from `okp4-objectarium.json` (`26379e2de2530668`)_