Skip to content

Commit

Permalink
Try and enable wasm tests (#38)
Browse files Browse the repository at this point in the history
* Fix: workspace dir
* List optimized artifacts
* Use bash for metacharacters expansion
* Use relative path for upload artifact
* Remove failing push to S3 job
* Disable on pull for performance
  • Loading branch information
maurolacy authored and Mauro Lacy committed Aug 13, 2024
1 parent f844851 commit 37c3609
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 28 deletions.
35 changes: 8 additions & 27 deletions .github/workflows/wasm-tests.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,27 @@
name: babylonchain/babylon-contract/wasm-tests-WIP
name: babylonchain/babylon-contract/wasm-tests
on:
push:
branches: [ "disabled" ]
pull_request:
branches: [ "disabled" ]
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
AWS_ACCESS_KEY_ID: xxxxYKF5
AWS_REGION: xxxxst-1
AWS_SECRET_ACCESS_KEY: xxxxmvcn
S3_BUCKET_PREFIX: xxxxract
WORKSPACE: "/home/runner/work/babylon-contract/babylon-contract"
jobs:
wasm-build-check-integration:
runs-on: ubuntu-latest
container:
image: rust:1.78.0
steps:
- uses: actions/[email protected]
- name: Build optimised Wasm binaries
run: "./scripts/build-optimizer-ci.sh"
- name: List optimised Wasm binaries
run: bash -c "ls $WORKSPACE/artifacts/*.wasm"
- name: Install cosmwasm-check
run: cargo install --locked --debug --version ^2.0 cosmwasm-check
- name: Check the Wasm binaries' validity
run: cosmwasm-check /__w/babylon-contract/babylon-contract/artifacts/*.wasm
run: bash -c "cosmwasm-check $WORKSPACE/artifacts/*.wasm"
- name: Integration tests based on CosmWasm
run: cargo test --test integration
- uses: actions/[email protected]
with:
path: |-
./artifacts/babylon_contract.wasm
./artifacts/btc_staking.wasm
push-to-s3:
runs-on: ubuntu-latest
needs:
- wasm-build-check-integration
steps:
- uses: actions/[email protected]
with:
path: "/tmp"
- uses: aws-actions/[email protected]
with:
aws-region: "${{ env.AWS_REGION }}"
aws-access-key-id: "${{ secrets.AWS_ACCESS_KEY_ID }}"
aws-secret-access-key: "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
- run: aws s3 cp /tmp/babylon_contract.wasm $S3_BUCKET_PREFIX/${{ github.repository }}-${{ github.sha }}.wasm
artifacts/babylon_contract.wasm
artifacts/btc_staking.wasm
4 changes: 3 additions & 1 deletion scripts/build-optimizer-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
DOCKER=$(which docker)
CUR_DIR=$(pwd)
CUR_BASENAME=$(basename $CUR_DIR)
WORKSPACE="/home/runner/work/babylon-contract/babylon-contract"

# Native arch
BUILDARCH=$(uname -m)
Expand All @@ -17,4 +18,5 @@ $DOCKER run --name rust-optimizer-container \
--mount type=volume,source=registry_cache,target=/usr/local/cargo/registry \
$OPTIMIZER_IMAGE_NAME:$OPTIMIZER_IMAGE_TAG

$DOCKER cp rust-optimizer-container:/code/artifacts /home/circleci/project/artifacts
echo $DOCKER cp rust-optimizer-container:/code/artifacts $WORKSPACE/artifacts
$DOCKER cp rust-optimizer-container:/code/artifacts $WORKSPACE/artifacts

0 comments on commit 37c3609

Please sign in to comment.