From 82344e4c75209c0018fa1313284a4f4433e44f56 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 +++++++++++++++++++++++++++++--- 1 file changed, 68 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publishing.yml b/.github/workflows/publishing.yml index 962bc9b..41bea7b 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_DISTRIBUTION_B64: ${{ vars.CERTIFICATE_DISTRIBUTION_B64 }} + CERTIFICATE_DISTRIBUTION_PRIVATE_KEY_B64: ${{ secrets.CERTIFICATE_DISTRIBUTION_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_DISTRIBUTION_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_DISTRIBUTION_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 }} + CODE_SIGN_IDENTITY: Apple Distribution + PROVISIONING_PROFILE_SPECIFIER: ${{ vars.PROVISIONING_PROFILE_NAME }} + run: make + + - name: Trust OpenAPI plugin + run: bash .github/workflows/trust-openapi-plugin.sh + + - name: Run tests + run: | + xcodebuild test \ + -scheme Fyreplace \ + -only-testing FyreplaceTests + publish: name: Publish - needs: build + needs: + - build + - test runs-on: macos-latest environment: apple-app-store strategy: