From fda7ee0c7fce4ec24ad52b973e8b400560ae59b1 Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Mon, 2 Sep 2024 19:44:52 +0530 Subject: [PATCH 01/10] Added CI for unit test to run in github workflow --- .github/workflows/pr_ci.yaml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/pr_ci.yaml diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml new file mode 100644 index 00000000..9c05fe4e --- /dev/null +++ b/.github/workflows/pr_ci.yaml @@ -0,0 +1,25 @@ +name: Swift Unit Test CI + +on: + pull_request: + branches: + - main + types: [opened, reopened, synchronize] + +jobs: + test: + runs-on: macos-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Xcode + uses: maxim-lobanov/setup-xcode@v2 + with: + xcode-version: latest + + - name: Build and Test + run: | + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' clean build test + From 3df2ef970007cb6b47253b69346d5aafb9842fdb Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 09:08:52 +0530 Subject: [PATCH 02/10] Modified xcode version to run the test --- .github/workflows/pr_ci.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index 9c05fe4e..f0f768b7 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -15,9 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Xcode - uses: maxim-lobanov/setup-xcode@v2 - with: - xcode-version: latest + uses: sudo xcode-select -switch /Applications/Xcode_15.4.app - name: Build and Test run: | From 613dab28aa5208203fc86175280f4f10eceb7b2c Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 09:14:06 +0530 Subject: [PATCH 03/10] Selected default xcode path --- .github/workflows/pr_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index f0f768b7..2f2e3484 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Xcode - uses: sudo xcode-select -switch /Applications/Xcode_15.4.app + uses: xcode-select /Applications/Xcode.app - name: Build and Test run: | From 9da8104adda06361b41581545fa415dc46f319db Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 09:18:00 +0530 Subject: [PATCH 04/10] Made use of run command instead of uses --- .github/workflows/pr_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index 2f2e3484..1bd96864 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Xcode - uses: xcode-select /Applications/Xcode.app + run: sudo xcode-select -switch /Applications/Xcode_15.app - name: Build and Test run: | From 28560bbcd773fc31e192c20ad8d23c11531159af Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 09:20:12 +0530 Subject: [PATCH 05/10] Run default xcode --- .github/workflows/pr_ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index 1bd96864..095c453d 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -15,7 +15,7 @@ jobs: uses: actions/checkout@v3 - name: Set up Xcode - run: sudo xcode-select -switch /Applications/Xcode_15.app + run: sudo xcode-select -switch /Applications/Xcode.app - name: Build and Test run: | From 4686c810b851c93ce114838faeae95aaa9c72d23 Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 09:25:46 +0530 Subject: [PATCH 06/10] Enabled the scheme to be testable --- .../xcshareddata/xcschemes/Scribe.xcscheme | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Scribe.xcodeproj/xcshareddata/xcschemes/Scribe.xcscheme b/Scribe.xcodeproj/xcshareddata/xcschemes/Scribe.xcscheme index 00127fdc..7a617573 100644 --- a/Scribe.xcodeproj/xcshareddata/xcschemes/Scribe.xcscheme +++ b/Scribe.xcodeproj/xcshareddata/xcschemes/Scribe.xcscheme @@ -28,6 +28,16 @@ selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" shouldUseLaunchSchemeArgsEnv = "YES"> + + + + Date: Tue, 3 Sep 2024 09:45:03 +0530 Subject: [PATCH 07/10] Added caching of derived data and run build and test separately --- .github/workflows/pr_ci.yaml | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index 095c453d..4baea257 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -17,7 +17,19 @@ jobs: - name: Set up Xcode run: sudo xcode-select -switch /Applications/Xcode.app - - name: Build and Test + - name: Cache DerivedData + uses: actions/cache@v3 + with: + path: ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-xcode-${{ hashFiles('**/*.swift', '**/project.pbxproj') }} + restore-keys: | + ${{ runner.os }}-xcode- + + - name: Build + run: | + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' clean build + + - name: Test run: | - xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' clean build test + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' test From 9148204b99ea23b5372b06427d10f06d30391341 Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 10:19:58 +0530 Subject: [PATCH 08/10] revert caching step --- .github/workflows/pr_ci.yaml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index 4baea257..072f4bf4 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -17,14 +17,6 @@ jobs: - name: Set up Xcode run: sudo xcode-select -switch /Applications/Xcode.app - - name: Cache DerivedData - uses: actions/cache@v3 - with: - path: ~/Library/Developer/Xcode/DerivedData - key: ${{ runner.os }}-xcode-${{ hashFiles('**/*.swift', '**/project.pbxproj') }} - restore-keys: | - ${{ runner.os }}-xcode- - - name: Build run: | xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' clean build From ee84bd5a511b7f36d545a711883fd0b5e2c339b8 Mon Sep 17 00:00:00 2001 From: FabulouiOS-monk Date: Tue, 3 Sep 2024 18:54:54 +0530 Subject: [PATCH 09/10] Caching mechanism --- .github/workflows/pr_ci.yaml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index 072f4bf4..a58dcf42 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -17,11 +17,18 @@ jobs: - name: Set up Xcode run: sudo xcode-select -switch /Applications/Xcode.app + - name: Cache DerivedData + uses: actions/cache@v3 + with: + path: ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-xcode-${{ hashFiles('**/*.swift', '**/project.pbxproj') }} + restore-keys: | + ${{ runner.os }}-xcode- - name: Build run: | - xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' clean build + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' clean build - name: Test run: | - xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 12,OS=latest' test + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' test From 788589ad17351f58821e7447e8e6736abac1a221 Mon Sep 17 00:00:00 2001 From: Andrew Tavis McAllister Date: Tue, 3 Sep 2024 22:34:43 +0200 Subject: [PATCH 10/10] Rename workflow given org conventions --- .github/workflows/pr_ci.yaml | 37 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pr_ci.yaml b/.github/workflows/pr_ci.yaml index a58dcf42..1c37cb54 100644 --- a/.github/workflows/pr_ci.yaml +++ b/.github/workflows/pr_ci.yaml @@ -1,4 +1,4 @@ -name: Swift Unit Test CI +name: pr_ci on: pull_request: @@ -11,24 +11,23 @@ jobs: runs-on: macos-latest steps: - - name: Checkout code - uses: actions/checkout@v3 + - name: Checkout code + uses: actions/checkout@v3 - - name: Set up Xcode - run: sudo xcode-select -switch /Applications/Xcode.app + - name: Set up Xcode + run: sudo xcode-select -switch /Applications/Xcode.app - - name: Cache DerivedData - uses: actions/cache@v3 - with: - path: ~/Library/Developer/Xcode/DerivedData - key: ${{ runner.os }}-xcode-${{ hashFiles('**/*.swift', '**/project.pbxproj') }} - restore-keys: | - ${{ runner.os }}-xcode- - - name: Build - run: | - xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' clean build - - - name: Test - run: | - xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' test + - name: Cache DerivedData + uses: actions/cache@v3 + with: + path: ~/Library/Developer/Xcode/DerivedData + key: ${{ runner.os }}-xcode-${{ hashFiles('**/*.swift', '**/project.pbxproj') }} + restore-keys: | + ${{ runner.os }}-xcode- + - name: Build + run: | + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' clean build + - name: Test + run: | + xcodebuild -scheme Scribe -destination 'platform=iOS Simulator,name=iPhone 15,OS=latest' test