Skip to content

Commit

Permalink
use optimizer
Browse files Browse the repository at this point in the history
  • Loading branch information
taitruong committed Jun 13, 2024
1 parent 0515aa9 commit 753eca4
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 18 deletions.
49 changes: 32 additions & 17 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,27 +226,42 @@ jobs:
# We also sanity-check the resultant wasm files.
wasm-build:
docker:
- image: rust:1.78.0
# Image from https://github.com/cibuilds/github, based on alpine
- image: cibuilds/github:0.13
steps:
- checkout:
path: ~/project
- run:
name: Version information
command: rustc --version; cargo --version; rustup --version
- restore_cache:
keys:
- cargocache-wasm-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
name: Install Docker client
command: apk add docker-cli
- run:
name: Install dependencies
command: |
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
rustup target add wasm32-unknown-unknown
- setup_remote_docker
- checkout
- run:
# We cannot mount local folders, see https://circleci.com/docs/2.0/building-docker-images/#mounting-folders
name: Prepare volume with source code
command: |
# create a dummy container which will hold a volume with config
docker create -v /code --name with_code alpine /bin/true
# copy a config file into this volume
docker cp Cargo.toml with_code:/code
docker cp Cargo.lock with_code:/code
# copy code into this volume
docker cp ./contracts with_code:/code
docker cp ./packages with_code:/code
- run:
name: Add wasm32 target
command: rustup target add wasm32-unknown-unknown
name: Build development contracts
command: |
docker run --volumes-from with_code cosmwasm/workspace-optimizer:0.16.0
docker cp with_code:/code/artifacts ./artifacts
- run:
name: Build Wasm Release
name: List artifacts and checksums
command: |
for C in ./contracts/*/
do
echo "Compiling `basename $C`..."
(cd $C && cargo build --release --target wasm32-unknown-unknown --lib --locked)
done
ls -l artifacts
cat artifacts/checksums.txt
- run:
name: Install check_contract
# Uses --debug for compilation speed
Expand All @@ -258,7 +273,7 @@ jobs:
key: cargocache-wasm-rust:1.78.0-{{ checksum "~/project/Cargo.lock" }}
- run:
name: Check wasm contracts
command: cosmwasm-check ./target/wasm32-unknown-unknown/release/*.wasm
command: cosmwasm-check ./artifacts/*.wasm

# This job roughly follows the instructions from https://circleci.com/blog/publishing-to-github-releases-via-circleci/
build_and_upload_contracts:
Expand Down
2 changes: 1 addition & 1 deletion Makefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ fi
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 \
${image}:0.15.0
${image}:0.16.0
"""

[tasks.schema]
Expand Down

0 comments on commit 753eca4

Please sign in to comment.