Skip to content

Fix ledger range calculation #729

Fix ledger range calculation

Fix ledger range calculation #729

Workflow file for this run

name: Soroban RPC
defaults:
run:
shell: bash
on:
push:
branches: [ main, release/** ]
pull_request:
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-libpreflight
- 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-libpreflight
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.0.1-1897.dfd3dbff1.focal
PROTOCOL_20_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:21.0.1-1897.dfd3dbff1.focal
PROTOCOL_21_CORE_DEBIAN_PKG_VERSION: 21.0.1-1897.dfd3dbff1.focal
PROTOCOL_21_CORE_DOCKER_IMG: stellar/unsafe-stellar-core:21.0.1-1897.dfd3dbff1.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-libpreflight
- name: Run Soroban RPC Integration Tests
run: |
go test -race -timeout 20m ./cmd/soroban-rpc/internal/integrationtest/...