diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..f511307c --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,22 @@ +name: CI + +on: + pull_request: + branches: [develop, main] + +concurrency: + group: ci-${{ github.ref }} + cancel-in-progress: true + +jobs: + format: + name: SwiftFormat lint + runs-on: macos-latest + steps: + - uses: actions/checkout@v4 + + - name: Install SwiftFormat + run: brew install swiftformat + + - name: Run SwiftFormat (lint mode) + run: swiftformat --lint . diff --git a/DesignSystem/Asset+Alias.swift b/DesignSystem/Asset+Alias.swift index b2a22f26..f53b782c 100644 --- a/DesignSystem/Asset+Alias.swift +++ b/DesignSystem/Asset+Alias.swift @@ -2,14 +2,14 @@ import SwiftUI public typealias Asset = DesignSystemAsset -public extension Image { - init(_ asset: DesignSystemImages) { +extension Image { + public init(_ asset: DesignSystemImages) { self.init(asset: asset) } } -public extension Color { - init(_ asset: DesignSystemColors) { +extension Color { + public init(_ asset: DesignSystemColors) { self.init(asset: asset) } } diff --git a/FeaturesTests/FeaturesTests.swift b/FeaturesTests/FeaturesTests.swift new file mode 100644 index 00000000..a3eb2115 --- /dev/null +++ b/FeaturesTests/FeaturesTests.swift @@ -0,0 +1,8 @@ +import XCTest +@testable import Features + +final class FeaturesTests: XCTestCase { + func testPlaceholder() { + XCTAssertTrue(true) + } +} diff --git a/MyI/Tests/MyITests.swift b/MyI/Tests/MyITests.swift new file mode 100644 index 00000000..70eb43ba --- /dev/null +++ b/MyI/Tests/MyITests.swift @@ -0,0 +1,8 @@ +import XCTest +@testable import MyI + +final class MyITests: XCTestCase { + func testPlaceholder() { + XCTAssertTrue(true) + } +} diff --git a/Project.swift b/Project.swift index 30982578..509d12b6 100644 --- a/Project.swift +++ b/Project.swift @@ -126,6 +126,28 @@ let project = Project( "TARGETED_DEVICE_FAMILY": "1" ] ) + ), + .target( + name: "FeaturesTests", + destinations: .iOS, + product: .unitTests, + bundleId: "kr.co.codegrove.FeaturesTests", + deploymentTargets: .iOS("17.0"), + sources: ["FeaturesTests/**/*.swift"], + dependencies: [ + .target(name: "Features") + ] + ), + .target( + name: "MyITests", + destinations: .iOS, + product: .unitTests, + bundleId: "kr.co.codegrove.MyITests", + deploymentTargets: .iOS("17.0"), + sources: ["MyI/Tests/**/*.swift"], + dependencies: [ + .target(name: "MyI") + ] ) ] ) diff --git a/ci_scripts/ci_post_clone.sh b/ci_scripts/ci_post_clone.sh new file mode 100755 index 00000000..cf25676d --- /dev/null +++ b/ci_scripts/ci_post_clone.sh @@ -0,0 +1,23 @@ +#!/bin/sh +set -eu + +# Xcode Cloud post-clone hook +# Tuist 프로젝트라 xcodebuild 호출 전에 xcodeproj/xcworkspace 생성이 필요. +# - GoogleService-Info.plist 복원 (Environment Variable에서) +# - Tuist 설치 +# - SPM 의존성 fetch +# - xcodeproj/xcworkspace 생성 + +# Repo root로 이동 (ci_scripts/에서 한 단계 위) +cd "$(dirname "$0")/.." + +# GoogleService-Info.plist 복원 (.gitignore라 repo에 없음) +# Xcode Cloud Environment Variable `GOOGLE_SERVICE_INFO_PLIST_BASE64`에서 디코딩. +# 로컬 빌드는 이미 plist 있으니 변수 없으면 skip. +if [ -n "${GOOGLE_SERVICE_INFO_PLIST_BASE64:-}" ]; then + echo "$GOOGLE_SERVICE_INFO_PLIST_BASE64" | base64 --decode > MyI/Resources/GoogleService-Info.plist +fi + +brew install tuist +tuist install +tuist generate --no-open