-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
using base example from wasmcov to all examples directories
- Loading branch information
Showing
50 changed files
with
350 additions
and
220 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
name: Coverage | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
env: | ||
RUSTFLAGS: "-D warnings" | ||
|
||
jobs: | ||
coverage: | ||
runs-on: ${{ matrix.platform }} | ||
name: "${{ matrix.example }} - ${{ matrix.platform }}" | ||
strategy: | ||
matrix: | ||
toolchain: [nightly-2024-07-01-aarch64-apple-darwin] | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Homebrew | ||
run: | | ||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" | ||
- name: Install LLVM | ||
run: brew install llvm | ||
- name: Add LLVM to PATH | ||
run: echo "/opt/homebrew/opt/llvm/bin" >> $GITHUB_PATH | ||
- name: Llvm version | ||
run: llvm-config --version | ||
- name: Clang version | ||
run: clang --version | ||
- name: "${{ matrix.toolchain }} with rustfmt, and wasm32" | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
profile: minimal | ||
toolchain: ${{ matrix.toolchain }} | ||
target: wasm32-unknown-unknown | ||
- name: Set Default Toolchain | ||
run: rustup override set ${{ matrix.toolchain }} | ||
- name: Rust version | ||
run: rustc --version --verbose | ||
- name: Verify Rust Toolchain | ||
run: rustup show | ||
- name: Add rust-src component | ||
run: rustup component add rust-src --toolchain ${{ matrix.toolchain }} | ||
- name: Install wasmcov | ||
run: cargo +${{ matrix.toolchain }} install wasmcov | ||
- name: Create wasmcov directory | ||
run: mkdir -p ${{ github.workspace }}/wasmcov | ||
- name: Set WASMCOV_DIR environment variable | ||
run: echo "WASMCOV_DIR=${{ github.workspace }}/wasmcov" >> $GITHUB_ENV | ||
- name: Set up cache for near_sandbox directory | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{ github.workspace }}/wasmcov/near_sandbox | ||
key: ${{ runner.os }}-near-sandbox-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-near-sandbox-${{ github.sha }} | ||
- name: Build examples | ||
env: | ||
RUSTFLAGS: '-C link-arg=-s' | ||
run: bash ./examples/build_wasm_test_all.sh ${{ matrix.toolchain }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
#!/bin/bash | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
set -e | ||
cd "$(dirname $0)" | ||
|
||
INCLUDE_COVERAGE="${1:-false}" | ||
|
||
if [ "$INCLUDE_COVERAGE" = true ]; then | ||
cargo-wasmcov build --wasmcov-dir /Users/jrmncos/forks/near-sdk-rs/examples/wasmcov -- --all --target wasm32-unknown-unknown --release | ||
cp ../wasmcov/target/wasm32-unknown-unknown/release/adder.wasm ./res/ | ||
if [ -n "$WASMCOV_DIR" ]; then | ||
TARGET="${WASMCOV_DIR}/target" | ||
BUILD_COMMAND="cargo wasmcov build -- --features wasmcov" | ||
else | ||
cargo build --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/adder.wasm ./res/ | ||
#wasm-opt -Oz --output ./res/status_message.wasm ./res/status_message.wasm | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
BUILD_COMMAND="cargo build" | ||
fi | ||
|
||
set -e | ||
cd "$(dirname $0)" | ||
$BUILD_COMMAND --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/adder.wasm ./res/ | ||
#wasm-opt -Oz --output ./res/status_message.wasm ./res/status_message.wasm |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
#!/bin/bash | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
set -e | ||
cd "$(dirname $0)" | ||
|
||
INCLUDE_COVERAGE="${1:-false}" | ||
|
||
if [ "$INCLUDE_COVERAGE" = "true" ]; then | ||
cargo-wasmcov build --wasmcov-dir /Users/jrmncos/forks/near-sdk-rs/examples/wasmcov -- --all --target wasm32-unknown-unknown --release | ||
cp ../wasmcov/target/wasm32-unknown-unknown/release/callback_results.wasm ./res/ | ||
if [ -n "$WASMCOV_DIR" ]; then | ||
TARGET="${WASMCOV_DIR}/target" | ||
BUILD_COMMAND="cargo wasmcov build -- --features wasmcov" | ||
else | ||
cargo build --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/callback_results.wasm ./res/ | ||
fi | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
BUILD_COMMAND="cargo build" | ||
fi | ||
|
||
set -e | ||
cd "$(dirname $0)" | ||
$BUILD_COMMAND --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/callback_results.wasm ./res/ |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,15 @@ | ||
#!/bin/bash | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
set -e | ||
cd "$(dirname $0)" | ||
|
||
INCLUDE_COVERAGE="${1:-false}" | ||
|
||
if [ "$INCLUDE_COVERAGE" = "true" ]; then | ||
cargo-wasmcov build --wasmcov-dir /Users/jrmncos/forks/near-sdk-rs/examples/wasmcov -- --all --target wasm32-unknown-unknown --release | ||
cp ../wasmcov/target/wasm32-unknown-unknown/release/cross_contract_high_level.wasm ./res/ | ||
cp ../wasmcov/target/wasm32-unknown-unknown/release/cross_contract_low_level.wasm ./res/ | ||
if [ -n "$WASMCOV_DIR" ]; then | ||
TARGET="${WASMCOV_DIR}/target" | ||
BUILD_COMMAND="cargo wasmcov build -- --features wasmcov" | ||
else | ||
cargo build --all --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/cross_contract_high_level.wasm ./res/ | ||
cp $TARGET/wasm32-unknown-unknown/release/cross_contract_low_level.wasm ./res/ | ||
fi | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
BUILD_COMMAND="cargo build" | ||
fi | ||
|
||
set -e | ||
cd "$(dirname $0)" | ||
$BUILD_COMMAND --all --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/cross_contract_high_level.wasm ./res/ | ||
cp $TARGET/wasm32-unknown-unknown/release/cross_contract_low_level.wasm ./res/ |
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,16 @@ | ||
#!/bin/bash | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
|
||
if [ -n "$WASMCOV_DIR" ]; then | ||
TARGET="${WASMCOV_DIR}/target" | ||
BUILD_COMMAND="cargo wasmcov build -- --features wasmcov" | ||
else | ||
TARGET="${CARGO_TARGET_DIR:-../../target}" | ||
BUILD_COMMAND="cargo build" | ||
fi | ||
|
||
set -e | ||
cd "$(dirname $0)" | ||
|
||
INCLUDE_COVERAGE="${1:-false}" | ||
|
||
if [ "$INCLUDE_COVERAGE" = "true" ]; then | ||
cargo-wasmcov build --wasmcov-dir /Users/jrmncos/forks/near-sdk-rs/examples/wasmcov -- --all --target wasm32-unknown-unknown --release | ||
cp ../wasmcov/target/wasm32-unknown-unknown/release/factory_contract_high_level.wasm ./res/ | ||
cp ../wasmcov/target/wasm32-unknown-unknown/release/factory_contract_low_level.wasm ./res/ | ||
else | ||
cargo build --all --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/factory_contract_high_level.wasm ./res/ | ||
cp $TARGET/wasm32-unknown-unknown/release/factory_contract_low_level.wasm ./res/ | ||
fi | ||
$BUILD_COMMAND --all --target wasm32-unknown-unknown --release | ||
cp $TARGET/wasm32-unknown-unknown/release/factory_contract_high_level.wasm ./res/ | ||
cp $TARGET/wasm32-unknown-unknown/release/factory_contract_low_level.wasm ./res/ |
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
Oops, something went wrong.