Skip to content

Commit

Permalink
feat: use optimizer (many-things#92)
Browse files Browse the repository at this point in the history
* optimizer

* remove deps installation

* revive

* pr

* setup go

* bump test-tube

* fix cov

* specify artifacts branch

* split artifact generation

* fix
  • Loading branch information
byeongsu-hong authored Jan 25, 2024
1 parent aa5539e commit e5bfbba
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 14 deletions.
49 changes: 39 additions & 10 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,16 @@ jobs:
unit-test:
strategy:
fail-fast: true

name: unit-test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Cache dependencies
uses: actions/cache@v3
with:
Expand All @@ -39,27 +43,52 @@ jobs:
- name: Run tests
run: cargo test --workspace --exclude hpl-tests

artifact:
permissions:
contents: write
pull-requests: write

name: artifact
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install Dependencies
run: |
rustup update 1.72
sudo apt-get install -y rename
make install
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Build wasm
run: make ci-build

- name: Upload wasm archive
uses: actions/upload-artifact@v2
- name: Pull request artifacts
uses: gavv/pull-request-artifacts@v2
with:
name: wasm_codes
path: wasm_codes.zip
commit: ${{ github.event.pull_request.head.sha }}
repo-token: ${{ secrets.GITHUB_TOKEN }}
artifacts-branch: artifacts
artifacts: |
wasm_codes.zip
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v4


- uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Install Rust
run: rustup update nightly

- name: Install target
run: rustup target add wasm32-unknown-unknown
run: |
rustup update nightly
rustup target add wasm32-unknown-unknown
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
Expand Down
4 changes: 2 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ digest = { version = "0.10.7" }
# testing
cw-multi-test = "0.20.0"
rstest = "0.18.2"
test-tube = { version = "0.3.0" }
osmosis-test-tube = { version = "21.0.0" }
test-tube = { version = "0.5.0" }
osmosis-test-tube = { version = "22.1.0" }
ibcx-test-utils = { version = "0.1.2" }

tokio = { version = "1", features = ["full"] }
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
PWD:=$(shell pwd)
BASE:=$(shell basename "$(PWD)")

clean:
@cargo clean
@rm -rf ./artifacts

install:
cargo install --force cw-optimizoor cosmwasm-check beaker
cargo install --force cosmwasm-check
rustup target add wasm32-unknown-unknown

schema:
Expand All @@ -12,7 +15,10 @@ schema:
build:
cargo build
cargo wasm
cargo cw-optimizoor
docker run --rm -v "$(PWD)":/code \
--mount type=volume,source="$(BASE)_cache",target=/code/target \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
cosmwasm/optimizer:0.15.0
rename --force 's/(.*)-(.*)\.wasm/$$1\.wasm/d' artifacts/*

check: build
Expand Down

0 comments on commit e5bfbba

Please sign in to comment.