Skip to content

Add an example contract that demonstrates TTL testing techniques. (#310) #1

Add an example contract that demonstrates TTL testing techniques. (#310)

Add an example contract that demonstrates TTL testing techniques. (#310) #1

Workflow file for this run

name: Rust
on:
push:
branches: [main, dev]
pull_request:
env:
MINIMUM_RUST_VERSION: 1.74.0
jobs:
complete:
if: always()
needs: [fmt, rust-analyzer-compat, build-and-test]
runs-on: ubuntu-latest
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1
dirs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- id: dirs
run: |
dirs=$(find . -type f -name 'Makefile' -mindepth 2 | xargs dirname | sed 's|^\./||' | jq -Rnc '[inputs | "\(.)"]')
echo "dirs=$dirs" >> $GITHUB_OUTPUT
outputs:
dirs: ${{ steps.dirs.outputs.dirs }}
fmt:
needs: dirs
strategy:
matrix:
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }}
defaults:
run:
working-directory: ${{ matrix.working-directory }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: cargo fmt --all --check
rust-analyzer-compat:
needs: dirs
strategy:
matrix:
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }}
defaults:
run:
working-directory: ${{ matrix.working-directory }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- run: rustup update
- run: rustup +nightly component add rust-analyzer
- name: Check if rust-analyzer encounters any errors parsing project
run: rustup run nightly rust-analyzer analysis-stats 2>&1 | (! grep ERROR)
build-and-test:
needs: dirs
strategy:
matrix:
working-directory: ${{ fromJSON(needs.dirs.outputs.dirs) }}
rust: [msrv, latest]
sys:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
defaults:
run:
working-directory: ${{ matrix.working-directory }}
runs-on: ${{ matrix.sys.os }}
steps:
- uses: actions/checkout@v3
- uses: stellar/actions/rust-cache@main
- name: Use the minimum supported Rust version
if: matrix.rust == 'msrv'
run: |
rustup override set $MINIMUM_RUST_VERSION
rustup component add clippy --toolchain $MINIMUM_RUST_VERSION
- name: Error on warnings and clippy checks
# Only error on warnings and checks for the msrv, because new versions of
# Rust will frequently add new warnings and checks.
if: matrix.rust == 'msrv'
run: echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV
- run: rustup update
- run: cargo version
- run: rustup target add ${{ matrix.sys.target }}
- run: rustup target add wasm32-unknown-unknown
- uses: stellar/binaries@v16
with:
name: soroban-cli
version: 0.8.7
- run: make test
env:
CARGO_BUILD_TARGET: ${{ matrix.sys.target }}