Merge pull request #96 from Jeyvers/main #101
This file contains hidden or 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: SubStream Contract Tests | |
| on: | |
| push: | |
| branches: ["main"] | |
| pull_request: | |
| branches: ["main"] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rustfmt, clippy | |
| - name: Install Stellar CLI | |
| run: | | |
| wget https://github.com/stellar/stellar-cli/releases/download/v25.1.0/stellar-cli-25.1.0-x86_64-unknown-linux-gnu.tar.gz | |
| tar -xzf stellar-cli-25.1.0-x86_64-unknown-linux-gnu.tar.gz | |
| # Find the stellar binary and move it to /usr/local/bin | |
| find . -maxdepth 2 -name stellar -type f -exec sudo mv {} /usr/local/bin/ \; | |
| stellar --version | |
| - name: Install Binaryen for WASM optimization | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y binaryen | |
| - name: Build Contract | |
| run: cargo build --target wasm32-unknown-unknown --release | |
| - name: Build and Compress WASM | |
| run: | | |
| cd contracts/substream_contracts | |
| make build-compressed | |
| - name: Run Unit Tests | |
| run: cargo test | |
| - name: Install tarpaulin | |
| run: cargo install cargo-tarpaulin | |
| - name: Run Code Coverage | |
| run: | | |
| cargo tarpaulin --out Lcov --output-dir coverage | |
| - name: Upload Coverage report | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: code-coverage-report | |
| path: coverage/lcov.info | |
| - name: Upload Compressed WASM files | |
| uses: actions/upload-artifact@v3 | |
| with: | |
| name: compressed-wasm | |
| path: contracts/substream_contracts/target/compressed/ |