From a358a4fa88bbc7d83d21336d182d2ad41434d80a Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 24 Feb 2024 16:39:40 +0100 Subject: [PATCH 1/5] Add Unit Test step --- .github/workflows/ci.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5d155d8..14497b3c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -50,3 +50,7 @@ jobs: APPLE_DEVELOPMENT_SIGNING_CERTIFICATE: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_CERTIFICATE }} APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }} EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }} + + - name: Run Unit Tests + if: matrix.platform == 'macOS' + run: xcodebuild test -scheme Kiwix -destination=macOS From d07a23a0bdde2214c7e2be61c8ae87d419160193 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 24 Feb 2024 16:54:05 +0100 Subject: [PATCH 2/5] Make sure tests can fail on CI --- Model/Entities/ZimFileMetaData/ZimFileMetaData.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm b/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm index d051aa82..28ac362a 100644 --- a/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm +++ b/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm @@ -63,7 +63,7 @@ } - (NSString *)getLanguageCodesFromBook:(kiwix::Book *)book { - return [NSString stringWithUTF8String:book->getCommaSeparatedLanguages().c_str()]; + return @"invalid value"; } - (NSString *)getCategoryFromBook:(kiwix::Book *)book { From 2b71f71c3dc36cb4d83a104d5945498af76dad12 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 24 Feb 2024 16:56:02 +0100 Subject: [PATCH 3/5] Revert "Make sure tests can fail on CI" This reverts commit 97ac38521eaa5c8b87170766b2993c254f09bb44. --- Model/Entities/ZimFileMetaData/ZimFileMetaData.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm b/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm index 28ac362a..d051aa82 100644 --- a/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm +++ b/Model/Entities/ZimFileMetaData/ZimFileMetaData.mm @@ -63,7 +63,7 @@ } - (NSString *)getLanguageCodesFromBook:(kiwix::Book *)book { - return @"invalid value"; + return [NSString stringWithUTF8String:book->getCommaSeparatedLanguages().c_str()]; } - (NSString *)getCategoryFromBook:(kiwix::Book *)book { From 75d9eee39aeaa93942605d9981158f0f51cf4663 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 24 Feb 2024 21:04:59 +0100 Subject: [PATCH 4/5] Add multiple destinations for UnitTests --- .github/workflows/ci.yml | 5 ++--- project.yml | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14497b3c..60ddec51 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,6 +51,5 @@ jobs: APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }} EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }} - - name: Run Unit Tests - if: matrix.platform == 'macOS' - run: xcodebuild test -scheme Kiwix -destination=macOS + - name: Run Unit Tests on macOS + run: xcodebuild test -scheme Kiwix -destination='platform:${{ matrix.platform }}' diff --git a/project.yml b/project.yml index 1c3d9288..89281f3e 100644 --- a/project.yml +++ b/project.yml @@ -106,7 +106,7 @@ targets: - "**/dag.lproj" UnitTests: type: bundle.unit-test - platform: macOS + supportedDestinations: [iOS, macOS] settings: PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.Tests TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix From b96f68024fe29c9cc3b397c8c00003707b6156eb Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Sat, 24 Feb 2024 22:25:18 +0100 Subject: [PATCH 5/5] Modify unit test destination to launch the iOS sim --- .github/workflows/ci.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 60ddec51..41a7ff91 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -51,5 +51,11 @@ jobs: APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD: ${{ secrets.APPLE_DEVELOPMENT_SIGNING_P12_PASSWORD }} EXTRA_XCODEBUILD: ${{ env.EXTRA_XCODEBUILD }} + - name: Run Unit Tests on iOS + if: matrix.platform == 'iOS' + run: xcodebuild test -scheme Kiwix -destination 'platform=iOS Simulator,name=iPhone 15 Plus' + - name: Run Unit Tests on macOS - run: xcodebuild test -scheme Kiwix -destination='platform:${{ matrix.platform }}' + if: matrix.platform == 'macOS' + run: xcodebuild test -scheme Kiwix -destination 'platform=macOS' +