diff --git a/.github/workflows/Xcode_build_test.yml b/.github/workflows/Xcode_build_test.yml new file mode 100644 index 0000000..d61884a --- /dev/null +++ b/.github/workflows/Xcode_build_test.yml @@ -0,0 +1,128 @@ +name: Xcode_build_test + +env: + PACKAGES_JSON: '["MSCoreKit", "MSFoundation", "MSUIKit"]' + +on: + pull_request: + branches: + - 'iOS/release' + - 'iOS/epic/**' + types: [assigned, labeled, opened, synchronize, reopened] + +jobs: + prepare-matrix: + runs-on: macos-13 + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - uses: actions/checkout@v4 + + - name: Setup Xcode + if: ${{ !env.ACT }} + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.0.1' + + - name: Install jq + run: brew install jq + + - name: Generate matrix + id: set-matrix + run: | + cd iOS + matrix="{\"include\":[" + packages=$(echo $PACKAGES_JSON | jq -r '.[]') + first_entry=true + for package in $packages; do + cd $package + for scheme in $(xcodebuild -list | grep -E '^[[:space:]]*Schemes:' -A 10 | tail -n +2 | grep -v '^$'); do + if [[ $scheme != *"-Package" ]] && [[ $scheme != *"Tests" ]]; then + if [ "$first_entry" = true ]; then + first_entry=false + else + matrix+="," + fi + matrix+="{\"package\":\"$package\", \"scheme\":\"$scheme\"}" + fi + done + cd .. + done + # cd Features + # for package in JourneyList SaveJourney; do + # cd $package + # for scheme in $(xcodebuild -list | grep -E '^[[:space:]]*Schemes:' -A 10 | tail -n +2 | grep -v '^$'); do + # if [[ $scheme != *"-Package" ]]; then + # if [ "$first_entry" = true ]; then + # first_entry=false + # else + # matrix+="," + # fi + # matrix+="{\"package\":\"$package\", \"scheme\":\"$scheme\"}" + # fi + # done + # cd .. + # done + matrix+="]}" + echo "matrix=$matrix" >> $GITHUB_OUTPUT + + xcode-build: + needs: prepare-matrix + runs-on: macos-13 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.prepare-matrix.outputs.matrix)}} + steps: + - uses: actions/checkout@v4 + + - name: Setup Xcode + if: ${{ !env.ACT }} + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.0.1' + + - name: 🛠️ Build ${{ matrix.scheme }} + if: ${{ !contains(matrix.scheme, 'Tests') }} + run: | + echo "🛠️ Building ${{ matrix.package }} - Scheme: ${{ matrix.scheme }}" + cd iOS/${{ matrix.package }} + xcodebuild \ + -scheme ${{ matrix.scheme }} \ + -sdk 'iphonesimulator' \ + -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' \ + clean build + + prepare-test-matrix: + runs-on: macos-13 + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - id: set-matrix + run: | + matrix="{\"package\": $PACKAGES_JSON}" + echo "matrix=$matrix" >> $GITHUB_OUTPUT + + xcode-test: + needs: prepare-test-matrix + runs-on: macos-13 + strategy: + fail-fast: false + matrix: ${{fromJson(needs.prepare-test-matrix.outputs.matrix)}} + steps: + - uses: actions/checkout@v4 + + - name: Setup Xcode + if: ${{ !env.ACT }} + uses: maxim-lobanov/setup-xcode@v1 + with: + xcode-version: '15.0.1' + + - name: 🧪 Test ${{ matrix.package }} + run: | + echo "🧪 Testing ${{ matrix.package }}" + cd iOS/${{ matrix.package }} + xcodebuild \ + -scheme ${{ matrix.package }}-Package \ + -sdk 'iphonesimulator' \ + -destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' \ + clean test diff --git a/iOS/Features/SaveJourney/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata b/iOS/Features/SaveJourney/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata new file mode 100644 index 0000000..919434a --- /dev/null +++ b/iOS/Features/SaveJourney/.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSCacheStorage.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSCacheStorage.xcscheme new file mode 100644 index 0000000..1113d29 --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSCacheStorage.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSCacheStorageTests.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSCacheStorageTests.xcscheme new file mode 100644 index 0000000..326b091 --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSCacheStorageTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSFoundation/.swiftpm/xcode/xcshareddata/xcschemes/MSFoundation.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSFetcher.xcscheme similarity index 88% rename from iOS/MSFoundation/.swiftpm/xcode/xcshareddata/xcschemes/MSFoundation.xcscheme rename to iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSFetcher.xcscheme index b683dc0..1e30232 100644 --- a/iOS/MSFoundation/.swiftpm/xcode/xcshareddata/xcschemes/MSFoundation.xcscheme +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSFetcher.xcscheme @@ -14,9 +14,9 @@ buildForAnalyzing = "YES"> @@ -49,9 +49,9 @@ diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSFetcherTests.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSFetcherTests.xcscheme new file mode 100644 index 0000000..f299dc2 --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSFetcherTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSNetworking.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSNetworking.xcscheme new file mode 100644 index 0000000..f6fba4e --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSNetworking.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSNetworkingTests.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSNetworkingTests.xcscheme new file mode 100644 index 0000000..5e9ef94 --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSNetworkingTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSPersistentStorage.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSPersistentStorage.xcscheme new file mode 100644 index 0000000..273d1d1 --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSPersistentStorage.xcscheme @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSPersistentStorageTests.xcscheme b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSPersistentStorageTests.xcscheme new file mode 100644 index 0000000..e9cfe80 --- /dev/null +++ b/iOS/MSCoreKit/.swiftpm/xcode/xcshareddata/xcschemes/MSPersistentStorageTests.xcscheme @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/MSCoreKit/Package.swift b/iOS/MSCoreKit/Package.swift index 2317ccd..e044c96 100644 --- a/iOS/MSCoreKit/Package.swift +++ b/iOS/MSCoreKit/Package.swift @@ -53,13 +53,13 @@ let package = Package( // Tests .testTarget(name: .persistentStorage.testTarget, - dependencies: [.target(name: .persistentStorage)]), + dependencies: ["MSPersistentStorage"]), .testTarget(name: .networking.testTarget, - dependencies: [.target(name: .networking)]), + dependencies: ["MSNetworking"]), .testTarget(name: .fetcher.testTarget, - dependencies: [.target(name: .fetcher)]), + dependencies: ["MSFetcher"]), .testTarget(name: .cache.testTarget, - dependencies: [.target(name: .cache)]) + dependencies: ["MSCacheStorage"]) ], swiftLanguageVersions: [.v5] ) diff --git a/iOS/MSCoreKit/Tests/MSNetworkingTests/MSNetworkingTests.swift b/iOS/MSCoreKit/Tests/MSNetworkingTests/MSNetworkingTests.swift index 7016b29..0f8e587 100644 --- a/iOS/MSCoreKit/Tests/MSNetworkingTests/MSNetworkingTests.swift +++ b/iOS/MSCoreKit/Tests/MSNetworkingTests/MSNetworkingTests.swift @@ -14,10 +14,10 @@ final class MSNetworkingTests: XCTestCase { private var subscriber: Set = [] func test_get_JourneyDTO_성공() { - //Arrange + // Arrange let getJourneyRouter = MockRouterType().getJourney - //Act + // Act mockNetworking.request(mockRouter: getJourneyRouter, type: JourneyDTO.self) .sink { response in switch response { @@ -26,10 +26,10 @@ final class MSNetworkingTests: XCTestCase { default: return } - } receiveValue: { JourneyDTO in + } receiveValue: { journeyDTO in - //Assert - XCTAssertNotNil(JourneyDTO) + // Assert + XCTAssertNotNil(journeyDTO) } .store(in: &subscriber) } diff --git a/iOS/MSCoreKit/Tests/MSNetworkingTests/Mock/MockMSNetworking.swift b/iOS/MSCoreKit/Tests/MSNetworkingTests/Mock/MockMSNetworking.swift index cf6bd34..fd3dc61 100644 --- a/iOS/MSCoreKit/Tests/MSNetworkingTests/Mock/MockMSNetworking.swift +++ b/iOS/MSCoreKit/Tests/MSNetworkingTests/Mock/MockMSNetworking.swift @@ -13,9 +13,9 @@ import Combine public class MockMSNetworking { var expectedSuccessJourneyGetPublisher: Result.Publisher { - let journey = JourneyDTO(JourneyIdentifier: UUID(), + let journey = JourneyDTO(journeyIdentifier: UUID(), title: "", - metaData: JourneyMetadataDTO(date: Date()), + metaData: JourneyMetadataDTO(date: .now), spots: [], coordinates: [], song: nil, @@ -24,10 +24,10 @@ public class MockMSNetworking { guard let jsonData = try? JSONEncoder().encode(journey) else { return Just(Data()).setFailureType(to: Error.self) } - + let request = Just(jsonData) .setFailureType(to: Error.self) - + return request } @@ -41,11 +41,10 @@ public class MockMSNetworking { } return publisher.tryMap { result -> T in - let value = try JSONDecoder().decode(T.self, from: result) - return value - } - .eraseToAnyPublisher() + let value = try JSONDecoder().decode(T.self, from: result) + return value + } + .eraseToAnyPublisher() } } - diff --git a/iOS/MSFoundation/.swiftpm/xcode/xcshareddata/xcschemes/MSFoundation-Package.xcscheme b/iOS/MSFoundation/.swiftpm/xcode/xcshareddata/xcschemes/MSFoundation-Package.xcscheme deleted file mode 100644 index 38b856f..0000000 --- a/iOS/MSFoundation/.swiftpm/xcode/xcshareddata/xcschemes/MSFoundation-Package.xcscheme +++ /dev/null @@ -1,144 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/iOS/MSUIKit/Package.swift b/iOS/MSUIKit/Package.swift index 6286996..7254471 100644 --- a/iOS/MSUIKit/Package.swift +++ b/iOS/MSUIKit/Package.swift @@ -32,8 +32,10 @@ let package = Package( // Codes .target(name: .designSystem), .target(name: .components, - dependencies: [.target(name: .designSystem)]) + dependencies: [.target(name: .designSystem)]), // Tests + .testTarget(name: .designSystem.testTarget, + dependencies: ["MSDesignSystem"]) ], swiftLanguageVersions: [.v5] ) diff --git a/iOS/MSUIKit/Tests/MSDesignSystemTests/MSDesignSystemTests.swift b/iOS/MSUIKit/Tests/MSDesignSystemTests/MSDesignSystemTests.swift new file mode 100644 index 0000000..7eebb79 --- /dev/null +++ b/iOS/MSUIKit/Tests/MSDesignSystemTests/MSDesignSystemTests.swift @@ -0,0 +1,10 @@ +// +// MSDesignSystemTests.swift +// MSUIKit +// +// Created by 이창준 on 11/26/23. +// + +import XCTest + +final class MSDesignSystemTests: XCTestCase { } diff --git a/iOS/MSUIKit/Tests/gitkeep b/iOS/MSUIKit/Tests/gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/iOS/MusicSpot.xcworkspace/contents.xcworkspacedata b/iOS/MusicSpot.xcworkspace/contents.xcworkspacedata index e854475..8cad135 100644 --- a/iOS/MusicSpot.xcworkspace/contents.xcworkspacedata +++ b/iOS/MusicSpot.xcworkspace/contents.xcworkspacedata @@ -2,15 +2,21 @@ + location = "group:Features/JourneyList"> + location = "group:Features/SaveJourney"> + location = "group:MusicSpot/MusicSpot.xcodeproj"> + + + +