Repository navigation
164 lines (157 loc) · 6.69 KB
/
Copy pathtests.yml
File metadata and controls
164 lines (157 loc) · 6.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: RPC Tests
permissions:
contents: read
on:
workflow_dispatch:
push:
branches: [main, release/**]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
name: build
runs-on: ubuntu-latest
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
PKG_CONFIG_PATH: /usr/lib/pkgconfig
CI_CACHE: "/tmp/.cache"
CI_BUILD: "--locked"
steps:
- uses: actions/checkout@v6
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y libdbus-1-dev pkg-config libudev-dev
- run: rustup update
- run: rustup target add wasm32v1-none
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@nextest
- uses: cargo-bins/cargo-binstall@main
- uses: stellar/stellar-cli@v28.1.0
- uses: mozilla-actions/sccache-action@v0.0.11
# Integration tests load registry.wasm + hello_v1/v2.wasm from
# target/stellar/local. The registry contract lives in a sibling repo;
# the hello_v1/v2 fixtures are local (crates/stellar-registry-test/
# fixtures/contracts) and build with the CLI. Assemble both into the dir.
- name: Checkout stellar-registry/contracts
uses: actions/checkout@v6
with:
repository: stellar-registry/contracts
path: _contracts
# The contracts repo builds with the default release profile (its
# size-optimized settings moved to [profile.release] in contracts#13);
# it has no `contracts` cargo profile.
- name: Build registry.wasm
run: stellar contract build --package registry --manifest-path _contracts/Cargo.toml
- name: Build hello fixtures
run: |
stellar contract build --profile contracts --package hello_v1
stellar contract build --profile contracts --package hello_v2
- name: Assemble test wasms
run: |
mkdir -p target/stellar/local
cp _contracts/target/wasm32v1-none/release/registry.wasm target/stellar/local/
cp target/wasm32v1-none/contracts/hello_v1.wasm target/stellar/local/
cp target/wasm32v1-none/contracts/hello_v2.wasm target/stellar/local/
- run: just build
- name: Create nextest archive
run: cargo nextest archive --archive-file nextest-archive.tar.zst --package stellar-registry-cli --features integration-tests
- name: Package runtime artifacts
run: |
tar -cf - \
target/debug/stellar-registry \
target/stellar/local/ \
| zstd -1 -o runtime-artifacts.tar.zst
- name: Upload nextest archive
uses: actions/upload-artifact@v7
with:
name: nextest-archive
path: nextest-archive.tar.zst
retention-days: 1
- name: Upload runtime artifacts
uses: actions/upload-artifact@v7
with:
name: runtime-artifacts
path: runtime-artifacts.tar.zst
retention-days: 1
test:
name: test ${{ matrix.name }}
needs: build
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- name: registry-cli
filter: "test-integration-registry"
env:
STELLAR_RPC_URL: http://localhost:8000/soroban/rpc
STELLAR_NETWORK_PASSPHRASE: "Standalone Network ; February 2017"
STELLAR_ACCOUNT: default
STELLAR_CONTRACT_ID: core
steps:
- uses: actions/checkout@v6
- uses: taiki-e/install-action@just
- uses: taiki-e/install-action@nextest
- uses: stellar/stellar-cli@v28.1.0
# Start the local network at an explicit protocol. Without one,
# quickstart's local network starts at the image's own default, which
# moves with the image and may not match the protocol under test.
- name: Start local Stellar network
run: |
# stellar-cli skipped a 29 release, so the protocol no longer tracks
# the stellar-cli major in Cargo.toml. Protocol 29 has no XDR changes
# over 28, so stellar-cli 28.1 and SDK 28 contracts run on it as is.
PROTOCOL_VERSION=29
# The floating quickstart tag moves to new RPC releases, which only
# simulate the current and previous protocol, so pin an image that
# still simulates PROTOCOL_VERSION. Bump it alongside the protocol.
QUICKSTART_IMAGE_TAG=v684-b1561.1-latest
echo "Starting local network at protocol $PROTOCOL_VERSION with quickstart $QUICKSTART_IMAGE_TAG"
stellar container start local --protocol-version "$PROTOCOL_VERSION" --image-tag-override "$QUICKSTART_IMAGE_TAG"
echo "Waiting for RPC + friendbot to become healthy..."
for _ in $(seq 1 50); do
if curl --no-progress-meter --fail-with-body -X POST "http://localhost:8000/soroban/rpc" \
-H 'Content-Type: application/json' \
-d '{"jsonrpc":"2.0","id":8675309,"method":"getNetwork"}' >/dev/null 2>&1 \
&& curl --no-progress-meter "http://localhost:8000/friendbot" 2>/dev/null \
| grep -q '"invalid_field": "addr"'; then
echo "Local network healthy."
exit 0
fi
sleep 2
done
echo "Local network failed to become healthy in time." >&2
docker logs stellar --tail 100 || true
exit 1
# Friendbot answers health probes before it can fund reliably: the first
# funding requests can outlast the CLI's 30s timeout, failing the first
# tests at `keys generate --fund`. Fund a throwaway account first.
- name: Warm up friendbot
run: |
stellar keys generate friendbot-warmup
ADDRESS=$(stellar keys public-key friendbot-warmup)
curl --no-progress-meter --fail-with-body --max-time 120 \
--retry 5 --retry-delay 5 --retry-all-errors \
"http://localhost:8000/friendbot?addr=$ADDRESS" >/dev/null
- name: Download nextest archive
uses: actions/download-artifact@v8
with:
name: nextest-archive
- name: Download runtime artifacts
uses: actions/download-artifact@v8
with:
name: runtime-artifacts
- name: Extract runtime artifacts
run: zstd -d runtime-artifacts.tar.zst --stdout | tar xf -
- run: stellar keys generate default --fund
- name: Extract nextest archive
run: |
mkdir -p /tmp/nextest-run
cargo nextest run --archive-file nextest-archive.tar.zst --extract-to /tmp/nextest-run --workspace-remap . --no-run
cp -a /tmp/nextest-run/target/* target/
- name: Run tests
run: just ${{ matrix.filter }} true