Skip to content

Commit 4ea3565

Browse files
committed
ci: matrix Rust and stellar-cli for contract build, tests, deploy smoke
- Add contracts-audit job (single RustSec cargo audit) to avoid repeating audit across matrix legs - Matrix: stable and 1.82 × stellar-cli 23.4.1 and 25.2.0 (fail-fast: false) - Build workspace wasm release; run cargo test --workspace - Cache ~/.cargo/bin/stellar per CLI version; skip install on cache hit - Unique Futurenet deploy identity and outputs per matrix leg Made-with: Cursor
1 parent d33d09f commit 4ea3565

File tree

1 file changed

+65
-20
lines changed

1 file changed

+65
-20
lines changed

.github/workflows/ci.yml

Lines changed: 65 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: CI
22

33
on:
44
push:
5-
branches: [main, master, feat/dependency-audit-ci]
5+
branches: [main, master, feat/dependency-audit-ci, "ci/**"]
66
pull_request:
77
branches: [main, master, feat/dependency-audit-ci]
88

@@ -84,27 +84,23 @@ jobs:
8484
DB_PASSWORD: postgres
8585
DB_NAME: myfans
8686

87-
contracts:
88-
name: Contracts
87+
# Single audit job (not duplicated across the toolchain matrix) to save CI time.
88+
contracts-audit:
89+
name: Contracts (RustSec audit)
8990
runs-on: ubuntu-latest
9091
steps:
9192
- uses: actions/checkout@v4
9293

93-
- name: Install system dependencies (for stellar-cli)
94-
run: |
95-
sudo apt-get update
96-
sudo apt-get install -y libdbus-1-dev libudev-dev pkg-config
97-
98-
- name: Install Rust
94+
- name: Install Rust (stable)
9995
uses: dtolnay/rust-toolchain@stable
10096
with:
101-
toolchain: stable
10297
targets: wasm32-unknown-unknown,wasm32v1-none
10398

10499
- name: Rust cache
105100
uses: Swatinem/rust-cache@v2
106101
with:
107102
workspaces: contract
103+
prefix-key: contracts-audit
108104

109105
- name: Install cargo-audit
110106
run: cargo install cargo-audit --locked
@@ -114,22 +110,71 @@ jobs:
114110
run: cargo audit
115111
working-directory: contract
116112

117-
- name: Build
118-
run: cargo build --target wasm32-unknown-unknown --release
113+
contracts:
114+
name: Contracts (${{ matrix.name }})
115+
runs-on: ubuntu-latest
116+
strategy:
117+
fail-fast: false
118+
matrix:
119+
include:
120+
# Rust stable × two supported stellar-cli releases
121+
- name: rust-stable-cli-23
122+
rust: stable
123+
stellar_cli: "23.4.1"
124+
- name: rust-stable-cli-25
125+
rust: stable
126+
stellar_cli: "25.2.0"
127+
# Minimum supported toolchain in CI (keep aligned with Soroban SDK / MSRV)
128+
- name: rust-1.82-cli-23
129+
rust: "1.82"
130+
stellar_cli: "23.4.1"
131+
- name: rust-1.82-cli-25
132+
rust: "1.82"
133+
stellar_cli: "25.2.0"
134+
steps:
135+
- uses: actions/checkout@v4
136+
137+
- name: Install system dependencies (for stellar-cli)
138+
run: |
139+
sudo apt-get update
140+
sudo apt-get install -y libdbus-1-dev libudev-dev pkg-config
141+
142+
- name: Install Rust (${{ matrix.rust }})
143+
uses: dtolnay/rust-toolchain@master
144+
with:
145+
toolchain: ${{ matrix.rust }}
146+
targets: wasm32-unknown-unknown,wasm32v1-none
147+
148+
- name: Rust cache
149+
uses: Swatinem/rust-cache@v2
150+
with:
151+
workspaces: contract
152+
prefix-key: contracts-${{ matrix.name }}
153+
154+
- name: Build (wasm release, workspace)
155+
run: cargo build --workspace --target wasm32-unknown-unknown --release
119156
working-directory: contract
120157

121-
- name: Run tests
122-
run: cargo test
158+
- name: Run tests (workspace)
159+
run: cargo test --workspace
123160
working-directory: contract
124161

125-
- name: Install Stellar CLI
126-
run: cargo install --locked stellar-cli
162+
- name: Cache stellar CLI binary
163+
id: stellar-cache
164+
uses: actions/cache@v4
165+
with:
166+
path: ~/.cargo/bin/stellar
167+
key: stellar-cli-${{ matrix.stellar_cli }}-${{ runner.os }}-v1
168+
169+
- name: Install Stellar CLI ${{ matrix.stellar_cli }}
170+
if: steps.stellar-cache.outputs.cache-hit != 'true'
171+
run: cargo install stellar-cli --locked --version ${{ matrix.stellar_cli }}
127172

128-
- name: Deploy and verify on Futurenet
173+
- name: Deploy and verify on Futurenet (smoke)
129174
run: |
130175
./scripts/deploy.sh \
131176
--network futurenet \
132-
--source "ci-deployer-${{ github.run_id }}-${{ github.run_attempt }}" \
133-
--out ./deployed-ci.json \
134-
--env-out ./.env.deployed-ci
177+
--source "ci-${{ github.run_id }}-${{ github.run_attempt }}-${{ matrix.name }}" \
178+
--out "./deployed-ci-${{ matrix.name }}.json" \
179+
--env-out "./.env.deployed-ci-${{ matrix.name }}"
135180
working-directory: contract

0 commit comments

Comments
 (0)