Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS] Workspace & CI 적용 #129

Merged
merged 9 commits into from
Nov 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 44 additions & 48 deletions .github/workflows/Xcode_build_test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Xcode_build_test

env:
PACKAGES_JSON: '["MSCoreKit", "MSFoundation", "MSUIKit"]'
WORKSPACE: iOS/MusicSpot.xcworkspace

on:
pull_request:
Expand All @@ -14,7 +14,7 @@ jobs:
prepare-matrix:
runs-on: macos-13
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix: ${{ steps.generate-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v4

Expand All @@ -24,45 +24,21 @@ jobs:
with:
xcode-version: '15.0.1'

- name: Install jq
run: brew install jq

- name: Generate matrix
id: set-matrix
id: generate-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\"}"
for scheme in $(xcodebuild -workspace ${{ env.WORKSPACE }} -list | grep -A 100 "Schemes:" | grep -v "Schemes:" | sed '/^$/d' | sed 's/^[ \t]*//'); do
if [[ $scheme != *"-Package" ]] && [[ $scheme != *"Tests" ]]; then
if [ "$first_entry" = true ]; then
first_entry=false
else
matrix+=","
fi
done
cd ..
matrix+="{\"scheme\":\"$scheme\"}"
fi
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

Expand All @@ -82,11 +58,10 @@ jobs:
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 }}
echo "🛠️ Building ${{ matrix.scheme }}"
xcodebuild \
-workspace ${{ env.WORKSPACE }} \
-scheme ${{ matrix.scheme }} \
-sdk 'iphonesimulator' \
-destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' \
Expand All @@ -95,12 +70,33 @@ jobs:
prepare-test-matrix:
runs-on: macos-13
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
matrix: ${{ steps.generate-test-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
matrix="{\"package\": $PACKAGES_JSON}"
echo "matrix=$matrix" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4

- name: Setup Xcode
if: ${{ !env.ACT }}
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '15.0.1'

- name: Generate test matrix
id: generate-test-matrix
run: |
matrix="{\"include\":["
first_entry=true
for scheme in $(xcodebuild -workspace ${{ env.WORKSPACE }} -list | grep -A 100 "Schemes:" | grep -v "Schemes:" | sed '/^$/d' | sed 's/^[ \t]*//'); do
if [[ $scheme == *"Tests" ]]; then
if [ "$first_entry" = true ]; then
first_entry=false
else
matrix+=","
fi
matrix+="{\"scheme\":\"$scheme\"}"
fi
done
matrix+="]}"
echo "matrix=$matrix" >> $GITHUB_OUTPUT

xcode-test:
needs: prepare-test-matrix
Expand All @@ -117,12 +113,12 @@ jobs:
with:
xcode-version: '15.0.1'

- name: 🧪 Test ${{ matrix.package }}
- name: 🧪 Test ${{ matrix.scheme }}
run: |
echo "🧪 Testing ${{ matrix.package }}"
cd iOS/${{ matrix.package }}
echo "🧪 Testing ${{ matrix.scheme }}"
xcodebuild \
-scheme ${{ matrix.package }}-Package \
-workspace ${{ env.WORKSPACE }} \
-scheme ${{ matrix.scheme }} \
-sdk 'iphonesimulator' \
-destination 'platform=iOS Simulator,OS=17.0.1,name=iPhone 15 Pro' \
clean test
test
8 changes: 8 additions & 0 deletions iOS/Features/HomeMap/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
18 changes: 18 additions & 0 deletions iOS/Features/HomeMap/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "HomeMap",
platforms: [
.iOS(.v15)
],
products: [
.library(name: "HomeMap",
targets: ["HomeMap"])
],
targets: [
.target(name: "HomeMap")
]
)
2 changes: 2 additions & 0 deletions iOS/Features/HomeMap/Sources/HomeMap/HomeMap.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
8 changes: 8 additions & 0 deletions iOS/Features/JourneyList/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
27 changes: 27 additions & 0 deletions iOS/Features/JourneyList/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "JourneyList",
platforms: [
.iOS(.v15)
],
products: [
.library(name: "JourneyList",
targets: ["JourneyList"])
],
dependencies: [
.package(name: "MSData",
path: "../../MSData"),
.package(name: "MSUIKit",
path: "../../MSUIKit"),
.package(name: "MSNetworking",
path: "../../MSCoreKit")
],
targets: [
.target(name: "JourneyList",
dependencies: ["MSData", "MSUIKit", "MSNetworking"])
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
8 changes: 8 additions & 0 deletions iOS/Features/RecordJourney/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
18 changes: 18 additions & 0 deletions iOS/Features/RecordJourney/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "RecordJourney",
platforms: [
.iOS(.v15)
],
products: [
.library(name: "RecordJourney",
targets: ["RecordJourney"])
],
targets: [
.target(name: "RecordJourney")
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
8 changes: 8 additions & 0 deletions iOS/Features/RewindJourney/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
56 changes: 56 additions & 0 deletions iOS/Features/RewindJourney/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// swift-tools-version: 5.9
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

// MARK: - Constants

extension String {
static let package = "RewindJourney"
static let rewindJourney = "RewindJourney"
static let msUIKit = "MSUIKit"
static let msFoundation = "MSFoundation"
static let msDesignsystem = "MSDesignSystem"
static let msLogger = "MSLogger"

var testTarget: String {
return self + "Tests"
}

var path: String {
return "../../" + self
}

var featurePath: String {
return "../Features/" + self
}

}

// MARK: - Package

let package = Package(
name: .package,
platforms: [
.iOS(.v15)
],
products: [
.library(name: .rewindJourney,
targets: [.rewindJourney])
],
dependencies: [
.package(path: .msUIKit.path),
.package(path: .msFoundation.path)
],
targets: [
// Codes
.target(name: .rewindJourney,
dependencies: [
.product(name: .msUIKit, package: .msUIKit),
.product(name: .msDesignsystem, package: .msUIKit),
.product(name: .msLogger, package: .msFoundation)
])

// Tests
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
// The Swift Programming Language
// https://docs.swift.org/swift-book
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import XCTest
@testable import RewindJourney

final class RewindJourneyTests: XCTestCase {
func testExample() throws {
// XCTest Documentation
// https://developer.apple.com/documentation/xctest

// Defining Test Cases and Test Methods
// https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods
}
}
8 changes: 8 additions & 0 deletions iOS/Features/SaveJourney/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.DS_Store
/.build
/Packages
xcuserdata/
DerivedData/
.swiftpm/configuration/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>IDEDidComputeMac32BitWarning</key>
<true/>
</dict>
</plist>
Loading