From 7c555d7638f7fce1449ed4d5243333fc59a5987c Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 11 Oct 2023 17:57:44 -0400 Subject: [PATCH] fix: split CLI tests and normal go tests so they can run concurrently --- .../setup-integration-tests/action.yml | 61 +++++++++++++++++++ .github/workflows/soroban-rpc.yml | 56 ++--------------- 2 files changed, 66 insertions(+), 51 deletions(-) create mode 100644 .github/actions/setup-integration-tests/action.yml diff --git a/.github/actions/setup-integration-tests/action.yml b/.github/actions/setup-integration-tests/action.yml new file mode 100644 index 000000000..938acb6d4 --- /dev/null +++ b/.github/actions/setup-integration-tests/action.yml @@ -0,0 +1,61 @@ +name: 'Set up integration tests' +description: 'Set up Go & Rust, build artifacts, work around cache issues and Ubuntu quirks' +inputs: + go-version: + required: true +runs: + using: "composite" + steps: + - uses: ./.github/actions/setup-go + with: + go-version: ${{ matrix.go }} + - uses: stellar/actions/rust-cache@main + - name: Build soroban contract fixtures + shell: bash + run: | + rustup update + rustup target add wasm32-unknown-unknown + make build_rust + make build-test-wasms + + - 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_20_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 + + echo "Docker Compose Version:" + docker-compose version + + - name: Build libpreflight + shell: bash + run: make build-libpreflight diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index 95daa3e1e..99dc6fc40 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -102,15 +102,17 @@ jobs: integration: name: Integration tests + continue-on-error: true strategy: matrix: os: [ubuntu-20.04] go: [1.20.1] + test: ['.*CLI.*', '^Test(([^C])|(C[^L])|(CL[^I])).*$'] + runs-on: ${{ matrix.os }} env: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.13.1-1481.3acf6dd26.focal - runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v3 with: @@ -119,57 +121,9 @@ jobs: # 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 + - uses: ./.github/actions/setup-integration-tests with: go-version: ${{ matrix.go }} - - uses: stellar/actions/rust-cache@main - - name: Build soroban contract fixtures - run: | - rustup update - rustup target add wasm32-unknown-unknown - make build_rust - make build-test-wasms - - - name: Install Captive Core - 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_20_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 - 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 - - echo "Docker Compose Version:" - docker-compose version - - - name: Build libpreflight - run: make build-libpreflight - - name: Run Soroban RPC Integration Tests run: | - go test -race -timeout 25m -v ./cmd/soroban-rpc/internal/test/... + go test -race -run '${{ matrix.test }}' -timeout 60m -v ./cmd/soroban-rpc/internal/test/...