Handle long version when git ref is not available. #4366
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Ledger Emulator Tests | |
| on: | |
| push: | |
| branches: [ main, release/** ] | |
| pull_request: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }} | |
| cancel-in-progress: true | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| emulator-tests: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| sys: | |
| # x64 | |
| - ubuntu-latest-8-cores | |
| # ARM | |
| - ubuntu-jammy-8-cores-arm64 | |
| # Apple Large Intel (this runner has better support to nested virtualization) | |
| # - macos-15-large (temporarily until the runner becomes more reliable. To be re-enabled in https://github.com/stellar/stellar-cli/issues/2299) | |
| exclude: | |
| # Only run Linux x64 on non-release PRs to save CI minutes | |
| - sys: ${{ github.event_name != 'push' && !startsWith(github.ref_name, 'release/') && 'ubuntu-jammy-8-cores-arm64' }} | |
| - sys: ${{ github.event_name != 'push' && !startsWith(github.ref_name, 'release/') && 'macos-15-large' }} | |
| runs-on: ${{ matrix.sys }} | |
| env: | |
| CI_TESTS: true | |
| TEST_THREADS: ${{ contains(matrix.sys, 'macos') && '--test-threads=1' || '' }} # macOS has limited resources, so we run tests (that rely on `testcontainers`) with 1 thread | |
| steps: | |
| - uses: actions/checkout@v5 | |
| - uses: stellar/actions/rust-cache@main | |
| - name: Install Colima & Docker | |
| if: runner.os == 'macos' | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| shell: bash | |
| run: | | |
| echo "::group::Installing Colima & Docker" | |
| brew install colima docker | |
| echo "::endgroup::" | |
| - name: Start Colima | |
| if: runner.os == 'macos' | |
| shell: bash | |
| run: | | |
| echo "::group::Starting Colima" | |
| CPU_COUNT=$(sysctl -n hw.ncpu) | |
| TOTAL_MEMORY=$(sysctl hw.memsize | awk '{print $2/1024/1024/1024}') | |
| MEMORY=$(awk "BEGIN {printf \"%.0f\", $TOTAL_MEMORY * 0.75}") | |
| echo "CPU_COUNT: $CPU_COUNT" | |
| echo "TOTAL_MEMORY: $TOTAL_MEMORY" | |
| colima start --arch x86_64 --vm-type=vz --mount-type=9p --cpu $CPU_COUNT --memory $TOTAL_MEMORY | |
| export DOCKER_HOST=unix:///Users/runner/.colima/default/docker.sock | |
| echo "DOCKER_HOST=unix:///Users/runner/.colima/default/docker.sock" >> $GITHUB_ENV | |
| echo "::endgroup::" | |
| - name: install optional dependencies (Linux only) | |
| run: sudo apt update && sudo apt install -y libudev-dev libdbus-1-dev | |
| if: runner.os == 'Linux' | |
| - run: RUST_BACKTRACE=1 cargo test --manifest-path cmd/crates/stellar-ledger/Cargo.toml --features "emulator-tests" -- --nocapture $TEST_THREADS | |
| - run: RUST_BACKTRACE=1 cargo build --features emulator-tests,additional-libs | |
| - run: RUST_BACKTRACE=1 cargo test --features emulator-tests --package soroban-test --test it -- emulator $TEST_THREADS |