chore(repo): 🧾 prepare open source readiness baseline #18
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: | |
| - "**" | |
| pull_request: | |
| jobs: | |
| msrv: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@1.85.0 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: msrv | |
| run: cargo check --workspace --all-targets --all-features --locked | |
| wasm: | |
| runs-on: ubuntu-latest | |
| needs: msrv | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-wasip2 | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: wasm aelf-client | |
| run: cargo check -p aelf-client --target wasm32-wasip2 --no-default-features | |
| - name: wasm aelf-contract | |
| run: cargo check -p aelf-contract --target wasm32-wasip2 --no-default-features | |
| - name: wasm aelf-sdk | |
| run: cargo check -p aelf-sdk --target wasm32-wasip2 --no-default-features | |
| test: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - msrv | |
| - wasm | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: install cargo-audit | |
| run: cargo install cargo-audit --locked | |
| - name: fmt | |
| run: cargo fmt --all -- --check | |
| - name: clippy | |
| run: cargo clippy --workspace --all-targets --all-features -- -D warnings | |
| - name: audit | |
| run: cargo audit | |
| - name: examples | |
| run: cargo check --workspace --examples | |
| - name: test | |
| run: cargo test --workspace --all-targets | |
| public-smoke: | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: dtolnay/rust-toolchain@stable | |
| - uses: Swatinem/rust-cache@v2 | |
| - name: public readonly smoke | |
| run: | | |
| retry() { | |
| local attempts=3 | |
| local delay=5 | |
| for attempt in $(seq 1 "$attempts"); do | |
| if "$@"; then | |
| return 0 | |
| fi | |
| if [[ "$attempt" -lt "$attempts" ]]; then | |
| sleep "$delay" | |
| fi | |
| done | |
| return 1 | |
| } | |
| retry cargo test -p aelf-sdk --test public_readonly_smoke -- --ignored --test-threads=1 --nocapture |