Skip to content

Test Suite Architecture Refactoring #754

Test Suite Architecture Refactoring

Test Suite Architecture Refactoring #754

Workflow file for this run

name: Swift CI
on:
pull_request:
push:
branches: ['main']
defaults:
run:
shell: bash
permissions:
contents: read
jobs:
format:
name: Format (lint)
runs-on: hiero-client-sdk-linux-large
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f # v2.10.2
with:
egress-policy: audit
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Install system deps for Swift
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y \
git curl unzip xz-utils ca-certificates pkg-config \
clang libicu-dev libxml2-dev libsqlite3-dev zlib1g-dev \
libcurl4-openssl-dev libssl-dev
- name: Setup Swift (toolchain)
uses: SwiftyLab/setup-swift@4bbb093f8c68d1dee1caa8b67c681a3f8fe70a91 # v1.12.0
with:
swift-version: '5.9'
- name: Build swift-format
run: |
set -euxo pipefail
git clone --depth=1 https://github.com/apple/swift-format.git .swift-format-src
pushd .swift-format-src
swift build -c release
echo "$PWD/.build/release" >> $GITHUB_PATH
popd
swift-format --version || true
- name: Format (lint)
run: |
swift-format lint --strict --configuration .swift-format.json --recursive --parallel Sources/ Tests/ Examples/ Package.swift
test:
name: Build and Test SDK
strategy:
matrix:
swift: ["5.9", "5.10"]
runs-on: hiero-client-sdk-linux-large
env:
SOLO_CLUSTER_NAME: solo
SOLO_NAMESPACE: solo
SOLO_CLUSTER_SETUP_NAMESPACE: solo-cluster
SOLO_DEPLOYMENT: solo-deployment
KIND_IMAGE: kindest/node:v1.32.2 # pin to a stable image
steps:
- name: Harden Runner
uses: step-security/harden-runner@0080882f6c36860b6ba35c610c98ce87d4e2f26f
with:
egress-policy: audit
- name: Setup Swift
uses: SwiftyLab/setup-swift@4bbb093f8c68d1dee1caa8b67c681a3f8fe70a91 # v1.12.0
with:
swift-version: ${{ matrix.swift }}
- name: Checkout Code
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
- name: Cache SPM build dir
uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57
with:
path: .build
key: ${{ runner.os }}-${{ matrix.swift }}-spm-${{ github.job }}-${{ hashFiles('**/Package.resolved') }}
restore-keys: |
${{ runner.os }}-${{ matrix.swift }}-spm-
- name: Install system dependencies for Swift/gRPC
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get install -y \
git curl jq coreutils ca-certificates \
clang libicu-dev libxml2-dev libsqlite3-dev zlib1g-dev \
libcurl4-openssl-dev libssl-dev pkg-config \
protobuf-compiler
- name: Verify Swift installation
run: |
swift --version
which swift
swift package --version
- name: Build SDK and TCK
run: |
swift build
- name: Run unit tests (HieroUnitTests)
env:
HIERO_PROFILE: ciUnit
run: swift test --filter HieroUnitTests
- name: Prepare Hiero Solo
id: solo
uses: hiero-ledger/hiero-solo-action@6a1a77601cf3e69661fb6880530a4edf656b40d5 # v0.14.0
with:
installMirrorNode: true
mirrorNodeVersion: v0.142.0
hieroVersion: v0.68.0
- name: Run integration tests (HieroIntegrationTests)
env:
HIERO_PROFILE: ciIntegration
HIERO_OPERATOR_ID: 0.0.2
HIERO_OPERATOR_KEY: 302e020100300506032b65700422042091132178e72057a1d7528025956fe39b0b847f200ab59b2fdd367017f3087137
run: swift test --filter HieroIntegrationTests