From cd26c29ec18d5588d48b13d5d3045bda050660d6 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Mon, 13 Jan 2025 00:43:07 +0100 Subject: [PATCH 1/6] Fix sandbox issue for macOS CI unit tests --- Support/Kiwix-unitTest.entitlements | 8 ++++++++ project.yml | 7 +++++++ 2 files changed, 15 insertions(+) create mode 100644 Support/Kiwix-unitTest.entitlements diff --git a/Support/Kiwix-unitTest.entitlements b/Support/Kiwix-unitTest.entitlements new file mode 100644 index 00000000..e89b7f32 --- /dev/null +++ b/Support/Kiwix-unitTest.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.app-sandbox + + + diff --git a/project.yml b/project.yml index e167b726..dc904f14 100644 --- a/project.yml +++ b/project.yml @@ -122,6 +122,13 @@ targets: PRODUCT_BUNDLE_IDENTIFIER: org.kiwix.Tests TEST_HOST: $(BUILT_PRODUCTS_DIR)/Kiwix.app/$(BUNDLE_EXECUTABLE_FOLDER_PATH)/Kiwix BUNDLE_LOADER: $(TEST_HOST) + entitlements: + path: Support/Kiwix-unitTest.entitlements + properties: + com.apple.security.app-sandbox: false + # from macOS 14, sandbox and unit test are not working together on CI + # a pop up appears that needs user acceptance + # see: https://developer.apple.com/documentation/security/accessing-files-from-the-macos-app-sandbox sources: - path: Tests dependencies: From 729b77cb79f8ac2566c08af945a9a863062b9308 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Mon, 13 Jan 2025 00:47:21 +0100 Subject: [PATCH 2/6] Add remanining capabilities --- project.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/project.yml b/project.yml index dc904f14..91787f52 100644 --- a/project.yml +++ b/project.yml @@ -125,7 +125,11 @@ targets: entitlements: path: Support/Kiwix-unitTest.entitlements properties: - com.apple.security.app-sandbox: false + com.apple.security.app-sandbox: false + com.apple.security.files.user-selected.read-write: true + com.apple.security.files.downloads.read-write: true + com.apple.security.network.client: true + com.apple.security.print: true # from macOS 14, sandbox and unit test are not working together on CI # a pop up appears that needs user acceptance # see: https://developer.apple.com/documentation/security/accessing-files-from-the-macos-app-sandbox From 5ce39b9b2544e83fe9fcf79b982aa8c8c98bc898 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Mon, 13 Jan 2025 00:48:06 +0100 Subject: [PATCH 3/6] Ignore generated file --- .gitignore | 1 + Support/Kiwix-unitTest.entitlements | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.gitignore b/.gitignore index 3667d69d..a31fd4e7 100644 --- a/.gitignore +++ b/.gitignore @@ -74,6 +74,7 @@ Libraries # ignore xcode project files, they are now generated by XcodeGen *.xcodeproj Support/Kiwix.entitlements +Support/Kiwix-unitTest.entitlements # ignore the lock file, it is not working the same way as lock files in other tools Brewfile.lock.json diff --git a/Support/Kiwix-unitTest.entitlements b/Support/Kiwix-unitTest.entitlements index e89b7f32..8b2ca145 100644 --- a/Support/Kiwix-unitTest.entitlements +++ b/Support/Kiwix-unitTest.entitlements @@ -4,5 +4,13 @@ com.apple.security.app-sandbox + com.apple.security.files.downloads.read-write + + com.apple.security.files.user-selected.read-write + + com.apple.security.network.client + + com.apple.security.print + From 8abd9c7134cd866109f7bf11f1229ab80e3c3259 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Mon, 13 Jan 2025 00:48:44 +0100 Subject: [PATCH 4/6] Remove ignored file --- Support/Kiwix-unitTest.entitlements | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 Support/Kiwix-unitTest.entitlements diff --git a/Support/Kiwix-unitTest.entitlements b/Support/Kiwix-unitTest.entitlements deleted file mode 100644 index 8b2ca145..00000000 --- a/Support/Kiwix-unitTest.entitlements +++ /dev/null @@ -1,16 +0,0 @@ - - - - - com.apple.security.app-sandbox - - com.apple.security.files.downloads.read-write - - com.apple.security.files.user-selected.read-write - - com.apple.security.network.client - - com.apple.security.print - - - From 73dd5a2a61d6b7671fa507a0bc57a1b9e53b7573 Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Mon, 13 Jan 2025 01:06:22 +0100 Subject: [PATCH 5/6] Only disable sandboxing ignore the rest for unit tests --- project.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/project.yml b/project.yml index 91787f52..796a2db5 100644 --- a/project.yml +++ b/project.yml @@ -126,10 +126,6 @@ targets: path: Support/Kiwix-unitTest.entitlements properties: com.apple.security.app-sandbox: false - com.apple.security.files.user-selected.read-write: true - com.apple.security.files.downloads.read-write: true - com.apple.security.network.client: true - com.apple.security.print: true # from macOS 14, sandbox and unit test are not working together on CI # a pop up appears that needs user acceptance # see: https://developer.apple.com/documentation/security/accessing-files-from-the-macos-app-sandbox From 723ccffaa38aae10418bd5ffd254d2ac7f425f7a Mon Sep 17 00:00:00 2001 From: Balazs Perlaki-Horvath Date: Thu, 16 Jan 2025 11:30:28 +0100 Subject: [PATCH 6/6] Turn off code signing for macOS unit tests --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9184f619..a02c0372 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -66,7 +66,7 @@ jobs: - name: Run Unit Tests on macOS if: matrix.platform == 'macOS' - run: xcodebuild test -scheme Kiwix -destination 'platform=macOS' + run: xcodebuild test -scheme Kiwix -destination 'platform=macOS' CODE_SIGNING_ALLOWED=NO - name: Upload code coverage uses: codecov/codecov-action@v4.2.0