-
Notifications
You must be signed in to change notification settings - Fork 19
175 lines (155 loc) · 6.92 KB
/
soroban-rpc.yml
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
165
166
167
168
169
170
171
172
173
174
175
name: Soroban RPC
defaults:
run:
shell: bash
on:
push:
branches: [ main, release/** ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}
cancel-in-progress: true
jobs:
test:
name: Unit tests
strategy:
matrix:
os: [ ubuntu-20.04, ubuntu-22.04 ]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
# For pull requests, build and test the PR head not a merge of the PR with the destination.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
# We need to full history for git-restore-mtime to know what modification dates to use.
# Otherwise, the Go test cache will fail (due to the modification time of fixtures changing).
fetch-depth: "0"
- uses: ./.github/actions/setup-go
- run: rustup update
- uses: stellar/actions/rust-cache@main
- run: make build-libs
- run: go test -race -timeout 25m ./cmd/soroban-rpc/...
build:
name: Build
strategy:
matrix:
include:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
go_arch: amd64
- os: ubuntu-latest
rust_target: aarch64-unknown-linux-gnu
go_arch: arm64
- os: macos-latest
rust_target: x86_64-apple-darwin
go_arch: amd64
- os: macos-latest
rust_target: aarch64-apple-darwin
go_arch: arm64
- os: windows-latest
rust_target: x86_64-pc-windows-gnu
go_arch: amd64
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-go
# On windows, make sure we have the same compiler (linker) used by rust.
# This is important since the symbols names won't match otherwise.
- if: matrix.os == 'windows-latest'
name: Install the same mingw gcc compiler used by rust
run: |
C:/msys64/usr/bin/pacman.exe -S mingw-w64-x86_64-gcc --noconfirm
echo "CC=C:/msys64/mingw64/bin/gcc.exe" >> $GITHUB_ENV
echo "C:/msys64/mingw64/bin" >> $GITHUB_PATH
# Use cross-compiler for linux aarch64
- if: matrix.rust_target == 'aarch64-unknown-linux-gnu'
name: Install aarch64 cross-compilation toolchain
run: |
sudo apt-get update
sudo apt-get install -y gcc-10-aarch64-linux-gnu
echo 'CC=aarch64-linux-gnu-gcc-10' >> $GITHUB_ENV
- run: |
rustup target add ${{ matrix.rust_target }}
rustup update
- uses: stellar/actions/rust-cache@main
- run: make build-libs
env:
CARGO_BUILD_TARGET: ${{ matrix.rust_target }}
- name: Build Soroban RPC reproducible build
run: |
go build -trimpath -buildvcs=false ./cmd/soroban-rpc
ls -lh soroban-rpc
file soroban-rpc
env:
CGO_ENABLED: 1
GOARCH: ${{ matrix.go_arch }}
integration:
name: Integration tests
continue-on-error: true
strategy:
matrix:
os: [ ubuntu-20.04, ubuntu-22.04 ]
protocol-version: [ 20, 21 ]
runs-on: ${{ matrix.os }}
env:
SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true
SOROBAN_RPC_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core
PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 21.1.0-1909.rc1.b3aeb14cc.focal
PROTOCOL_20_CORE_DOCKER_IMG: stellar/stellar-core:21.1.0-1909.rc1.b3aeb14cc.focal
PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.1.0-1909.rc1.b3aeb14cc.focal
PROTOCOL_21_CORE_DOCKER_IMG: stellar/stellar-core:21.1.0-1909.rc1.b3aeb14cc.focal
steps:
- uses: actions/checkout@v4
with:
# For pull requests, build and test the PR head not a merge of the PR with the destination.
ref: ${{ github.event.pull_request.head.sha || github.ref }}
# We need to full history for git-restore-mtime to know what modification dates to use.
# Otherwise, the Go test cache will fail (due to the modification time of fixtures changing).
fetch-depth: "0"
- uses: ./.github/actions/setup-go
- name: Pull and set Stellar Core image
shell: bash
run: |
docker pull "$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG"
echo SOROBAN_RPC_INTEGRATION_TESTS_DOCKER_IMG="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DOCKER_IMG" >> $GITHUB_ENV
- name: Install Captive Core
shell: bash
run: |
# Workaround for https://github.com/actions/virtual-environments/issues/5245,
# libc++1-8 won't be installed if another version is installed (but apt won't give you a helpful
# message about why the installation fails)
sudo apt-get remove -y libc++1-10 libc++abi1-10 || true
sudo wget -qO - https://apt.stellar.org/SDF.asc | APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=true sudo apt-key add -
sudo bash -c 'echo "deb https://apt.stellar.org focal unstable" > /etc/apt/sources.list.d/SDF-unstable.list'
sudo apt-get update && sudo apt-get install -y stellar-core="$PROTOCOL_${{ matrix.protocol-version }}_CORE_DEBIAN_PKG_VERSION"
echo "Using stellar core version $(stellar-core version)"
# Docker-compose's remote contexts on Ubuntu 20 started failing with an OpenSSL versioning error.
# See https://stackoverflow.com/questions/66579446/error-executing-docker-compose-building-webserver-unable-to-prepare-context-un
- name: Work around Docker Compose problem
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y ca-certificates curl gnupg
# Install docker apt repo
sudo install -m 0755 -d /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
sudo chmod a+r /etc/apt/keyrings/docker.gpg
echo \
"deb [arch="$(dpkg --print-architecture)" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \
"$(. /etc/os-release && echo "$VERSION_CODENAME")" stable" | \
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install docker-compose v2 from apt repo
sudo apt-get update
sudo apt-get remove -y moby-compose
sudo apt-get install -y docker-compose-plugin
# add alias for docker compose
ln -f -s /usr/libexec/docker/cli-plugins/docker-compose /usr/local/bin/docker-compose
echo "Docker Compose Version:"
docker-compose version
- run: rustup update
- uses: stellar/actions/rust-cache@main
- run: make build-libs
- name: Run Soroban RPC Integration Tests
run: |
go test -race -timeout 20m ./cmd/soroban-rpc/internal/integrationtest/...