feat(showcase): add EmitCustom event struct with runtime tag topic #20
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: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| # A newer push to the same branch cancels an in-flight run. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| contents: read | |
| env: | |
| CARGO_TERM_COLOR: always | |
| # Host tool version, per ADR-007. Not the project toolchain. | |
| STELLAR_CLI_VERSION: 27.1.0 | |
| jobs: | |
| # Formatting, lints, and tests run on the project toolchain that | |
| # rust-toolchain.toml pins. Nothing here selects a channel explicitly, | |
| # so rustup honours the pin. | |
| check: | |
| name: fmt, clippy, test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| - name: Report toolchain | |
| run: | | |
| rustc --version | |
| cargo --version | |
| cargo fmt --version | |
| cargo clippy --version | |
| # The workspace declares members through globs that resolve to nothing | |
| # until contracts/showcase lands at build step 13. Cargo fails on an | |
| # unresolvable member, so the cargo steps below are gated on the manifest | |
| # existing. The gate stops applying on its own once step 13 lands. | |
| - name: Detect workspace members | |
| id: members | |
| run: | | |
| if [ -f contracts/showcase/Cargo.toml ]; then | |
| echo "present=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "present=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice title=Scaffold phase::No workspace members yet. Cargo steps are skipped until build step 13 adds contracts/showcase." | |
| fi | |
| - name: Cache cargo registry and target | |
| if: steps.members.outputs.present == 'true' | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| target | |
| key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock', 'rust-toolchain.toml') }} | |
| restore-keys: cargo-${{ runner.os }}- | |
| - name: Check formatting | |
| if: steps.members.outputs.present == 'true' | |
| run: cargo fmt --all --check | |
| - name: Clippy | |
| if: steps.members.outputs.present == 'true' | |
| run: cargo clippy --workspace --all-targets -- -D warnings | |
| - name: Test | |
| if: steps.members.outputs.present == 'true' | |
| run: cargo test --workspace | |
| # The wasm build is a separate job because it needs stellar-cli, which | |
| # compiles on the host stable channel rather than the project pin. | |
| contract-build: | |
| name: stellar contract build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4 | |
| - name: Detect workspace members | |
| id: members | |
| run: | | |
| if [ -f contracts/showcase/Cargo.toml ]; then | |
| echo "present=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "present=false" >> "$GITHUB_OUTPUT" | |
| echo "::notice title=Scaffold phase::No contract yet. The wasm build is skipped until build step 13." | |
| fi | |
| # Cache the compiled binary rather than recompiling stellar-cli on every | |
| # run. The key carries the version, so a version bump misses the cache | |
| # and rebuilds exactly once. | |
| - name: Cache stellar-cli binary | |
| if: steps.members.outputs.present == 'true' | |
| id: stellar-cache | |
| uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4 | |
| with: | |
| path: ~/.cargo/bin/stellar | |
| key: stellar-cli-${{ runner.os }}-${{ env.STELLAR_CLI_VERSION }} | |
| # ADR-007 lists a prebuilt binary as the acceptable stellar-cli install | |
| # path for CI. Building it from crates.io pulls in libdbus-sys, which | |
| # needs a system libdbus-1-dev the runner does not carry, and costs over | |
| # four minutes even where it does work. The digest pins the exact | |
| # artifact, so a swapped or truncated download fails here rather than | |
| # silently producing a different binary. | |
| - name: Install stellar-cli from the pinned release binary | |
| if: steps.members.outputs.present == 'true' && steps.stellar-cache.outputs.cache-hit != 'true' | |
| env: | |
| STELLAR_CLI_SHA256: 9915fe63753d7154c26bb9e6410cf1d1ff9727a9b378e663c2790ab7a266af94 | |
| run: | | |
| set -euo pipefail | |
| asset="stellar-cli-${STELLAR_CLI_VERSION}-x86_64-unknown-linux-gnu.tar.gz" | |
| url="https://github.com/stellar/stellar-cli/releases/download/v${STELLAR_CLI_VERSION}/${asset}" | |
| curl -sSL --retry 3 --fail -o /tmp/stellar-cli.tar.gz "$url" | |
| echo "${STELLAR_CLI_SHA256} /tmp/stellar-cli.tar.gz" | sha256sum --check --strict | |
| mkdir -p "$HOME/.cargo/bin" | |
| tar -xzf /tmp/stellar-cli.tar.gz -C "$HOME/.cargo/bin" stellar | |
| chmod +x "$HOME/.cargo/bin/stellar" | |
| - name: Report versions | |
| if: steps.members.outputs.present == 'true' | |
| run: | | |
| stellar --version | |
| rustc --version # project pin, from rust-toolchain.toml | |
| - name: Build contract wasm | |
| if: steps.members.outputs.present == 'true' | |
| run: stellar contract build |