From 66566edd1edd8be7eb40b0f51d9f51a5c838cb82 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 16:40:38 +0900 Subject: [PATCH 01/29] =?UTF-8?q?[Feat]=20yml=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=84=B8=ED=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/upload_product.yml diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml new file mode 100644 index 0000000..c517162 --- /dev/null +++ b/.github/workflows/upload_product.yml @@ -0,0 +1,13 @@ +name: Upload Product + +on: + push: + branches: + - cd-automation + +jobs: + upload: + runs-on: macos-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 From 78c3866a1517e975ba642c49b673c0c95f2565ec Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 16:43:18 +0900 Subject: [PATCH 02/29] =?UTF-8?q?[Feat]=20Tuist=20=EC=84=A4=EC=B9=98=20?= =?UTF-8?q?=EB=AA=85=EB=A0=B9=EC=96=B4=20=EC=9E=85=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index c517162..3bc4835 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -11,3 +11,7 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 + + - name: Install Tuist + run: | + bash <(curl -Ls https://install.tuist.io) \ No newline at end of file From 207b1530e2f83748dca5ebc7cd7ab9802d6480b6 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 16:45:01 +0900 Subject: [PATCH 03/29] =?UTF-8?q?[Feat]=20=EC=9D=98=EC=A1=B4=EC=84=B1=20?= =?UTF-8?q?=EC=84=A4=EC=B9=98=20=EB=AA=85=EB=A0=B9=EC=96=B4=20=EC=9E=85?= =?UTF-8?q?=EB=A0=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 3bc4835..e5431a7 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -14,4 +14,8 @@ jobs: - name: Install Tuist run: | - bash <(curl -Ls https://install.tuist.io) \ No newline at end of file + bash <(curl -Ls https://install.tuist.io) + + - name: Install Dependencies + run: | + tuist install \ No newline at end of file From 2b65278154c5c8f88ae4b46dc7c94806e64e41b6 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 21:25:24 +0900 Subject: [PATCH 04/29] =?UTF-8?q?[Feat]=20Configuration=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EB=B0=B0=EC=B9=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index e5431a7..67cd4b3 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -6,8 +6,9 @@ on: - cd-automation jobs: - upload: + Distribute: runs-on: macos-latest + environment: Configuration Files steps: - name: Checkout code uses: actions/checkout@v4 @@ -16,6 +17,10 @@ jobs: run: | bash <(curl -Ls https://install.tuist.io) - - name: Install Dependencies + - name: Make Configuration File run: | - tuist install \ No newline at end of file + touch Release.xcconfig + echo ${{ secrets.RELEASE }} >> Release.xcconfig + mv Release.xcconfig cd EATSSU_MVC/EATSSU_MVC/Resources + + \ No newline at end of file From 3f02ad97db819c70ed8819f024bf49a70f6f51cd Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 21:28:04 +0900 Subject: [PATCH 05/29] =?UTF-8?q?[Feat]=20=ED=8C=8C=EC=9D=BC=20=EC=9C=84?= =?UTF-8?q?=EC=B9=98=20=EB=94=94=EB=B2=84=EA=B7=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 67cd4b3..63cdf75 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -13,6 +13,10 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Debug Directory Location + run: | + ls -la + - name: Install Tuist run: | bash <(curl -Ls https://install.tuist.io) From c7af88d9925be0e07d1286c379a8db8b6addedc8 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 22:43:50 +0900 Subject: [PATCH 06/29] =?UTF-8?q?[Feat]=20Configuration=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1=20=EC=8A=A4=ED=81=AC=EB=A6=BD?= =?UTF-8?q?=ED=8A=B8=20=EC=9E=AC=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 63cdf75..3851554 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -21,10 +21,16 @@ jobs: run: | bash <(curl -Ls https://install.tuist.io) - - name: Make Configuration File + - name: Create Release.xcconfig + env: + BASE_URL: ${{ secrets.BASE_URL }} + KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }} run: | - touch Release.xcconfig - echo ${{ secrets.RELEASE }} >> Release.xcconfig - mv Release.xcconfig cd EATSSU_MVC/EATSSU_MVC/Resources + echo "// Configuration settings file format documentation can be found at:" > Release.xcconfig + echo "// https://help.apple.com/xcode/#/dev745c5c974" >> Release.xcconfig + echo "// API 엔드 포인트 주소" >> Release.xcconfig + echo "BASE_URL = $BASE_URL" >> Release.xcconfig + echo "// 카카오 API 키" >> Release.xcconfig + echo "KAKAO_API_KEY = $KAKAO_API_KEY" >> Release.xcconfig \ No newline at end of file From c8d8668e18714683164ef4bf9c9c35263260c2b1 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 22:47:17 +0900 Subject: [PATCH 07/29] =?UTF-8?q?[Feat]=20cat=20&=20mv=20=EB=AA=85?= =?UTF-8?q?=EB=A0=B9=EC=96=B4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 3851554..fd18566 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -32,5 +32,7 @@ jobs: echo "BASE_URL = $BASE_URL" >> Release.xcconfig echo "// 카카오 API 키" >> Release.xcconfig echo "KAKAO_API_KEY = $KAKAO_API_KEY" >> Release.xcconfig + cat Release.xcconfig + mv Release.xcconfig EATSSU_MVC/EATSSU_MVC/Resources \ No newline at end of file From a0e46357a89192d83b9f95c09529f4b382f76a9a Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 22:51:24 +0900 Subject: [PATCH 08/29] =?UTF-8?q?[Feat]=20tuist-action=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index fd18566..2b59f56 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -13,6 +13,11 @@ jobs: - name: Checkout code uses: actions/checkout@v4 + - name: Checkout tuist + uses: tuist/tuist-action@0.13.0 + with: + command: "build" + - name: Debug Directory Location run: | ls -la From 96d6031adf4e605cf1f6e56191843d26b6505d3a Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 23:14:51 +0900 Subject: [PATCH 09/29] =?UTF-8?q?[Feat]=20tuist=20=EA=B3=B5=EC=8B=9D=20CI?= =?UTF-8?q?=20=EC=BD=94=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 2b59f56..fb69069 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -10,13 +10,8 @@ jobs: runs-on: macos-latest environment: Configuration Files steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Checkout tuist - uses: tuist/tuist-action@0.13.0 - with: - command: "build" + - uses: actions/checkout@v3 + - uses: jdx/mise-action@v2 - name: Debug Directory Location run: | @@ -40,4 +35,9 @@ jobs: cat Release.xcconfig mv Release.xcconfig EATSSU_MVC/EATSSU_MVC/Resources + - name: Tuist Build + run: | + tuist install + tuist build + \ No newline at end of file From 396f41bb9470d3aa105bab6469c103f47935847a Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 23:21:44 +0900 Subject: [PATCH 10/29] =?UTF-8?q?[Feat]=20Debug.xcconfig=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index fb69069..5bc58b5 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -35,6 +35,15 @@ jobs: cat Release.xcconfig mv Release.xcconfig EATSSU_MVC/EATSSU_MVC/Resources + echo "// Configuration settings file format documentation can be found at:" > Debug.xcconfig + echo "// https://help.apple.com/xcode/#/dev745c5c974" >> Debug.xcconfig + echo "// API 엔드 포인트 주소" >> Debug.xcconfig + echo "BASE_URL = $BASE_URL" >> Debug.xcconfig + echo "// 카카오 API 키" >> Debug.xcconfig + echo "KAKAO_API_KEY = $KAKAO_API_KEY" >> Debug.xcconfig + cat Debug.xcconfig + mv Debug.xcconfig EATSSU_MVC/EATSSU_MVC/Resources + - name: Tuist Build run: | tuist install From 023fb3a22f429370a8dd97dc7f254de2da9b2af9 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 23:27:08 +0900 Subject: [PATCH 11/29] =?UTF-8?q?[Feat]=20GitHub=20Action=20=EC=84=B8?= =?UTF-8?q?=EB=B6=84=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 5bc58b5..85ddd8a 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -44,9 +44,10 @@ jobs: cat Debug.xcconfig mv Debug.xcconfig EATSSU_MVC/EATSSU_MVC/Resources - - name: Tuist Build + - name: Install Dependencies run: | tuist install - tuist build - - \ No newline at end of file + + - name: Build Project + run: | + tuist build \ No newline at end of file From a25d3b07658736ab86129f11841fe47c778ac07d Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Fri, 13 Sep 2024 23:36:34 +0900 Subject: [PATCH 12/29] =?UTF-8?q?[Feat]=20qa=20=EB=B8=8C=EB=9E=9C=EC=B9=98?= =?UTF-8?q?=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/upload_product.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/upload_product.yml index 85ddd8a..cf5b6d6 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/upload_product.yml @@ -1,6 +1,10 @@ -name: Upload Product +name: Upload iOS App Product on: + pull_request: + branches: + - qa + push: branches: - cd-automation From 1d0de2cc6693e4dee974f44a0b2aa7c3a3a5df83 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sat, 14 Sep 2024 00:13:15 +0900 Subject: [PATCH 13/29] =?UTF-8?q?[Feat]=20=EC=A7=80=EC=86=8D=EC=A0=81=20?= =?UTF-8?q?=ED=86=B5=ED=95=A9=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C?= =?UTF-8?q?=EC=9A=B0=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/continuous-integration.yml | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 .github/workflows/continuous-integration.yml diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml new file mode 100644 index 0000000..b27f0af --- /dev/null +++ b/.github/workflows/continuous-integration.yml @@ -0,0 +1,49 @@ +name: Continuous Integration + +on: + pull_request: + branches: + - develop + +jobs: + Continuous_Integration: + runs-on: macos-latest + environment: Configuration Files + steps: + - uses: actions/checkout@v4 + - uses: jdx/mise-action@v2 + + - name: Install Tuist + run: | + bash <(curl -Ls https://install.tuist.io) + + - name: Create Release & Debug Configuration Files + env: + BASE_URL: ${{ secrets.BASE_URL }} + KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }} + run: | + echo "// Configuration settings file format documentation can be found at:" > Release.xcconfig + echo "// https://help.apple.com/xcode/#/dev745c5c974" >> Release.xcconfig + echo "// API 엔드 포인트 주소" >> Release.xcconfig + echo "BASE_URL = $BASE_URL" >> Release.xcconfig + echo "// 카카오 API 키" >> Release.xcconfig + echo "KAKAO_API_KEY = $KAKAO_API_KEY" >> Release.xcconfig + cat Release.xcconfig + mv Release.xcconfig EATSSU_MVC/EATSSU_MVC/Resources + + echo "// Configuration settings file format documentation can be found at:" > Debug.xcconfig + echo "// https://help.apple.com/xcode/#/dev745c5c974" >> Debug.xcconfig + echo "// API 엔드 포인트 주소" >> Debug.xcconfig + echo "BASE_URL = $BASE_URL" >> Debug.xcconfig + echo "// 카카오 API 키" >> Debug.xcconfig + echo "KAKAO_API_KEY = $KAKAO_API_KEY" >> Debug.xcconfig + cat Debug.xcconfig + mv Debug.xcconfig EATSSU_MVC/EATSSU_MVC/Resources + + - name: Install Dependencies + run: | + tuist install + + - name: Build Project + run: | + tuist build \ No newline at end of file From d4bfdfecdec21bb256d214139a55d21554f46eba Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sat, 14 Sep 2024 00:15:48 +0900 Subject: [PATCH 14/29] =?UTF-8?q?[Feat]=20cicd=20=EC=84=A4=EA=B3=84=20?= =?UTF-8?q?=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=9B=8C=ED=81=AC=ED=94=8C?= =?UTF-8?q?=EB=A1=9C=EC=9A=B0=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{upload_product.yml => cicd-automation.yml} | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) rename .github/workflows/{upload_product.yml => cicd-automation.yml} (89%) diff --git a/.github/workflows/upload_product.yml b/.github/workflows/cicd-automation.yml similarity index 89% rename from .github/workflows/upload_product.yml rename to .github/workflows/cicd-automation.yml index cf5b6d6..19bda3e 100644 --- a/.github/workflows/upload_product.yml +++ b/.github/workflows/cicd-automation.yml @@ -1,4 +1,4 @@ -name: Upload iOS App Product +name: CI/CD Automation on: pull_request: @@ -7,25 +7,21 @@ on: push: branches: - - cd-automation + - cicd-automation jobs: Distribute: runs-on: macos-latest environment: Configuration Files steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: jdx/mise-action@v2 - - name: Debug Directory Location - run: | - ls -la - - name: Install Tuist run: | bash <(curl -Ls https://install.tuist.io) - - name: Create Release.xcconfig + - name: Create Release & Debug Configuration Files env: BASE_URL: ${{ secrets.BASE_URL }} KAKAO_API_KEY: ${{ secrets.KAKAO_API_KEY }} From 2a88a703180b0267feae7074230e7388e5e59162 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sat, 14 Sep 2024 00:22:08 +0900 Subject: [PATCH 15/29] =?UTF-8?q?[Feat]=20Tuist=20=EC=84=A4=EC=B9=98=20?= =?UTF-8?q?=EB=AA=85=EB=A0=B9=EC=96=B4=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd-automation.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd-automation.yml b/.github/workflows/cicd-automation.yml index 19bda3e..50258e3 100644 --- a/.github/workflows/cicd-automation.yml +++ b/.github/workflows/cicd-automation.yml @@ -17,9 +17,9 @@ jobs: - uses: actions/checkout@v4 - uses: jdx/mise-action@v2 - - name: Install Tuist - run: | - bash <(curl -Ls https://install.tuist.io) + # - name: Install Tuist + # run: | + # bash <(curl -Ls https://install.tuist.io) - name: Create Release & Debug Configuration Files env: From b900e6578dd39675a8e451c29aa63e895d5e2ed3 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sat, 14 Sep 2024 19:40:19 +0900 Subject: [PATCH 16/29] =?UTF-8?q?[#48]=20XCTest=20=ED=94=84=EB=A0=88?= =?UTF-8?q?=EC=9E=84=EC=9B=8C=ED=81=AC=20=EA=B8=B0=EB=B3=B8=20=EC=84=A4?= =?UTF-8?q?=EC=A0=95=20=EA=B5=AC=EC=B6=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EATSSU_MVC/UITests/SampleTests.swift | 41 +++++++++++++++++++ .../UITests/Sources/UITests-Bridging-Header.h | 4 ++ .../EATSSU_MVC/UnitTests/SampleTests.swift | 35 ++++++++++++++++ EATSSU_MVC/Project.swift | 22 ++++++++++ 4 files changed, 102 insertions(+) create mode 100644 EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift create mode 100644 EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h create mode 100644 EATSSU_MVC/EATSSU_MVC/UnitTests/SampleTests.swift diff --git a/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift b/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift new file mode 100644 index 0000000..a70e889 --- /dev/null +++ b/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift @@ -0,0 +1,41 @@ +// +// SampleTests.swift +// UITests +// +// Created by Jiwoong CHOI on 9/14/24. +// + +import XCTest + +final class SampleTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + + // In UI tests it is usually best to stop immediately when a failure occurs. + continueAfterFailure = false + + // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // UI tests must launch the application that they test. + let app = XCUIApplication() + app.launch() + + // Use XCTAssert and related functions to verify your tests produce the correct results. + } + + func testLaunchPerformance() throws { + if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { + // This measures how long it takes to launch your application. + measure(metrics: [XCTApplicationLaunchMetric()]) { + XCUIApplication().launch() + } + } + } +} diff --git a/EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h b/EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h new file mode 100644 index 0000000..1b2cb5d --- /dev/null +++ b/EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h @@ -0,0 +1,4 @@ +// +// Use this file to import your target's public headers that you would like to expose to Swift. +// + diff --git a/EATSSU_MVC/EATSSU_MVC/UnitTests/SampleTests.swift b/EATSSU_MVC/EATSSU_MVC/UnitTests/SampleTests.swift new file mode 100644 index 0000000..3a5a738 --- /dev/null +++ b/EATSSU_MVC/EATSSU_MVC/UnitTests/SampleTests.swift @@ -0,0 +1,35 @@ +// +// SampleTests.swift +// EATSSUUnitTests +// +// Created by Jiwoong CHOI on 9/14/24. +// + +import XCTest + +final class SampleTests: XCTestCase { + + override func setUpWithError() throws { + // Put setup code here. This method is called before the invocation of each test method in the class. + } + + override func tearDownWithError() throws { + // Put teardown code here. This method is called after the invocation of each test method in the class. + } + + func testExample() throws { + // This is an example of a functional test case. + // Use XCTAssert and related functions to verify your tests produce the correct results. + // Any test you write for XCTest can be annotated as throws and async. + // Mark your test throws to produce an unexpected failure when your test encounters an uncaught error. + // Mark your test async to allow awaiting for asynchronous code to complete. Check the results with assertions afterwards. + } + + func testPerformanceExample() throws { + // This is an example of a performance test case. + self.measure { + // Put the code you want to measure the time of here. + } + } + +} diff --git a/EATSSU_MVC/Project.swift b/EATSSU_MVC/Project.swift index dc58937..9748422 100644 --- a/EATSSU_MVC/Project.swift +++ b/EATSSU_MVC/Project.swift @@ -85,5 +85,27 @@ let project = Project( ], settings: eatSSUSettings ), + .target( + /// UITests의 이름은 "앱 이름 + UiTests" 형식을 지켜야합니다. + name: "EATSSUUITests", + destinations: [.iPhone], + product: .uiTests, + bundleId: "com.EATSSU.UITests", + sources: ["EATSSU_MVC/UITests/**"], + dependencies: [ + .target(name: "EATSSU", condition: .none) + ] + ), + .target( + /// UnitTests의 이름은 "앱 이름 + Tests" 형식을 지켜야 합니다. + name: "EATSSUTests", + destinations: [.iPhone], + product: .unitTests, + bundleId: "com.EATSSU.UnitTests", + sources: ["EATSSU_MVC/UnitTests/**"], + dependencies: [ + .target(name: "EATSSU", condition: .none) + ] + ) ] ) From 5f0107a4a75baa86e1b7423564c501da4c6c105b Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sat, 14 Sep 2024 21:48:29 +0900 Subject: [PATCH 17/29] =?UTF-8?q?[#48]=20Fastlane=EC=9C=BC=EB=A1=9C=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A6=B0=EC=83=B7=20=EC=B4=AC=EC=98=81=20?= =?UTF-8?q?=EC=9E=90=EB=8F=99=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 5 +- .../EATSSU_MVC/UITests/SampleTests.swift | 49 ++- .../EATSSU_MVC/UITests/SnapshotHelper.swift | 313 ++++++++++++++++++ .../UITests/Sources/UITests-Bridging-Header.h | 4 - Gemfile | 3 + Gemfile.lock | 218 ++++++++++++ fastlane/Appfile | 6 + fastlane/Fastfile | 23 ++ fastlane/README.md | 32 ++ fastlane/Snapfile | 28 ++ fastlane/SnapshotHelper.swift | 313 ++++++++++++++++++ fastlane/report.xml | 18 + 12 files changed, 977 insertions(+), 35 deletions(-) create mode 100644 EATSSU_MVC/EATSSU_MVC/UITests/SnapshotHelper.swift delete mode 100644 EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h create mode 100644 Gemfile create mode 100644 Gemfile.lock create mode 100644 fastlane/Appfile create mode 100644 fastlane/Fastfile create mode 100644 fastlane/README.md create mode 100644 fastlane/Snapfile create mode 100644 fastlane/SnapshotHelper.swift create mode 100644 fastlane/report.xml diff --git a/.gitignore b/.gitignore index b01ae21..019dc1d 100644 --- a/.gitignore +++ b/.gitignore @@ -71,4 +71,7 @@ Tuist/.build ### Configurtion files ### *.xcconfig -*.plist \ No newline at end of file +*.plist + +### Fastlane ### +fastlane/screenshots \ No newline at end of file diff --git a/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift b/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift index a70e889..a93e39e 100644 --- a/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift +++ b/EATSSU_MVC/EATSSU_MVC/UITests/SampleTests.swift @@ -8,34 +8,23 @@ import XCTest final class SampleTests: XCTestCase { - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - - // In UI tests it is usually best to stop immediately when a failure occurs. - continueAfterFailure = false - - // In UI tests it’s important to set the initial state - such as interface orientation - required for your tests before they run. The setUp method is a good place to do this. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func testExample() throws { - // UI tests must launch the application that they test. - let app = XCUIApplication() - app.launch() - - // Use XCTAssert and related functions to verify your tests produce the correct results. - } - - func testLaunchPerformance() throws { - if #available(macOS 10.15, iOS 13.0, tvOS 13.0, watchOS 7.0, *) { - // This measures how long it takes to launch your application. - measure(metrics: [XCTApplicationLaunchMetric()]) { - XCUIApplication().launch() - } - } - } + + @MainActor + override func setUpWithError() throws { + continueAfterFailure = false + let app = XCUIApplication() + setupSnapshot(app) + app.launch() + } + + override func tearDownWithError() throws { + + } + + + /// 스크린샷 촬영 자동화 스크립트 입니다. + @MainActor + func testTakingSnapShot() { + snapshot("01_LoginScreen") + } } diff --git a/EATSSU_MVC/EATSSU_MVC/UITests/SnapshotHelper.swift b/EATSSU_MVC/EATSSU_MVC/UITests/SnapshotHelper.swift new file mode 100644 index 0000000..6dec130 --- /dev/null +++ b/EATSSU_MVC/EATSSU_MVC/UITests/SnapshotHelper.swift @@ -0,0 +1,313 @@ +// +// SnapshotHelper.swift +// Example +// +// Created by Felix Krause on 10/8/15. +// + +// ----------------------------------------------------- +// IMPORTANT: When modifying this file, make sure to +// increment the version number at the very +// bottom of the file to notify users about +// the new SnapshotHelper.swift +// ----------------------------------------------------- + +import Foundation +import XCTest + +@MainActor +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) +} + +@MainActor +func snapshot(_ name: String, waitForLoadingIndicator: Bool) { + if waitForLoadingIndicator { + Snapshot.snapshot(name) + } else { + Snapshot.snapshot(name, timeWaitingForIdle: 0) + } +} + +/// - Parameters: +/// - name: The name of the snapshot +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +@MainActor +func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + Snapshot.snapshot(name, timeWaitingForIdle: timeout) +} + +enum SnapshotError: Error, CustomDebugStringConvertible { + case cannotFindSimulatorHomeDirectory + case cannotRunOnPhysicalDevice + + var debugDescription: String { + switch self { + case .cannotFindSimulatorHomeDirectory: + return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." + case .cannotRunOnPhysicalDevice: + return "Can't use Snapshot on a physical device." + } + } +} + +@objcMembers +@MainActor +open class Snapshot: NSObject { + static var app: XCUIApplication? + static var waitForAnimations = true + static var cacheDirectory: URL? + static var screenshotsDirectory: URL? { + return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) + } + static var deviceLanguage = "" + static var currentLocale = "" + + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + + Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations + + do { + let cacheDir = try getCacheDirectory() + Snapshot.cacheDirectory = cacheDir + setLanguage(app) + setLocale(app) + setLaunchArguments(app) + } catch let error { + NSLog(error.localizedDescription) + } + } + + class func setLanguage(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("language.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] + } catch { + NSLog("Couldn't detect/set language...") + } + } + + class func setLocale(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("locale.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + currentLocale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + } catch { + NSLog("Couldn't detect/set locale...") + } + + if currentLocale.isEmpty && !deviceLanguage.isEmpty { + currentLocale = Locale(identifier: deviceLanguage).identifier + } + + if !currentLocale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(currentLocale)\""] + } + } + + class func setLaunchArguments(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") + app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] + + do { + let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) + let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) + let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count)) + let results = matches.map { result -> String in + (launchArguments as NSString).substring(with: result.range) + } + app.launchArguments += results + } catch { + NSLog("Couldn't detect/set launch_arguments...") + } + } + + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + if timeout > 0 { + waitForLoadingIndicatorToDisappear(within: timeout) + } + + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } + + #if os(OSX) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else + + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let screenshot = XCUIScreen.main.screenshot() + #if os(iOS) && !targetEnvironment(macCatalyst) + let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image + #else + let image = screenshot.image + #endif + + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + #if swift(<5.0) + try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) + #else + try image.pngData()?.write(to: path, options: .atomic) + #endif + } catch let error { + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) + } + #endif + } + + class func fixLandscapeOrientation(image: UIImage) -> UIImage { + #if os(watchOS) + return image + #else + if #available(iOS 10.0, *) { + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } + } else { + return image + } + #endif + } + + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { + #if os(tvOS) + return + #endif + + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element + let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) + _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) + } + + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" + // on OSX config is stored in /Users//Library + // and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) || arch(arm64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory + } + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) + #else + throw SnapshotError.cannotRunOnPhysicalDevice + #endif + } +} + +private extension XCUIElementAttributes { + var isNetworkLoadingIndicator: Bool { + if hasAllowListedIdentifier { return false } + + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) + let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) + + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize + } + + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + + return allowListedIdentifiers.contains(identifier) + } + + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { + if elementType == .statusBar { return true } + guard frame.origin == .zero else { return false } + + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) + let newStatusBarSize = CGSize(width: deviceWidth, height: 44) + + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) + } +} + +private extension XCUIElementQuery { + var networkLoadingIndicators: XCUIElementQuery { + let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isNetworkLoadingIndicator + } + + return self.containing(isNetworkLoadingIndicator) + } + + @MainActor + var deviceStatusBars: XCUIElementQuery { + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width + + let isStatusBar = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isStatusBar(deviceWidth) + } + + return self.containing(isStatusBar) + } +} + +private extension CGFloat { + func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool { + return numberA...numberB ~= self + } +} + +// Please don't remove the lines below +// They are used to detect outdated configuration files +// SnapshotHelperVersion [1.30] diff --git a/EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h b/EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h deleted file mode 100644 index 1b2cb5d..0000000 --- a/EATSSU_MVC/EATSSU_MVC/UITests/Sources/UITests-Bridging-Header.h +++ /dev/null @@ -1,4 +0,0 @@ -// -// Use this file to import your target's public headers that you would like to expose to Swift. -// - diff --git a/Gemfile b/Gemfile new file mode 100644 index 0000000..7a118b4 --- /dev/null +++ b/Gemfile @@ -0,0 +1,3 @@ +source "https://rubygems.org" + +gem "fastlane" diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..46d6fa1 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,218 @@ +GEM + remote: https://rubygems.org/ + specs: + CFPropertyList (3.0.7) + base64 + nkf + rexml + addressable (2.8.7) + public_suffix (>= 2.0.2, < 7.0) + artifactory (3.0.17) + atomos (0.1.3) + aws-eventstream (1.3.0) + aws-partitions (1.975.0) + aws-sdk-core (3.205.0) + aws-eventstream (~> 1, >= 1.3.0) + aws-partitions (~> 1, >= 1.651.0) + aws-sigv4 (~> 1.9) + jmespath (~> 1, >= 1.6.1) + aws-sdk-kms (1.91.0) + aws-sdk-core (~> 3, >= 3.205.0) + aws-sigv4 (~> 1.5) + aws-sdk-s3 (1.162.0) + aws-sdk-core (~> 3, >= 3.205.0) + aws-sdk-kms (~> 1) + aws-sigv4 (~> 1.5) + aws-sigv4 (1.9.1) + aws-eventstream (~> 1, >= 1.0.2) + babosa (1.0.4) + base64 (0.2.0) + claide (1.1.0) + colored (1.2) + colored2 (3.1.2) + commander (4.6.0) + highline (~> 2.0.0) + declarative (0.0.20) + digest-crc (0.6.5) + rake (>= 12.0.0, < 14.0.0) + domain_name (0.6.20240107) + dotenv (2.8.1) + emoji_regex (3.2.3) + excon (0.111.0) + faraday (1.10.3) + faraday-em_http (~> 1.0) + faraday-em_synchrony (~> 1.0) + faraday-excon (~> 1.1) + faraday-httpclient (~> 1.0) + faraday-multipart (~> 1.0) + faraday-net_http (~> 1.0) + faraday-net_http_persistent (~> 1.0) + faraday-patron (~> 1.0) + faraday-rack (~> 1.0) + faraday-retry (~> 1.0) + ruby2_keywords (>= 0.0.4) + faraday-cookie_jar (0.0.7) + faraday (>= 0.8.0) + http-cookie (~> 1.0.0) + faraday-em_http (1.0.0) + faraday-em_synchrony (1.0.0) + faraday-excon (1.1.0) + faraday-httpclient (1.0.1) + faraday-multipart (1.0.4) + multipart-post (~> 2) + faraday-net_http (1.0.2) + faraday-net_http_persistent (1.2.0) + faraday-patron (1.0.0) + faraday-rack (1.0.0) + faraday-retry (1.0.3) + faraday_middleware (1.2.0) + faraday (~> 1.0) + fastimage (2.3.1) + fastlane (2.222.0) + CFPropertyList (>= 2.3, < 4.0.0) + addressable (>= 2.8, < 3.0.0) + artifactory (~> 3.0) + aws-sdk-s3 (~> 1.0) + babosa (>= 1.0.3, < 2.0.0) + bundler (>= 1.12.0, < 3.0.0) + colored (~> 1.2) + commander (~> 4.6) + dotenv (>= 2.1.1, < 3.0.0) + emoji_regex (>= 0.1, < 4.0) + excon (>= 0.71.0, < 1.0.0) + faraday (~> 1.0) + faraday-cookie_jar (~> 0.0.6) + faraday_middleware (~> 1.0) + fastimage (>= 2.1.0, < 3.0.0) + gh_inspector (>= 1.1.2, < 2.0.0) + google-apis-androidpublisher_v3 (~> 0.3) + google-apis-playcustomapp_v1 (~> 0.1) + google-cloud-env (>= 1.6.0, < 2.0.0) + google-cloud-storage (~> 1.31) + highline (~> 2.0) + http-cookie (~> 1.0.5) + json (< 3.0.0) + jwt (>= 2.1.0, < 3) + mini_magick (>= 4.9.4, < 5.0.0) + multipart-post (>= 2.0.0, < 3.0.0) + naturally (~> 2.2) + optparse (>= 0.1.1, < 1.0.0) + plist (>= 3.1.0, < 4.0.0) + rubyzip (>= 2.0.0, < 3.0.0) + security (= 0.1.5) + simctl (~> 1.6.3) + terminal-notifier (>= 2.0.0, < 3.0.0) + terminal-table (~> 3) + tty-screen (>= 0.6.3, < 1.0.0) + tty-spinner (>= 0.8.0, < 1.0.0) + word_wrap (~> 1.0.0) + xcodeproj (>= 1.13.0, < 2.0.0) + xcpretty (~> 0.3.0) + xcpretty-travis-formatter (>= 0.0.3, < 2.0.0) + gh_inspector (1.1.3) + google-apis-androidpublisher_v3 (0.54.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-core (0.11.3) + addressable (~> 2.5, >= 2.5.1) + googleauth (>= 0.16.2, < 2.a) + httpclient (>= 2.8.1, < 3.a) + mini_mime (~> 1.0) + representable (~> 3.0) + retriable (>= 2.0, < 4.a) + rexml + google-apis-iamcredentials_v1 (0.17.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-playcustomapp_v1 (0.13.0) + google-apis-core (>= 0.11.0, < 2.a) + google-apis-storage_v1 (0.31.0) + google-apis-core (>= 0.11.0, < 2.a) + google-cloud-core (1.7.1) + google-cloud-env (>= 1.0, < 3.a) + google-cloud-errors (~> 1.0) + google-cloud-env (1.6.0) + faraday (>= 0.17.3, < 3.0) + google-cloud-errors (1.4.0) + google-cloud-storage (1.47.0) + addressable (~> 2.8) + digest-crc (~> 0.4) + google-apis-iamcredentials_v1 (~> 0.1) + google-apis-storage_v1 (~> 0.31.0) + google-cloud-core (~> 1.6) + googleauth (>= 0.16.2, < 2.a) + mini_mime (~> 1.0) + googleauth (1.8.1) + faraday (>= 0.17.3, < 3.a) + jwt (>= 1.4, < 3.0) + multi_json (~> 1.11) + os (>= 0.9, < 2.0) + signet (>= 0.16, < 2.a) + highline (2.0.3) + http-cookie (1.0.7) + domain_name (~> 0.5) + httpclient (2.8.3) + jmespath (1.6.2) + json (2.7.2) + jwt (2.8.2) + base64 + mini_magick (4.13.2) + mini_mime (1.1.5) + multi_json (1.15.0) + multipart-post (2.4.1) + nanaimo (0.3.0) + naturally (2.2.1) + nkf (0.2.0) + optparse (0.5.0) + os (1.1.4) + plist (3.7.1) + public_suffix (6.0.1) + rake (13.2.1) + representable (3.2.0) + declarative (< 0.1.0) + trailblazer-option (>= 0.1.1, < 0.2.0) + uber (< 0.2.0) + retriable (3.1.2) + rexml (3.3.7) + rouge (2.0.7) + ruby2_keywords (0.0.5) + rubyzip (2.3.2) + security (0.1.5) + signet (0.19.0) + addressable (~> 2.8) + faraday (>= 0.17.5, < 3.a) + jwt (>= 1.5, < 3.0) + multi_json (~> 1.10) + simctl (1.6.10) + CFPropertyList + naturally + terminal-notifier (2.0.0) + terminal-table (3.0.2) + unicode-display_width (>= 1.1.1, < 3) + trailblazer-option (0.1.2) + tty-cursor (0.7.1) + tty-screen (0.8.2) + tty-spinner (0.9.3) + tty-cursor (~> 0.7) + uber (0.1.0) + unicode-display_width (2.6.0) + word_wrap (1.0.0) + xcodeproj (1.25.0) + CFPropertyList (>= 2.3.3, < 4.0) + atomos (~> 0.1.3) + claide (>= 1.0.2, < 2.0) + colored2 (~> 3.1) + nanaimo (~> 0.3.0) + rexml (>= 3.3.2, < 4.0) + xcpretty (0.3.0) + rouge (~> 2.0.7) + xcpretty-travis-formatter (1.0.1) + xcpretty (~> 0.2, >= 0.0.7) + +PLATFORMS + arm64-darwin-23 + ruby + +DEPENDENCIES + fastlane + +BUNDLED WITH + 2.5.18 diff --git a/fastlane/Appfile b/fastlane/Appfile new file mode 100644 index 0000000..c352371 --- /dev/null +++ b/fastlane/Appfile @@ -0,0 +1,6 @@ +app_identifier("io.tuist.EATSSUComponents") # The bundle identifier of your app +# apple_id("[[APPLE_ID]]") # Your Apple Developer Portal username + + +# For more information about the Appfile, see: +# https://docs.fastlane.tools/advanced/#appfile diff --git a/fastlane/Fastfile b/fastlane/Fastfile new file mode 100644 index 0000000..35b17e0 --- /dev/null +++ b/fastlane/Fastfile @@ -0,0 +1,23 @@ +# This file contains the fastlane.tools configuration +# You can find the documentation at https://docs.fastlane.tools +# +# For a list of all available actions, check out +# +# https://docs.fastlane.tools/actions +# +# For a list of all available plugins, check out +# +# https://docs.fastlane.tools/plugins/available-plugins +# + +# Uncomment the line if you want fastlane to automatically update itself +# update_fastlane + +default_platform(:ios) + +platform :ios do + desc "Generate new localized screenshots" + lane :screenshots do + capture_screenshots(scheme: "EATSSU") + end +end diff --git a/fastlane/README.md b/fastlane/README.md new file mode 100644 index 0000000..a0e96bc --- /dev/null +++ b/fastlane/README.md @@ -0,0 +1,32 @@ +fastlane documentation +---- + +# Installation + +Make sure you have the latest version of the Xcode command line tools installed: + +```sh +xcode-select --install +``` + +For _fastlane_ installation instructions, see [Installing _fastlane_](https://docs.fastlane.tools/#installing-fastlane) + +# Available Actions + +## iOS + +### ios screenshots + +```sh +[bundle exec] fastlane ios screenshots +``` + +Generate new localized screenshots + +---- + +This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. + +More information about _fastlane_ can be found on [fastlane.tools](https://fastlane.tools). + +The documentation of _fastlane_ can be found on [docs.fastlane.tools](https://docs.fastlane.tools). diff --git a/fastlane/Snapfile b/fastlane/Snapfile new file mode 100644 index 0000000..17d4848 --- /dev/null +++ b/fastlane/Snapfile @@ -0,0 +1,28 @@ +# Uncomment the lines below you want to change by removing the # in the beginning + +# A list of devices you want to take the screenshots from +devices([ + "iPhone 15 Pro", +]) + +languages([ + "ko-KR", +]) + +# The name of the scheme which contains the UI Tests +scheme("EATSSU") + +# Where should the resulting screenshots be stored? +# output_directory("./screenshots") + +# remove the '#' to clear all previously generated screenshots before creating new ones +clear_previous_screenshots(true) + +# Remove the '#' to set the status bar to 9:41 AM, and show full battery and reception. See also override_status_bar_arguments for custom options. +override_status_bar(true) + +# Arguments to pass to the app on launch. See https://docs.fastlane.tools/actions/snapshot/#launch-arguments +# launch_arguments(["-favColor red"]) + +# For more information about all available options run +# fastlane action snapshot diff --git a/fastlane/SnapshotHelper.swift b/fastlane/SnapshotHelper.swift new file mode 100644 index 0000000..6dec130 --- /dev/null +++ b/fastlane/SnapshotHelper.swift @@ -0,0 +1,313 @@ +// +// SnapshotHelper.swift +// Example +// +// Created by Felix Krause on 10/8/15. +// + +// ----------------------------------------------------- +// IMPORTANT: When modifying this file, make sure to +// increment the version number at the very +// bottom of the file to notify users about +// the new SnapshotHelper.swift +// ----------------------------------------------------- + +import Foundation +import XCTest + +@MainActor +func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + Snapshot.setupSnapshot(app, waitForAnimations: waitForAnimations) +} + +@MainActor +func snapshot(_ name: String, waitForLoadingIndicator: Bool) { + if waitForLoadingIndicator { + Snapshot.snapshot(name) + } else { + Snapshot.snapshot(name, timeWaitingForIdle: 0) + } +} + +/// - Parameters: +/// - name: The name of the snapshot +/// - timeout: Amount of seconds to wait until the network loading indicator disappears. Pass `0` if you don't want to wait. +@MainActor +func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + Snapshot.snapshot(name, timeWaitingForIdle: timeout) +} + +enum SnapshotError: Error, CustomDebugStringConvertible { + case cannotFindSimulatorHomeDirectory + case cannotRunOnPhysicalDevice + + var debugDescription: String { + switch self { + case .cannotFindSimulatorHomeDirectory: + return "Couldn't find simulator home location. Please, check SIMULATOR_HOST_HOME env variable." + case .cannotRunOnPhysicalDevice: + return "Can't use Snapshot on a physical device." + } + } +} + +@objcMembers +@MainActor +open class Snapshot: NSObject { + static var app: XCUIApplication? + static var waitForAnimations = true + static var cacheDirectory: URL? + static var screenshotsDirectory: URL? { + return cacheDirectory?.appendingPathComponent("screenshots", isDirectory: true) + } + static var deviceLanguage = "" + static var currentLocale = "" + + open class func setupSnapshot(_ app: XCUIApplication, waitForAnimations: Bool = true) { + + Snapshot.app = app + Snapshot.waitForAnimations = waitForAnimations + + do { + let cacheDir = try getCacheDirectory() + Snapshot.cacheDirectory = cacheDir + setLanguage(app) + setLocale(app) + setLaunchArguments(app) + } catch let error { + NSLog(error.localizedDescription) + } + } + + class func setLanguage(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("language.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + deviceLanguage = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + app.launchArguments += ["-AppleLanguages", "(\(deviceLanguage))"] + } catch { + NSLog("Couldn't detect/set language...") + } + } + + class func setLocale(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("locale.txt") + + do { + let trimCharacterSet = CharacterSet.whitespacesAndNewlines + currentLocale = try String(contentsOf: path, encoding: .utf8).trimmingCharacters(in: trimCharacterSet) + } catch { + NSLog("Couldn't detect/set locale...") + } + + if currentLocale.isEmpty && !deviceLanguage.isEmpty { + currentLocale = Locale(identifier: deviceLanguage).identifier + } + + if !currentLocale.isEmpty { + app.launchArguments += ["-AppleLocale", "\"\(currentLocale)\""] + } + } + + class func setLaunchArguments(_ app: XCUIApplication) { + guard let cacheDirectory = self.cacheDirectory else { + NSLog("CacheDirectory is not set - probably running on a physical device?") + return + } + + let path = cacheDirectory.appendingPathComponent("snapshot-launch_arguments.txt") + app.launchArguments += ["-FASTLANE_SNAPSHOT", "YES", "-ui_testing"] + + do { + let launchArguments = try String(contentsOf: path, encoding: String.Encoding.utf8) + let regex = try NSRegularExpression(pattern: "(\\\".+?\\\"|\\S+)", options: []) + let matches = regex.matches(in: launchArguments, options: [], range: NSRange(location: 0, length: launchArguments.count)) + let results = matches.map { result -> String in + (launchArguments as NSString).substring(with: result.range) + } + app.launchArguments += results + } catch { + NSLog("Couldn't detect/set launch_arguments...") + } + } + + open class func snapshot(_ name: String, timeWaitingForIdle timeout: TimeInterval = 20) { + if timeout > 0 { + waitForLoadingIndicatorToDisappear(within: timeout) + } + + NSLog("snapshot: \(name)") // more information about this, check out https://docs.fastlane.tools/actions/snapshot/#how-does-it-work + + if Snapshot.waitForAnimations { + sleep(1) // Waiting for the animation to be finished (kind of) + } + + #if os(OSX) + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + app.typeKey(XCUIKeyboardKeySecondaryFn, modifierFlags: []) + #else + + guard self.app != nil else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let screenshot = XCUIScreen.main.screenshot() + #if os(iOS) && !targetEnvironment(macCatalyst) + let image = XCUIDevice.shared.orientation.isLandscape ? fixLandscapeOrientation(image: screenshot.image) : screenshot.image + #else + let image = screenshot.image + #endif + + guard var simulator = ProcessInfo().environment["SIMULATOR_DEVICE_NAME"], let screenshotsDir = screenshotsDirectory else { return } + + do { + // The simulator name contains "Clone X of " inside the screenshot file when running parallelized UI Tests on concurrent devices + let regex = try NSRegularExpression(pattern: "Clone [0-9]+ of ") + let range = NSRange(location: 0, length: simulator.count) + simulator = regex.stringByReplacingMatches(in: simulator, range: range, withTemplate: "") + + let path = screenshotsDir.appendingPathComponent("\(simulator)-\(name).png") + #if swift(<5.0) + try UIImagePNGRepresentation(image)?.write(to: path, options: .atomic) + #else + try image.pngData()?.write(to: path, options: .atomic) + #endif + } catch let error { + NSLog("Problem writing screenshot: \(name) to \(screenshotsDir)/\(simulator)-\(name).png") + NSLog(error.localizedDescription) + } + #endif + } + + class func fixLandscapeOrientation(image: UIImage) -> UIImage { + #if os(watchOS) + return image + #else + if #available(iOS 10.0, *) { + let format = UIGraphicsImageRendererFormat() + format.scale = image.scale + let renderer = UIGraphicsImageRenderer(size: image.size, format: format) + return renderer.image { context in + image.draw(in: CGRect(x: 0, y: 0, width: image.size.width, height: image.size.height)) + } + } else { + return image + } + #endif + } + + class func waitForLoadingIndicatorToDisappear(within timeout: TimeInterval) { + #if os(tvOS) + return + #endif + + guard let app = self.app else { + NSLog("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + return + } + + let networkLoadingIndicator = app.otherElements.deviceStatusBars.networkLoadingIndicators.element + let networkLoadingIndicatorDisappeared = XCTNSPredicateExpectation(predicate: NSPredicate(format: "exists == false"), object: networkLoadingIndicator) + _ = XCTWaiter.wait(for: [networkLoadingIndicatorDisappeared], timeout: timeout) + } + + class func getCacheDirectory() throws -> URL { + let cachePath = "Library/Caches/tools.fastlane" + // on OSX config is stored in /Users//Library + // and on iOS/tvOS/WatchOS it's in simulator's home dir + #if os(OSX) + let homeDir = URL(fileURLWithPath: NSHomeDirectory()) + return homeDir.appendingPathComponent(cachePath) + #elseif arch(i386) || arch(x86_64) || arch(arm64) + guard let simulatorHostHome = ProcessInfo().environment["SIMULATOR_HOST_HOME"] else { + throw SnapshotError.cannotFindSimulatorHomeDirectory + } + let homeDir = URL(fileURLWithPath: simulatorHostHome) + return homeDir.appendingPathComponent(cachePath) + #else + throw SnapshotError.cannotRunOnPhysicalDevice + #endif + } +} + +private extension XCUIElementAttributes { + var isNetworkLoadingIndicator: Bool { + if hasAllowListedIdentifier { return false } + + let hasOldLoadingIndicatorSize = frame.size == CGSize(width: 10, height: 20) + let hasNewLoadingIndicatorSize = frame.size.width.isBetween(46, and: 47) && frame.size.height.isBetween(2, and: 3) + + return hasOldLoadingIndicatorSize || hasNewLoadingIndicatorSize + } + + var hasAllowListedIdentifier: Bool { + let allowListedIdentifiers = ["GeofenceLocationTrackingOn", "StandardLocationTrackingOn"] + + return allowListedIdentifiers.contains(identifier) + } + + func isStatusBar(_ deviceWidth: CGFloat) -> Bool { + if elementType == .statusBar { return true } + guard frame.origin == .zero else { return false } + + let oldStatusBarSize = CGSize(width: deviceWidth, height: 20) + let newStatusBarSize = CGSize(width: deviceWidth, height: 44) + + return [oldStatusBarSize, newStatusBarSize].contains(frame.size) + } +} + +private extension XCUIElementQuery { + var networkLoadingIndicators: XCUIElementQuery { + let isNetworkLoadingIndicator = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isNetworkLoadingIndicator + } + + return self.containing(isNetworkLoadingIndicator) + } + + @MainActor + var deviceStatusBars: XCUIElementQuery { + guard let app = Snapshot.app else { + fatalError("XCUIApplication is not set. Please call setupSnapshot(app) before snapshot().") + } + + let deviceWidth = app.windows.firstMatch.frame.width + + let isStatusBar = NSPredicate { (evaluatedObject, _) in + guard let element = evaluatedObject as? XCUIElementAttributes else { return false } + + return element.isStatusBar(deviceWidth) + } + + return self.containing(isStatusBar) + } +} + +private extension CGFloat { + func isBetween(_ numberA: CGFloat, and numberB: CGFloat) -> Bool { + return numberA...numberB ~= self + } +} + +// Please don't remove the lines below +// They are used to detect outdated configuration files +// SnapshotHelperVersion [1.30] diff --git a/fastlane/report.xml b/fastlane/report.xml new file mode 100644 index 0000000..8a9598c --- /dev/null +++ b/fastlane/report.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + From 41da02e2d3ee9f3d270801ecebe50b8fab20bbd1 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 09:09:05 +0900 Subject: [PATCH 18/29] =?UTF-8?q?[#48]=20Fastlane=20=EB=8F=84=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd-automation.yml | 21 ++++++++++++++------- fastlane/report.xml | 4 ++-- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/.github/workflows/cicd-automation.yml b/.github/workflows/cicd-automation.yml index 50258e3..30d7540 100644 --- a/.github/workflows/cicd-automation.yml +++ b/.github/workflows/cicd-automation.yml @@ -1,21 +1,20 @@ -name: CI/CD Automation +name: CI/CD Automation Tests on: - pull_request: - branches: - - qa - push: branches: - cicd-automation jobs: - Distribute: + CICD_Automation_Tests: runs-on: macos-latest environment: Configuration Files steps: - uses: actions/checkout@v4 - uses: jdx/mise-action@v2 + - uses: ruby/setup-ruby@v1 + with: + ruby-version: 2.7.2 # - name: Install Tuist # run: | @@ -50,4 +49,12 @@ jobs: - name: Build Project run: | - tuist build \ No newline at end of file + tuist build + + - name: Run Tests via Tuist + run: | + tuist test + + - name: Run Tests via Fastlane + run: | + fastlane tests \ No newline at end of file diff --git a/fastlane/report.xml b/fastlane/report.xml index 8a9598c..8cb1708 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,12 @@ - + - + From 7d67d7e8a4f23f316370b8c312f491aed8cb0c55 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 09:13:44 +0900 Subject: [PATCH 19/29] [#48] Install fastlane via ruby --- .github/workflows/cicd-automation.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cicd-automation.yml b/.github/workflows/cicd-automation.yml index 30d7540..cd74117 100644 --- a/.github/workflows/cicd-automation.yml +++ b/.github/workflows/cicd-automation.yml @@ -14,11 +14,11 @@ jobs: - uses: jdx/mise-action@v2 - uses: ruby/setup-ruby@v1 with: - ruby-version: 2.7.2 + ruby-version: 3.3.0 - # - name: Install Tuist - # run: | - # bash <(curl -Ls https://install.tuist.io) + - name: Install Ruby Dependencies + run: | + bundle install - name: Create Release & Debug Configuration Files env: From 7c718c9d3876a6dc7c048e89a391feb7f32171b7 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 09:38:56 +0900 Subject: [PATCH 20/29] [#48] Specify Testing Device --- .github/workflows/cicd-automation.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cicd-automation.yml b/.github/workflows/cicd-automation.yml index cd74117..1164783 100644 --- a/.github/workflows/cicd-automation.yml +++ b/.github/workflows/cicd-automation.yml @@ -53,7 +53,7 @@ jobs: - name: Run Tests via Tuist run: | - tuist test + tuist test EATSSU --device "iPhone 15 Pro" - name: Run Tests via Fastlane run: | From 652ce3e11751e4c9eafb0cf5e0fb514792840903 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 09:40:17 +0900 Subject: [PATCH 21/29] =?UTF-8?q?[#48]=20develop=EC=97=90=EC=84=9C=20qa?= =?UTF-8?q?=EB=A1=9C=20CI=20=EB=8C=80=EC=83=81=20=EB=B8=8C=EB=9E=9C?= =?UTF-8?q?=EC=B9=98=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/continuous-integration.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index b27f0af..49dcd67 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -3,7 +3,7 @@ name: Continuous Integration on: pull_request: branches: - - develop + - qa jobs: Continuous_Integration: From 1dc70e46c578f06e8eb6e4d27e8fc1dc2a02540c Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 10:43:43 +0900 Subject: [PATCH 22/29] =?UTF-8?q?[#48]=20Tuist=20test=20=EB=AA=85=EB=A0=B9?= =?UTF-8?q?=EC=96=B4=20=EC=A0=9C=EA=B1=B0=20&=20Fastlane=20test=20?= =?UTF-8?q?=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80=EC=82=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd-automation.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/cicd-automation.yml b/.github/workflows/cicd-automation.yml index 1164783..09b6ad7 100644 --- a/.github/workflows/cicd-automation.yml +++ b/.github/workflows/cicd-automation.yml @@ -51,10 +51,6 @@ jobs: run: | tuist build - - name: Run Tests via Tuist - run: | - tuist test EATSSU --device "iPhone 15 Pro" - - name: Run Tests via Fastlane run: | fastlane tests \ No newline at end of file From e82059936b3172d3fc03d92260a947ed0a05f225 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 10:59:55 +0900 Subject: [PATCH 23/29] =?UTF-8?q?[#48]=20=EB=88=84=EB=9D=BD=EB=90=9C=20lan?= =?UTF-8?q?e=20tests=20=EB=AA=85=EB=A0=B9=EC=96=B4=20=EA=B8=B0=EC=9E=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastlane/Fastfile | 5 +++++ fastlane/report.xml | 7 +------ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 35b17e0..921d288 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -20,4 +20,9 @@ platform :ios do lane :screenshots do capture_screenshots(scheme: "EATSSU") end + + desc "Run tests" + lane :tests do + run_tests(scheme: "EATSSU") + end end diff --git a/fastlane/report.xml b/fastlane/report.xml index 8cb1708..2c30bed 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,7 @@ - - - - - - + From 074163e0beec81fb2dd364d3fc71851813753781 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 11:23:32 +0900 Subject: [PATCH 24/29] =?UTF-8?q?[#48]=20faslane=20tests=20=EA=B0=84=20?= =?UTF-8?q?=EB=94=94=EB=B0=94=EC=9D=B4=EC=8A=A4=20=EB=AA=85=EC=8B=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 3 ++- fastlane/Fastfile | 5 ++++- fastlane/README.md | 8 ++++++++ fastlane/report.xml | 7 ++++++- 4 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 019dc1d..e9ed061 100644 --- a/.gitignore +++ b/.gitignore @@ -74,4 +74,5 @@ Tuist/.build *.plist ### Fastlane ### -fastlane/screenshots \ No newline at end of file +fastlane/screenshots +fastlane/test_output \ No newline at end of file diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 921d288..8ca4f10 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -23,6 +23,9 @@ platform :ios do desc "Run tests" lane :tests do - run_tests(scheme: "EATSSU") + run_tests( + devices: ["iPhone 15 Pro"], + scheme: "EATSSU", + ) end end diff --git a/fastlane/README.md b/fastlane/README.md index a0e96bc..70bc3cb 100644 --- a/fastlane/README.md +++ b/fastlane/README.md @@ -23,6 +23,14 @@ For _fastlane_ installation instructions, see [Installing _fastlane_](https://do Generate new localized screenshots +### ios tests + +```sh +[bundle exec] fastlane ios tests +``` + +Run tests + ---- This README.md is auto-generated and will be re-generated every time [_fastlane_](https://fastlane.tools) is run. diff --git a/fastlane/report.xml b/fastlane/report.xml index 2c30bed..c1ff6de 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,7 +5,12 @@ - + + + + + + From 79c567ca669a0e5a69ccbf5d7ffb4c52f37bf237 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 11:47:32 +0900 Subject: [PATCH 25/29] =?UTF-8?q?[#48]=20Fastlane=20=EC=84=A4=EC=B9=98=20?= =?UTF-8?q?=EC=8A=A4=ED=81=AC=EB=A6=BD=ED=8A=B8=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cicd-automation.yml | 4 ++++ fastlane/report.xml | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cicd-automation.yml b/.github/workflows/cicd-automation.yml index 09b6ad7..2a181c6 100644 --- a/.github/workflows/cicd-automation.yml +++ b/.github/workflows/cicd-automation.yml @@ -16,6 +16,10 @@ jobs: with: ruby-version: 3.3.0 + - name: Install Fastlane + run: | + gem install fastlane + - name: Install Ruby Dependencies run: | bundle install diff --git a/fastlane/report.xml b/fastlane/report.xml index c1ff6de..2448ada 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,12 @@ - + - + From bbf26f60613e10a3af2c3806cfd2984280342a06 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Sun, 15 Sep 2024 14:34:46 +0900 Subject: [PATCH 26/29] =?UTF-8?q?[#48]=20EATSSUTests=20=ED=81=B4=EB=9E=98?= =?UTF-8?q?=EC=8A=A4=EB=A7=8C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fastlane/Fastfile | 1 + fastlane/report.xml | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 8ca4f10..4c254b5 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -26,6 +26,7 @@ platform :ios do run_tests( devices: ["iPhone 15 Pro"], scheme: "EATSSU", + only_testing: ["EATSSUTests"] ) end end diff --git a/fastlane/report.xml b/fastlane/report.xml index 2448ada..ab8532e 100644 --- a/fastlane/report.xml +++ b/fastlane/report.xml @@ -5,12 +5,12 @@ - + - + From d83f9d0123cc6f4363e5e018a5f386b80a1787e6 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Mon, 16 Sep 2024 16:33:49 +0900 Subject: [PATCH 27/29] =?UTF-8?q?[#55]=20=EC=8A=A4=EB=82=B5=EC=BD=94?= =?UTF-8?q?=EB=84=88=20=EB=A9=94=EB=89=B4=EB=AA=A9=EB=A1=9D=20=ED=99=9C?= =?UTF-8?q?=EC=84=B1=ED=99=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ViewController/HomeRestaurantViewController.swift | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift index c8e140f..4594357 100644 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift +++ b/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift @@ -138,13 +138,10 @@ final class HomeRestaurantViewController: BaseViewController { if time == TextLiteral.lunchRawValue { if !weekday.isWeekend { - getFixMenuData(restaurant: TextLiteral.foodCourtRawValue) {} -// getFixMenuData(restaurant: TextLiteral.snackCornerRawValue) {} + getFixMenuData(restaurant: TextLiteral.snackCornerRawValue) {} } else { - currentRestaurant = TextLiteral.foodCourtRawValue - self.fixMenuTableViewData[TextLiteral.foodCourtRawValue] = [MenuInformation(menuId: 0, name: "", mainRating: nil, price: nil)] -// currentRestaurant = TextLiteral.snackCornerRawValue -// self.fixMenuTableViewData[TextLiteral.snackCornerRawValue] = [MenuInformation(menuId: 0, name: "", mainRating: nil, price: nil)] + currentRestaurant = TextLiteral.snackCornerRawValue + self.fixMenuTableViewData[TextLiteral.snackCornerRawValue] = [MenuInformation(menuId: 0, name: "", mainRating: nil, price: nil)] } } } From 2663401b454e378355eed9a86cb7da53104f11d2 Mon Sep 17 00:00:00 2001 From: CJiu01 Date: Mon, 16 Sep 2024 16:40:04 +0900 Subject: [PATCH 28/29] =?UTF-8?q?[#55]=20=ED=91=B8=EB=93=9C=EC=BD=94?= =?UTF-8?q?=ED=8A=B8=20=ED=85=8C=EC=9D=B4=EB=B8=94=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Screen/Home/Enum/RestaurantLocation.swift | 70 ------------------- .../HomeRestaurantViewController.swift | 15 ---- .../Sources/Utility/Literal/TextLiteral.swift | 2 - 3 files changed, 87 deletions(-) delete mode 100644 EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/Enum/RestaurantLocation.swift diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/Enum/RestaurantLocation.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/Enum/RestaurantLocation.swift deleted file mode 100644 index dd9e894..0000000 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/Enum/RestaurantLocation.swift +++ /dev/null @@ -1,70 +0,0 @@ -// -// RestaurantLocation.swift -// EatSSU-iOS -// -// Created by 최지우 on 2023/07/24. -// - -import Foundation -import CoreLocation -import MapKit - -enum RestaurantLocation { - case dormitory - case dodam - case studentRestaurant - case foodCourt - case snackCorner - case soongsil - - var coordinate: CLLocationCoordinate2D { - switch self { - case .dormitory: - return CLLocationCoordinate2D(latitude: 37.4951, longitude: 126.9603) - case .dodam: - return CLLocationCoordinate2D(latitude: 37.4961, longitude: 126.9581) - case .studentRestaurant: - return CLLocationCoordinate2D(latitude: 37.4964, longitude: 126.9572) - case .foodCourt: - return CLLocationCoordinate2D(latitude: 37.4964, longitude: 126.9572) - case .snackCorner: - return CLLocationCoordinate2D(latitude: 37.4964, longitude: 126.9572) - case .soongsil: - return CLLocationCoordinate2D(latitude: 37.4964, longitude: 126.9572) - } - } - - var title: String { - switch self { - case .dormitory: - return TextLiteral.dormitoryRestaurant - case .dodam: - return TextLiteral.dodamRestaurant - case .studentRestaurant: - return TextLiteral.studentRestaurant - case .foodCourt: - return TextLiteral.foodCourt - case .snackCorner: - return TextLiteral.snackCorner - case .soongsil: - return "숭실대학교" - } - } -} - -func setMapView(mapView: MKMapView, for location: RestaurantLocation) { - let region = MKCoordinateRegion(center: location.coordinate, span: MKCoordinateSpan(latitudeDelta: 0.002, longitudeDelta: 0.002)) - - // Set the region on the map view - mapView.setRegion(region, animated: true) - - // Create a point annotation - let annotation = MKPointAnnotation() - // Set the coordinate of the annotation to be the location - annotation.coordinate = location.coordinate - // Optionally, add a title to the annotation - annotation.title = location.title - // Add the annotation to the map view - mapView.addAnnotation(annotation) - -} diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift index 4594357..f3833b1 100644 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift +++ b/EATSSU_MVC/EATSSU_MVC/Sources/Screen/Home/ViewController/HomeRestaurantViewController.swift @@ -32,12 +32,10 @@ final class HomeRestaurantViewController: BaseViewController { private let sectionHeaderRestaurant = [TextLiteral.dormitoryRestaurant, TextLiteral.dodamRestaurant, TextLiteral.studentRestaurant, - TextLiteral.foodCourt, TextLiteral.snackCorner] let restaurantButtonTitleToName = [TextLiteral.dormitoryRestaurant: "DORMITORY", TextLiteral.dodamRestaurant: "DODAM", TextLiteral.studentRestaurant: "HAKSIK", - TextLiteral.foodCourt: "FOOD_COURT", TextLiteral.snackCorner: "SNACK_CORNER"] var currentRestaurant = "" var isWeekend = false @@ -112,7 +110,6 @@ final class HomeRestaurantViewController: BaseViewController { let restaurantRawValue = [TextLiteral.dormitoryRawValue, TextLiteral.dodamRawValue, TextLiteral.studentRestaurantRawValue, - TextLiteral.foodCourtRawValue, TextLiteral.snackCornerRawValue] return restaurantRawValue.firstIndex(of: restaurant) } @@ -121,7 +118,6 @@ final class HomeRestaurantViewController: BaseViewController { let restaurantRawValue = [TextLiteral.dormitoryRawValue, TextLiteral.dodamRawValue, TextLiteral.studentRestaurantRawValue, - TextLiteral.foodCourtRawValue, TextLiteral.snackCornerRawValue] return restaurantRawValue[section] } @@ -197,17 +193,6 @@ extension HomeRestaurantViewController: UITableViewDataSource { cell.model = .change(data) } } else if indexPath.section == 3 { - if let data = fixMenuTableViewData[TextLiteral.foodCourtRawValue]?[indexPath.row - restaurantTableViewMenuTitleCellCount] { - if data.price != nil { - isSelectable = true - cell.model = .fix(data) - cell.selectionStyle = .default - } else { - isSelectable = false - cell.selectionStyle = .none - } - } - } else if indexPath.section == 4 { if let data = fixMenuTableViewData[TextLiteral.snackCornerRawValue]?[indexPath.row - restaurantTableViewMenuTitleCellCount] { if data.price != nil { isSelectable = true diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift index c658f60..b2afec2 100644 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift +++ b/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift @@ -34,12 +34,10 @@ enum TextLiteral { static let dormitoryRestaurant: String = "기숙사 식당" static let dodamRestaurant: String = "도담 식당" static let studentRestaurant: String = "학생 식당" - static let foodCourt: String = "푸드 코트" static let snackCorner: String = "스낵 코너" static let dormitoryRawValue: String = "DORMITORY" static let dodamRawValue: String = "DODAM" static let studentRestaurantRawValue: String = "HAKSIK" - static let foodCourtRawValue: String = "FOOD_COURT" static let snackCornerRawValue: String = "SNACK_CORNER" static let lunchRawValue: String = "LUNCH" From f43fc16236ec996ba13d3c25e9e99016849dd296 Mon Sep 17 00:00:00 2001 From: Jiwoong CHOI Date: Mon, 16 Sep 2024 22:26:30 +0900 Subject: [PATCH 29/29] =?UTF-8?q?[#1]=20=EC=8B=9C=EA=B0=84=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EC=95=8C=EB=A6=BC=20=EA=B8=B0=EB=8A=A5=20=EC=84=A4?= =?UTF-8?q?=EA=B3=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Notification/NotificationManager.swift | 108 +++++++++--------- .../Utility/Application/AppDelegate.swift | 63 +++++++--- .../Sources/Utility/Literal/TextLiteral.swift | 20 +++- 3 files changed, 119 insertions(+), 72 deletions(-) diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Notification/NotificationManager.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Notification/NotificationManager.swift index 2cdef55..d8a3d62 100644 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Notification/NotificationManager.swift +++ b/EATSSU_MVC/EATSSU_MVC/Sources/Notification/NotificationManager.swift @@ -9,63 +9,63 @@ import Foundation import UserNotifications class NotificationManager { - static let shared = NotificationManager() - - /// 지정된 시간에 알림을 발송하는 메소드 - func scheduleHelloWorldNotification() { - let content = UNMutableNotificationContent() - content.title = "Hello World" - content.body = "11시가 되었습니다!" - content.sound = .default - - var dateComponents = DateComponents() - dateComponents.hour = 11 - dateComponents.minute = 0 - - let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true) - - let request = UNNotificationRequest(identifier: "helloWorldNotification", content: content, trigger: trigger) - - UNUserNotificationCenter.current().add(request) { error in - if let error = error { - print("Hello World 알림 예약 실패: \(error.localizedDescription)") - } else { - print("Hello World 알림이 성공적으로 예약되었습니다.") - } + + // MARK: - Properties + + static let shared = NotificationManager() + + // MARK: - Methods + + /// 평일 11시에 앱의 유입을 유도하는 알림을 발송하는 메소드 + /// + /// - Title : 🤔 오늘 밥 뭐 먹지… + /// - Body : 오늘의 학식을 확인해보세요! + func scheduleWeekday11AMNotification() { + let center = UNUserNotificationCenter.current() + + // 알림 콘텐츠 설정 + let content = UNMutableNotificationContent() + + content.title = TextLiteral.Notification.dailyWeekdayNotificationTitle + content.body = TextLiteral.Notification.dailyWeekdayNotificationBody + content.sound = .default + + // 반복할 요일 및 시간 설정 (평일 오전 11시) + let calendar = Calendar.current + let weekdays = [2, 3, 4, 5, 6] // 월, 화, 수, 목, 금 (Calendar에서 1이 일요일) + + for weekday in weekdays { + var dateComponents = DateComponents() + dateComponents.hour = 11 + dateComponents.minute = 0 + dateComponents.weekday = weekday + + let trigger = UNCalendarNotificationTrigger(dateMatching: dateComponents, repeats: true) + + // 고유한 식별자를 위해 weekday를 사용 + let identifier = "weekdayNotification-\(weekday)" + let request = UNNotificationRequest( + identifier: identifier, content: content, trigger: trigger) + + // 알림 등록 + center.add(request) { error in + if let error = error { + print("알림 등록 간 에러 메시지: \(error.localizedDescription)") } + } } - + } + /// 앱 실행 시 알림 발송 권한을 요청하는 팝업 호출 메소드 - func requestAuthorization() { - UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { granted, error in - if granted { - print("알림 권한 승인됨") - } else { - print("알림 권한 거부됨") - } - } - } - - /// 개발자 도구 : 시뮬레이터에서 지속적으로 알림을 확인하기 위한 메소드 - /// - /// 해당 메소드는 배포 시 호출되면 안됩니다. - func scheduleTestNotification() { - let content = UNMutableNotificationContent() - content.title = "Hello World" - content.body = "테스트 알림입니다!" - content.sound = .default - - // 3초 후에 알림 발생 - let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 60, repeats: true) - - let request = UNNotificationRequest(identifier: "testNotification", content: content, trigger: trigger) - - UNUserNotificationCenter.current().add(request) { error in - if let error = error { - print("테스트 알림 예약 실패: \(error.localizedDescription)") - } else { - print("테스트 알림이 성공적으로 예약되었습니다.") - } + func requestNotificationPermission() { + UNUserNotificationCenter.current().requestAuthorization(options: [.alert, .sound, .badge]) { + granted, error in + if granted { + print("알림 권한 승인됨") + } else { + print("알림 권한 거부됨") } + } } + } diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Application/AppDelegate.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Application/AppDelegate.swift index 6b39750..ee2f852 100644 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Application/AppDelegate.swift +++ b/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Application/AppDelegate.swift @@ -15,15 +15,28 @@ import KakaoSDKCommon class AppDelegate: UIResponder, UIApplicationDelegate { func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool { + + // 푸시 알림 권한 요청 + NotificationManager.shared.requestNotificationPermission() + NotificationManager.shared.scheduleWeekday11AMNotification() + + /* + 해야 할 일 + - NetworkMonitor 클래스에 대한 문서화를 작성 + */ + + // 디버그 콘솔에서 네트워크 연결 상태 모니터링을 위한 메소드 + NetworkMonitor.shared.startMonitoring() - NetworkMonitor.shared.startMonitoring() - - FirebaseApp.configure() + // Firebase SDK를 사용하기 위한 처리 + FirebaseApp.configure() - let appleIDProvider = ASAuthorizationAppleIDProvider() + // Apple 사용자 인증을 위한 처리 + let appleIDProvider = ASAuthorizationAppleIDProvider() - //forUserID = userIdentifier - appleIDProvider.getCredentialState(forUserID: "001281.9301aaa1f617423c9c7a64b671b6eb84.0758") { (credentialState, error) in + //forUserID = userIdentifier + appleIDProvider.getCredentialState( + forUserID: "001281.9301aaa1f617423c9c7a64b671b6eb84.0758") { credentialState, error in switch credentialState { case .authorized: // The Apple ID credential is valid. @@ -38,27 +51,43 @@ class AppDelegate: UIResponder, UIApplicationDelegate { break } } - //앱 실행 중 강제로 연결 취소 시 - NotificationCenter.default.addObserver(forName: ASAuthorizationAppleIDProvider.credentialRevokedNotification, object: nil, queue: nil) { (Notification) in + + /* + 해야 할 일 + - "앱 실행 중 강제로 연결 취소 시" 동작하는 로직이 특별히 없는 것 같습니다. + - 최지우님 설명 부탁드립니다. 최지웅 작성. + */ + + //앱 실행 중 강제로 연결 취소 시 + NotificationCenter.default.addObserver( + forName: ASAuthorizationAppleIDProvider.credentialRevokedNotification, + object: nil, + queue: nil) { Notification in print("Revoked Notification") - // 로그인 페이지로 이동 } + // 카카오 SDK 사용을 위한 처리 let kakaoAPIKey = Bundle.main.object(forInfoDictionaryKey: "KAKAO API KEY") as! String KakaoSDK.initSDK(appKey: kakaoAPIKey) + + /* + 해야 할 일 + - 아래 전처리문에 대한 설명을 해주셨으면 합니다. + - 디버그 상황에서만 수행되는 코드인데, 왜 그런지 궁금하네요. + - 최지우님 설명 부탁드립니다. 최지웅 작성. + */ + + #if DEBUG + var newArguments = ProcessInfo.processInfo.arguments + newArguments.append("-FIRDebugEnabled") + ProcessInfo.processInfo.setValue(newArguments, forKey: "arguments") + #endif - #if DEBUG - var newArguments = ProcessInfo.processInfo.arguments - newArguments.append("-FIRDebugEnabled") - ProcessInfo.processInfo.setValue(newArguments, forKey: "arguments") - #endif - - sleep(1) + sleep(1) return true } - // MARK: UISceneSession Lifecycle func application(_ application: UIApplication, configurationForConnecting connectingSceneSession: UISceneSession, options: UIScene.ConnectionOptions) -> UISceneConfiguration { // Called when a new scene session is being created. diff --git a/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift b/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift index b2afec2..5cd7c42 100644 --- a/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift +++ b/EATSSU_MVC/EATSSU_MVC/Sources/Utility/Literal/TextLiteral.swift @@ -5,9 +5,27 @@ // Created by 최지우 on 2023/06/27. // -import UIKit +import Foundation + +/* + 해야 할 일 + - 하위 enum을 사용해서 세분화 + - 마크업 주석으로 해당 리터럴이 의미하는 실제 문자열 기록 + */ enum TextLiteral { + + // MARK: - Notification + + enum Notification { + + /// 🤔 오늘 밥 뭐 먹지… + static let dailyWeekdayNotificationTitle: String = "🤔 오늘 밥 뭐 먹지…" + + /// 오늘의 학식을 확인해보세요! + static let dailyWeekdayNotificationBody: String = "오늘의 학식을 확인해보세요!" + } + // MARK: - Sign In