@@ -10,6 +10,9 @@ concurrency:
1010 group : ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}-{{ github.event_name }}
1111 cancel-in-progress : true
1212
13+ env :
14+ ARTIFACT_RETENTION_DAYS_FOR_TEST_WASMS : 7
15+
1316defaults :
1417 run :
1518 shell : bash
1821
1922 complete :
2023 if : always()
21- needs : [fmt, check-git-rev-deps, semver-checks, build-and- test, build-fuzz, docs, readme, migration-docs]
24+ needs : [fmt, check-git-rev-deps, semver-checks, build, test, build-fuzz, docs, readme, migration-docs]
2225 runs-on : ubuntu-latest
2326 steps :
2427 - if : contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
5760 steps :
5861 - uses : actions/checkout@v3
5962 - run : rustup update
60- - uses : stellar/binaries@v41
63+ - uses : stellar/binaries@v45
6164 with :
6265 name : cargo-semver-checks
6366 version : 0.44.0
@@ -67,26 +70,68 @@ jobs:
6770 --exclude soroban-token-spec
6871 --exclude stellar-asset-spec
6972
70- build-and-test :
73+ build :
7174 strategy :
7275 fail-fast : false
7376 matrix :
7477 rust : [msrv, latest]
7578 sys :
7679 - os : ubuntu-latest
7780 target : x86_64-unknown-linux-gnu
81+ - os : ubuntu-24.04-arm
82+ target : aarch64-unknown-linux-gnu
83+ - os : macos-15-intel
84+ target : x86_64-apple-darwin
85+ - os : macos-latest
86+ target : aarch64-apple-darwin
87+ - os : windows-latest
88+ target : x86_64-pc-windows-msvc
89+ runs-on : ${{ matrix.sys.os }}
90+ steps :
91+ - uses : actions/checkout@v3
92+ - uses : stellar/actions/rust-cache@main
93+ - name : Use the minimum supported Rust version
94+ if : matrix.rust == 'msrv'
95+ run : |
96+ msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')"
97+ rustup override set $msrv
98+ rustup component add clippy rustfmt
99+ - name : Error on warnings only for msrv
100+ if : matrix.rust == 'msrv'
101+ run : echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV
102+ - run : rustup update
103+ - run : cargo version
104+ - run : rustup target add ${{ matrix.sys.target }}
105+ - run : rustup target add wasm32v1-none
106+ - run : echo CARGO_BUILD_TARGET='${{ matrix.sys.target }}' >> $GITHUB_ENV
107+ - uses : stellar/binaries@v45
108+ with :
109+ name : cargo-hack
110+ version : 0.5.28
111+ - run : make build-libs
112+ - run : make build-test-wasms TEST_CRATES_RUSTUP_TOOLCHAIN=
113+ - name : Upload test wasms
114+ uses : actions/upload-artifact@v4
115+ with :
116+ name : test-wasms-${{ matrix.rust }}-${{ matrix.sys.target }}
117+ path : target/wasm32v1-none/release/test_*.wasm
118+ retention-days : ${{ env.ARTIFACT_RETENTION_DAYS_FOR_TEST_WASMS }}
119+
120+ test :
121+ needs : build
122+ strategy :
123+ fail-fast : false
124+ matrix :
125+ rust : [msrv, latest]
126+ sys :
78127 - os : ubuntu-latest
128+ target : x86_64-unknown-linux-gnu
129+ - os : ubuntu-24.04-arm
79130 target : aarch64-unknown-linux-gnu
80- # Fix #1011 by avoiding the use of crate-type = ["cdylib"] in native
81- # builds that cross-compile. It causes linker errors. The root cause
82- # is rust-lang/cargo#4133. This workaround uses rustc to build for a
83- # specific crate-type, lib, such that the Cargo.toml crate-type is
84- # ignored.
85- cdylib-cross-compile-workaround : true
86- # - os: macos-latest
87- # target: x86_64-apple-darwin
88- # - os: macos-latest
89- # target: aarch64-apple-darwin
131+ - os : macos-15-intel
132+ target : x86_64-apple-darwin
133+ - os : macos-latest
134+ target : aarch64-apple-darwin
90135 - os : windows-latest
91136 target : x86_64-pc-windows-msvc
92137 runs-on : ${{ matrix.sys.os }}
@@ -98,42 +143,28 @@ jobs:
98143 run : |
99144 msrv="$(cargo metadata --format-version 1 --no-deps | jq -r '.packages | map(.rust_version) | map(values) | min')"
100145 rustup override set $msrv
101- rustup component add clippy --toolchain $msrv
102- - name : Error on warnings and clippy checks
103- # Only error on warnings and checks for the msrv, because new versions of
104- # Rust will frequently add new warnings and checks.
146+ rustup component add clippy rustfmt
147+ - name : Error on warnings only for msrv
105148 if : matrix.rust == 'msrv'
106149 run : echo RUSTFLAGS='-Dwarnings' >> $GITHUB_ENV
107150 - run : rustup update
108151 - run : cargo version
109152 - run : rustup target add ${{ matrix.sys.target }}
110153 - run : rustup target add wasm32v1-none
111- - uses : stellar/binaries@v37
154+ - run : echo CARGO_BUILD_TARGET='${{ matrix.sys.target }}' >> $GITHUB_ENV
155+ - uses : stellar/binaries@v45
112156 with :
113157 name : cargo-hack
114158 version : 0.5.28
115- - if : startsWith(matrix.sys.target, 'x86_64')
116- name : Clear test snapshots for checking no diffs exists after test run
159+ - name : Restore test wasms for tests from one of the msrv builds
160+ uses : actions/download-artifact@v5
161+ with :
162+ name : test-wasms-msrv-x86_64-unknown-linux-gnu
163+ path : target/wasm32v1-none/release/
164+ - name : Clear test snapshots for checking no diffs exists after test run
117165 run : rm -fr **/test_snapshots
118- - name : Build for wasm
119- run : cargo-hack hack build --target wasm32v1-none --profile release --workspace --exclude soroban-meta --exclude soroban-spec --exclude soroban-spec-rust --exclude soroban-ledger-snapshot
120- - name : Wasm Size
121- run : |
122- cd target/wasm32v1-none/release/ && \
123- for i in *.wasm ; do \
124- ls -l "$i"; \
125- done
126- - if : " !matrix.sys.cdylib-cross-compile-workaround"
127- name : Build for native
128- run : cargo-hack hack --feature-powerset --exclude-features docs build --target ${{ matrix.sys.target }}
129- - if : " matrix.sys.cdylib-cross-compile-workaround"
130- name : Build for native
131- run : cargo-hack hack --feature-powerset --exclude-features docs rustc --workspace --exclude soroban-sdk-macros --exclude proc_macros --crate-type lib --target ${{ matrix.sys.target }}
132- - if : startsWith(matrix.sys.target, 'x86_64')
133- name : Run tests
134- run : cargo-hack hack --feature-powerset --ignore-unknown-features --features testutils --exclude-features docs test --target ${{ matrix.sys.target }}
135- - if : startsWith(matrix.sys.target, 'x86_64')
136- name : Check no diffs exist
166+ - run : make test
167+ - name : Check no diffs exist
137168 run : git add -N . && git diff HEAD --exit-code
138169
139170 build-fuzz :
@@ -142,10 +173,10 @@ jobs:
142173 - uses : actions/checkout@v3
143174 - uses : stellar/actions/rust-cache@main
144175 - run : rustup install nightly
145- - uses : stellar/binaries@v37
176+ - uses : stellar/binaries@v45
146177 with :
147178 name : cargo-fuzz
148- version : 0.12.0
179+ version : 0.13.1
149180 - run : make build-fuzz
150181 - name : Check no diffs exist
151182 run : git add -N . && git diff HEAD --exit-code
0 commit comments