chore(ci): harden CI + roadmap for fearless-utils hygiene #3188
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: Codecov Fearless | |
| on: | |
| pull_request: | |
| branches: | |
| - develop | |
| jobs: | |
| build: | |
| runs-on: macOS-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Configure GitHub auth for private pods (optional) | |
| env: | |
| GH_READ_TOKEN: ${{ secrets.GH_READ_TOKEN }} | |
| run: | | |
| if [ -n "$GH_READ_TOKEN" ]; then | |
| echo "Using GH_READ_TOKEN for authenticated access to soramitsu/*" | |
| git config --global url."https://${GH_READ_TOKEN}:[email protected]/soramitsu/".insteadOf "https://github.com/soramitsu/" | |
| else | |
| echo "GH_READ_TOKEN not set; proceeding without GitHub auth" | |
| fi | |
| - name: Bootstrap Dependencies | |
| run: | | |
| bash scripts/ci/bootstrap.sh | |
| - name: Build & Test (Simulator) | |
| run: | | |
| set -o pipefail | |
| # Resolve SPM into a stable workspace path and patch after resolve | |
| SP_DIR="$PWD/SourcePackages" | |
| mkdir -p "$SP_DIR" | |
| xcodebuild -resolvePackageDependencies \ | |
| -workspace fearless.xcworkspace \ | |
| -scheme fearless \ | |
| -clonedSourcePackagesDirPath "$SP_DIR" | |
| # Apply patches on the resolved checkout | |
| bash scripts/spm-shared-features-fixes.sh "$(pwd)" || true | |
| echo "Preflight: checking remaining 'enum AddressFactory' in $SP_DIR checkouts (warn-only)" | |
| if command -v rg >/dev/null 2>&1; then | |
| rg -n "\\benum\\s+AddressFactory\\b" "$SP_DIR/checkouts/shared-features-spm/Sources" -S | sed -n '1,120p' || true | |
| else | |
| /usr/bin/grep -RInE "(^|[^A-Za-z0-9_])enum[[:space:]]+AddressFactory(\b|[^.])" "$SP_DIR/checkouts/shared-features-spm/Sources" | sed -n '1,120p' || true | |
| fi | |
| echo "Preflight: checking SSFPolkaswap addressFactory type annotations" | |
| if command -v rg >/dev/null 2>&1; then | |
| if rg -n "addressFactory\s*:\s*([A-Za-z_]+\.)?AddressFactory(\b|[^.])" "$SP_DIR/checkouts/shared-features-spm/Sources/SSFPolkaswap" -S >/dev/null 2>&1; then | |
| echo "WARNING: addressFactory annotations still using AddressFactory (not .Type):" >&2 | |
| rg -n "addressFactory\s*:\s*([A-Za-z_]+\.)?AddressFactory(\b|[^.])" "$SP_DIR/checkouts/shared-features-spm/Sources/SSFPolkaswap" -S | sed -n '1,120p' >&2 || true | |
| fi | |
| else | |
| if /usr/bin/grep -RInE "addressFactory\s*:\s*([A-Za-z_]+\.)?AddressFactory(\b|[^.])" "$SP_DIR/checkouts/shared-features-spm/Sources/SSFPolkaswap" >/dev/null 2>&1; then | |
| echo "WARNING: addressFactory annotations still using AddressFactory (not .Type) [grep]:" >&2 | |
| /usr/bin/grep -RInE "addressFactory\s*:\s*([A-Za-z_]+\.)?AddressFactory(\b|[^.])" "$SP_DIR/checkouts/shared-features-spm/Sources/SSFPolkaswap" | sed -n '1,120p' >&2 || true | |
| fi | |
| fi | |
| # Prefer iPhone 16; otherwise pick the first available iPhone and use its UDID | |
| PREFERRED_NAME="iPhone 16" | |
| echo "Available simulators:" && xcrun simctl list devices | sed -n '1,80p' | |
| # Try to find an exact match by name with available state | |
| UDID=$(xcrun simctl list devices available | awk -v name="$PREFERRED_NAME" -F '[()]' '$0 ~ name {print $2; exit}') | |
| if [ -z "$UDID" ]; then | |
| # Fallback to any iPhone device | |
| UDID=$(xcrun simctl list devices available | awk -F '[()]' '/iPhone/ {print $2; exit}') | |
| fi | |
| if [ -z "$UDID" ]; then | |
| echo "No concrete iPhone simulator found; exiting" >&2 | |
| exit 1 | |
| fi | |
| echo "Using simulator id: $UDID" | |
| xcodebuild \ | |
| -workspace fearless.xcworkspace \ | |
| -scheme fearless.tests \ | |
| -clonedSourcePackagesDirPath "$SP_DIR" \ | |
| -destination "id=$UDID" \ | |
| build test | xcpretty --test | |
| - name: Upload coverage to Codecov | |
| run: bash <(curl -s https://codecov.io/bash) -J 'fearless' |