From 0d958b5aa363a46c965a502a2d0964e22ef59138 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laurent=20Tr=C3=A9guier?= Date: Wed, 31 Jul 2024 21:32:35 +0200 Subject: [PATCH] Run tests --- .github/workflows/publishing.yml | 56 ++++++++++++++++++++++++++--- .ios-test-version | 1 + Fyreplace.xcodeproj/project.pbxproj | 9 +++-- 3 files changed, 56 insertions(+), 10 deletions(-) create mode 100644 .ios-test-version diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 962bc9b..f46e794 100644 --- a/.github/workflows/publishing.yml +++ b/.github/workflows/publishing.yml @@ -89,7 +89,8 @@ jobs: - name: Prepare files if: ${{ matrix.distribution == 'app-store' }} env: - CODE_SIGN_IDENTITY: 'Apple Distribution' + DEVELOPMENT_TEAM: ${{ vars.TEAM_ID }} + CODE_SIGN_IDENTITY: Apple Distribution PROVISIONING_PROFILE_SPECIFIER: ${{ matrix.platform == 'macOS' && vars.PROVISIONING_PROFILE_NAME_MACOS || vars.PROVISIONING_PROFILE_NAME }} SENTRY_DSN: ${{ matrix.platform == 'iOS' && secrets.SENTRY_DSN_IOS || secrets.SENTRY_DSN_MACOS }} SENTRY_ORG: ${{ vars.SENTRY_ORG }} @@ -100,7 +101,8 @@ jobs: - name: Prepare files if: ${{ matrix.distribution == 'standalone' }} env: - CODE_SIGN_IDENTITY: 'Developer ID Application' + DEVELOPMENT_TEAM: ${{ vars.TEAM_ID }} + CODE_SIGN_IDENTITY: Developer ID Application PROVISIONING_PROFILE_SPECIFIER: ${{ vars.PROVISIONING_PROFILE_NAME_MACOS_STANDALONE }} run: make @@ -114,10 +116,9 @@ jobs: - name: Build app env: CODE_SIGN_IDENTITY: Apple Distribution - PROVISIONING_PROFILE_SPECIFIER: Fyreplace + PROVISIONING_PROFILE_SPECIFIER: ${{ vars.PROVISIONING_PROFILE_NAME }} run: | xcodebuild archive \ - DEVELOPMENT_TEAM=${{ vars.TEAM_ID }} \ -allowProvisioningUpdates \ -authenticationKeyPath /tmp/connect-key.p8 \ -authenticationKeyID ${{ vars.APP_STORE_CONNECT_KEY_ID }} \ @@ -176,9 +177,54 @@ jobs: path: Export/Fyreplace.pkg if-no-files-found: error + test: + name: Test + runs-on: macos-latest + environment: apple-app-store + strategy: + matrix: + platform: + - iOS + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + submodules: true + + - name: Cache packages + uses: actions/cache@v4 + with: + path: | + ~/Library/Caches/org.swift.swiftpm + ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts + ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/repositories + key: ${{ runner.os }}-${{ matrix.platform }}-spm-${{ hashFiles('**/Package.resolved') }} + restore-keys: | + ${{ runner.os }}-${{ matrix.platform }}-spm- + + - name: Select Xcode version + run: sudo xcode-select -s /Applications/Xcode_$(cat .xcode-version).app/Contents/Developer + + - name: Prepare files + run: make + + - name: Trust OpenAPI plugin + run: bash .github/workflows/trust-openapi-plugin.sh + + - name: Run tests + run: | + xcodebuild test \ + CODE_SIGNING_ALLOWED=no \ + -scheme Fyreplace \ + -destination platform=${{ matrix.platform }},OS=$(cat .ios-test-version) \ + -only-testing FyreplaceTests + publish: name: Publish - needs: build + needs: + - build + - test runs-on: macos-latest environment: apple-app-store strategy: diff --git a/.ios-test-version b/.ios-test-version new file mode 100644 index 0000000..6060b96 --- /dev/null +++ b/.ios-test-version @@ -0,0 +1 @@ +17.5 diff --git a/Fyreplace.xcodeproj/project.pbxproj b/Fyreplace.xcodeproj/project.pbxproj index 76b62e0..218c2d5 100644 --- a/Fyreplace.xcodeproj/project.pbxproj +++ b/Fyreplace.xcodeproj/project.pbxproj @@ -115,6 +115,7 @@ 4D54C96C2BF4E9BE001DE071 /* ArchiveScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ArchiveScreen.swift; sourceTree = ""; }; 4D54C96E2BF4E9DF001DE071 /* DraftsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DraftsScreen.swift; sourceTree = ""; }; 4D54C9702BF4EA15001DE071 /* SettingsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SettingsScreen.swift; sourceTree = ""; }; + 4D6641DB2C5B963500BE3D07 /* .ios-test-version */ = {isa = PBXFileReference; lastKnownFileType = text; path = ".ios-test-version"; sourceTree = ""; }; 4D7F9CC12C259C00007B1CC3 /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = PrivacyInfo.xcprivacy; sourceTree = ""; }; 4D9B3B372C334B3A00A8F7AD /* LoginScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginScreen.swift; sourceTree = ""; }; 4D9B3B392C334B6300A8F7AD /* RegisterScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RegisterScreen.swift; sourceTree = ""; }; @@ -228,6 +229,7 @@ 4D54C9462BF26090001DE071 /* FyreplaceUITests */, 4D54C9632BF28695001DE071 /* .gitignore */, 4D0DDC292C18A467006CD503 /* .xcode-version */, + 4D6641DB2C5B963500BE3D07 /* .ios-test-version */, 4DCEF8652C452EBA00F53085 /* .env-example */, 4DCEF8662C452ECC00F53085 /* .env */, 4D54C9592BF266F9001DE071 /* Makefile */, @@ -682,7 +684,6 @@ CLANG_WARN_UNREACHABLE_CODE = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; COPY_PHASE_STRIP = NO; - DEAD_CODE_STRIPPING = YES; DEBUG_INFORMATION_FORMAT = dwarf; ENABLE_STRICT_OBJC_MSGSEND = YES; ENABLE_TESTABILITY = YES; @@ -857,7 +858,7 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; - DEAD_CODE_STRIPPING = YES; + CODE_SIGN_IDENTITY = "-"; GENERATE_INFOPLIST_FILE = YES; PRODUCT_BUNDLE_IDENTIFIER = app.fyreplace.FyreplaceTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -875,7 +876,6 @@ buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; BUNDLE_LOADER = "$(TEST_HOST)"; - DEAD_CODE_STRIPPING = YES; GENERATE_INFOPLIST_FILE = YES; PRODUCT_BUNDLE_IDENTIFIER = app.fyreplace.FyreplaceTests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -892,7 +892,7 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - DEAD_CODE_STRIPPING = YES; + CODE_SIGN_IDENTITY = "-"; GENERATE_INFOPLIST_FILE = YES; PRODUCT_BUNDLE_IDENTIFIER = app.fyreplace.FyreplaceUITests; PRODUCT_NAME = "$(TARGET_NAME)"; @@ -909,7 +909,6 @@ isa = XCBuildConfiguration; buildSettings = { ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES = YES; - DEAD_CODE_STRIPPING = YES; GENERATE_INFOPLIST_FILE = YES; PRODUCT_BUNDLE_IDENTIFIER = app.fyreplace.FyreplaceUITests; PRODUCT_NAME = "$(TARGET_NAME)";