add querier #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Cosmwasm Contracts | |
on: | |
pull_request: | |
branches: | |
- "**" | |
paths: | |
- "**/**/*.wasm" | |
- "**/**.rs" | |
- "**/**Cargo.toml" | |
- "**/**Cargo.lock" | |
- "**/cosmwasm/**" | |
- "**/wasmbinding/**" | |
- ".github/workflows/contracts.yml" | |
push: | |
branches: | |
- "main" | |
- "v[0-9]**" | |
paths: | |
- "**/**/*.wasm" | |
- "**/**.rs" | |
- "**/**Cargo.toml" | |
- "**/**Cargo.lock" | |
- "**/cosmwasm/**" | |
- "**/wasmbinding/**" | |
- ".github/workflows/contracts.yml" | |
workflow_dispatch: | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
test: | |
name: Optimize Cosmwasm Contracts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
contract: | |
[ | |
{ | |
workdir: ./x/ibc-rate-limit/, | |
bytecode: x/ibc-rate-limit/bytecode/rate_limiter.wasm, | |
build: artifacts/rate_limiter.wasm, | |
name: rate_limiter, | |
}, | |
{ | |
workdir: ./cosmwasm/, | |
bytecode: tests/ibc-hooks/bytecode/crosschain_swaps.wasm, | |
build: artifacts/crosschain_swaps.wasm, | |
name: crosschain_swaps, | |
}, | |
{ | |
workdir: ./cosmwasm/, | |
bytecode: tests/ibc-hooks/bytecode/swaprouter.wasm, | |
build: artifacts/swaprouter.wasm, | |
name: swaprouter, | |
}, | |
{ | |
workdir: ./cosmwasm/, | |
bytecode: tests/ibc-hooks/bytecode/outpost.wasm, | |
build: artifacts/outpost.wasm, | |
name: outpost, | |
}, | |
] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Optimize | |
working-directory: ${{ matrix.contract.workdir }} | |
run: > | |
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/workspace-optimizer:0.12.10 | |
- name: "Upload optimized contract artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.contract.name }} | |
path: ${{ matrix.contract.workdir }}${{ matrix.contract.build }} | |
retention-days: 1 | |
- name: "Upload Cargo.lock artifact" | |
uses: actions/upload-artifact@v3 | |
with: | |
name: Cargo.lock | |
path: ${{ matrix.contract.workdir }}Cargo.lock | |
retention-days: 1 | |
# TODO: workspace optimizer compiles all contracts in the workspace, so we could just run that once | |
# and then check the diff of all the bytecode files | |
- name: Check Test Data | |
working-directory: ${{ matrix.contract.workdir }} | |
run: > | |
diff "${GITHUB_WORKSPACE}/${{ matrix.contract.bytecode }}" ${{ matrix.contract.build }} | |
tests: | |
name: Test Cosmwasm Contracts | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
contract: | |
[ | |
{ | |
workdir: ./x/ibc-rate-limit/, | |
bytecode: x/ibc-rate-limit/bytecode/rate_limiter.wasm, | |
build: artifacts/rate_limiter.wasm, | |
name: rate_limiter, | |
}, | |
{ | |
workdir: ./cosmwasm/, | |
bytecode: tests/ibc-hooks/bytecode/crosschain_swaps.wasm, | |
build: artifacts/crosschain_swaps.wasm, | |
name: crosschain_swaps, | |
}, | |
{ | |
workdir: ./cosmwasm/, | |
bytecode: tests/ibc-hooks/bytecode/swaprouter.wasm, | |
build: artifacts/swaprouter.wasm, | |
name: swaprouter, | |
}, | |
{ | |
workdir: ./cosmwasm/, | |
bytecode: tests/ibc-hooks/bytecode/outpost.wasm, | |
build: artifacts/outpost.wasm, | |
name: outpost, | |
}, | |
] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/[email protected] | |
with: | |
target: wasm32-unknown-unknown | |
- name: Add the wasm target | |
working-directory: ${{ matrix.contract.workdir }} | |
run: > | |
rustup target add wasm32-unknown-unknown; | |
- name: Test | |
working-directory: ${{ matrix.contract.workdir }} | |
run: > | |
cargo test | |
lints: | |
name: Cosmwasm Lints | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
workdir: [./x/ibc-rate-limit, ./cosmwasm] | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Install toolchain | |
uses: dtolnay/[email protected] | |
with: | |
components: rustfmt, clippy | |
- name: Format | |
working-directory: ${{ matrix.workdir }} | |
run: > | |
cargo fmt --all -- --check | |
- name: run cargo clippy | |
working-directory: ${{ matrix.workdir }} | |
run: > | |
cargo clippy -- -D warnings |