From d0dccef109970aa59ab972c179f326d6771fc5fe 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 | 73 +++++++++++++++++++++++++++-- Fyreplace.xcodeproj/project.pbxproj | 7 +-- 2 files changed, 70 insertions(+), 10 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 962bc9b..cf42a6d 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,71 @@ jobs: path: Export/Fyreplace.pkg if-no-files-found: error + test: + name: Test + runs-on: macos-latest + environment: apple-app-store + strategy: + matrix: + platform: + - macOS + 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: Set up signing certificate + env: + CERTIFICATE_DEVELOPMENT_B64: ${{ vars.CERTIFICATE_DEVELOPMENT_B64 }} + CERTIFICATE_DEVELOPMENT_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_DEVELOPMENT_PRIVATE_KEY_B64 }} + run: | + security create-keychain -p password build.keychain + security default-keychain -s build.keychain + security unlock-keychain -p password build.keychain + security set-keychain-settings build.keychain + echo $CERTIFICATE_DEVELOPMENT_B64 | base64 --decode > /tmp/certificate.cer + security import /tmp/certificate.cer -k build.keychain -P '' -T /usr/bin/codesign -T /usr/bin/productsign + echo $CERTIFICATE_DEVELOPMENT_PRIVATE_KEY_B64 | base64 --decode > /tmp/key.p12 + security import /tmp/key.p12 -k build.keychain -P '' -T /usr/bin/codesign -T /usr/bin/productsign + security set-key-partition-list -S apple-tool:,apple: -s -k password build.keychain + + - name: Select Xcode version + run: sudo xcode-select -s /Applications/Xcode_$(cat .xcode-version).app/Contents/Developer + + - name: Prepare files + env: + DEVELOPMENT_TEAM: ${{ vars.TEAM_ID }} + run: make + + - name: Trust OpenAPI plugin + run: bash .github/workflows/trust-openapi-plugin.sh + + - name: Run tests + run: | + xcodebuild test \ + -allowProvisioningUpdates \ + -scheme Fyreplace \ + -destination platform=${{ matrix.platform }} \ + -only-testing FyreplaceTests + publish: name: Publish - needs: build + needs: + - build + - test runs-on: macos-latest environment: apple-app-store strategy: diff --git a/Fyreplace.xcodeproj/project.pbxproj b/Fyreplace.xcodeproj/project.pbxproj index 76b62e0..1e1da2c 100644 --- a/Fyreplace.xcodeproj/project.pbxproj +++ b/Fyreplace.xcodeproj/project.pbxproj @@ -682,7 +682,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 +856,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 +874,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 +890,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 +907,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)";