Merge pull request #189 from JojoFlex1/main #203
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: Smart Contracts CI | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| pull_request: | |
| branches: [ "main" ] | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Install Rust | |
| uses: actions-rs/toolchain@v1 | |
| with: | |
| toolchain: stable | |
| target: wasm32-unknown-unknown | |
| override: true | |
| 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 | |
| sudo mv stellar /usr/local/bin/ | |
| set -euo pipefail | |
| VERSION="25.1.0" | |
| ARCHIVE="stellar-cli-${VERSION}-x86_64-unknown-linux-gnu.tar.gz" | |
| URL="https://github.com/stellar/stellar-cli/releases/download/v${VERSION}/${ARCHIVE}" | |
| wget "${URL}" -O "${ARCHIVE}" | |
| # Package layout has changed across versions; locate the binary from the archive contents. | |
| BIN_PATH="$(tar -tzf "${ARCHIVE}" | grep -E '(^|/)stellar(-cli)?$' | head -n 1 || true)" | |
| if [ -z "${BIN_PATH}" ]; then | |
| echo "Could not locate stellar CLI binary in ${ARCHIVE}" | |
| tar -tzf "${ARCHIVE}" | |
| exit 1 | |
| fi | |
| tar -xzf "${ARCHIVE}" | |
| sudo install -m 0755 "${BIN_PATH}" /usr/local/bin/stellar | |
| stellar --version | |
| - name: Build Contract | |
| run: | | |
| cargo clean | |
| cargo build --target wasm32-unknown-unknown --release | |
| - name: Run Unit Tests | |
| run: | | |
| cargo test --workspace | |
| cargo test --all-features |