diff --git a/.github/workflows/_reusable_run_tests.yml b/.github/workflows/_reusable_run_tests.yml index 1678708706b..ce508171416 100644 --- a/.github/workflows/_reusable_run_tests.yml +++ b/.github/workflows/_reusable_run_tests.yml @@ -1,106 +1,19 @@ on: workflow_call: inputs: - wire-ios: - type: boolean - default: false - required: false - wire-ui: - type: boolean - default: false - required: false - wire-ios-sync-engine: - type: boolean - default: false - required: false - wire-ios-data-model: - type: boolean - default: false - required: false - wire-ios-system: - type: boolean - default: false - required: false - wire-system: - type: boolean - default: false - required: false - wire-ios-request-strategy: - type: boolean - default: false - required: false - wire-api: - type: boolean - default: false - required: false - wire-analytics: - type: boolean - default: false - required: false - wire-domain-project: - type: boolean - default: false - required: false - wire-domain: - type: boolean - default: false - required: false - wire-ios-transport: - type: boolean - default: false - required: false - wire-ios-share-engine: - type: boolean - default: false - required: false - wire-ios-cryptobox: - type: boolean - default: false - required: false - wire-ios-mocktransport: - type: boolean - default: false - required: false - wire-ios-notification-engine: - type: boolean - default: false - required: false - wire-ios-protos: - type: boolean - default: false - required: false - wire-ios-images: - type: boolean - default: false - required: false - wire-ios-link-preview: - type: boolean - default: false - required: false - wire-ios-utilities: - type: boolean - default: false - required: false - wire-utilities: - type: boolean - default: false - required: false - wire-ios-testing: - type: boolean - default: false - required: false - wire-foundation: - type: boolean - default: false - required: false - scripts: - type: boolean - default: false - required: false + folders: + type: string all: type: boolean default: false required: false + branch: + type: string + required: true + notify_secret: + type: string + required: true + secrets: ZENKINS_USERNAME: required: true @@ -116,14 +29,17 @@ env: # https://docs.fastlane.tools/getting-started/ios/setup/ jobs: run-tests: runs-on: ghcr.io/cirruslabs/macos-runner:sonoma + outputs: + xcresult_files: ${{ steps.find-xcresults.outputs.xcresult_files }} env: GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_USERNAME: ${{ secrets.ZENKINS_USERNAME }} - SLACK_WEBHOOK_URL: ${{ secrets.WIRE_IOS_CI_WEBHOOK }} + SLACK_WEBHOOK_URL: ${{ secrets[inputs.notify_secret] }} steps: - uses: actions/checkout@v4 with: + ref: ${{ inputs.branch }} lfs: 'true' - name: Retrieve Xcode version @@ -184,480 +100,35 @@ jobs: run: | bundle exec fastlane prepare_for_tests - # Scripts - - - name: Test Scripts - if: ${{ inputs.scripts || inputs.all }} - run: | - echo "Scripts has changes" - echo "Testing Scripts..." - xcrun swift test --package-path ./scripts - - # WireFoundation - - - name: Build WireFoundation - if: ${{ inputs.wire-foundation || inputs.all }} - run: | - echo "WireFoundation has changes" - echo "Building WireFoundation..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireFoundation-Package -resultBundlePath xcodebuild-wire-foundation.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-foundation.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-foundation || inputs.all }} - with: - results: xcodebuild-wire-foundation.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireFoundation - if: ${{ inputs.wire-foundation || inputs.all }} - run: | - echo "Testing WireFoundation..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme WireFoundation-Package -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-foundation.log | bundle exec xcpretty --report junit --output build/reports/WireFoundation.junit - exit ${PIPESTATUS[0]} - - # WireSystem Project - - - name: Build WireSystem Project - if: ${{ inputs.wire-ios-system || inputs.all }} - run: | - echo "WireSystem Project has changes" - echo "Building WireSystem Project..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireSystem -resultBundlePath xcodebuild-wire-ios-system.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-system.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-system || inputs.all }} - with: - results: xcodebuild-wire-ios-system.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireSystem Project - if: ${{ inputs.wire-ios-system || inputs.all }} - run: | - echo "Testing WireSystem Project..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireSystem -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-system.log | bundle exec xcpretty --report junit --output build/reports/WireSystemProject.junit - exit ${PIPESTATUS[0]} - - # WireTesting Project - - - name: Build WireTesting Project - if: ${{ inputs.wire-ios-testing || inputs.all }} - run: | - echo "WireTesting Project has changes" - echo "Building WireTesting Project..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireTesting -resultBundlePath xcodebuild-wire-ios-testing.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-testing.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-testing || inputs.all }} - with: - results: xcodebuild-wire-ios-testing.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireTesting Project - if: ${{ inputs.wire-ios-testing || inputs.all }} - run: | - echo "Testing WireTesting Project..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireTesting -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-testing.log | bundle exec xcpretty --report junit --output build/reports/WireTestingProject.junit - exit ${PIPESTATUS[0]} - - # WireUtilities Project - - - name: Build WireUtilities Project - if: ${{ inputs.wire-ios-utilities || inputs.all }} - run: | - echo "WireUtilities Project has changes" - echo "Building WireUtilities Project..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireUtilities -resultBundlePath xcodebuild-wire-ios-utilities.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-utilities.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-utilities || inputs.all }} - with: - results: xcodebuild-wire-ios-utilities.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireUtilities Project - if: ${{ inputs.wire-ios-utilities || inputs.all }} - run: | - echo "Testing WireUtilities Project..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireUtilities -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-utilities.log | bundle exec xcpretty --report junit --output build/reports/WireUtilitiesProject.junit - exit ${PIPESTATUS[0]} - - # WireCryptobox - - - name: Build WireCryptobox - if: ${{ inputs.wire-ios-cryptobox || inputs.all }} - run: | - echo "WireCryptobox has changes" - echo "Building WireCryptobox..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireCryptobox -resultBundlePath xcodebuild-wire-ios-cryptobox.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-cryptobox.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-cryptobox || inputs.all }} - with: - results: xcodebuild-wire-ios-cryptobox.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireCryptobox - if: ${{ inputs.wire-ios-cryptobox || inputs.all }} - run: | - echo "Testing WireCryptobox..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireCryptobox -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-cryptobox.log | bundle exec xcpretty --report junit --output build/reports/WireCryptobox.junit - exit ${PIPESTATUS[0]} - - # WireTransport - - - name: Build WireTransport - if: ${{ inputs.wire-ios-transport || inputs.all }} - run: | - echo "WireTransport has changes" - echo "Building WireTransport..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireTransport -resultBundlePath xcodebuild-wire-ios-transport.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-transport.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-transport || inputs.all }} - with: - results: xcodebuild-wire-ios-transport.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireTransport - if: ${{ inputs.wire-ios-transport || inputs.all }} - run: | - echo "Testing WireTransport..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireTransport -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-transport.log | bundle exec xcpretty --report junit --output build/reports/WireTransport.junit - exit ${PIPESTATUS[0]} - - # WireLinkPreview - - - name: Build WireLinkPreview - if: ${{ inputs.wire-ios-link-preview || inputs.all }} - run: | - echo "WireLinkPreview has changes" - echo "Building WireLinkPreview..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireLinkPreview -resultBundlePath xcodebuild-wire-ios-link-preview.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-link-preview.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-link-preview || inputs.all }} - with: - results: xcodebuild-wire-ios-link-preview.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireLinkPreview - if: ${{ inputs.wire-ios-link-preview || inputs.all }} + - name: "Test all selected frameworks" + id: set_frameworks run: | - echo "Testing WireLinkPreview..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireLinkPreview -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-link-preview.log | bundle exec xcpretty --report junit --output build/reports/WireLinkPreview.junit - exit ${PIPESTATUS[0]} + bundle exec fastlane test_frameworks folders:${{ inputs.folders }} all:${{ inputs.all }} - # WireImages - - - name: Build WireImages - if: ${{ inputs.wire-ios-images || inputs.all }} - run: | - echo "WireImages has changes" - echo "Building WireImages..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireImages -resultBundlePath xcodebuild-wire-ios-images.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-images.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-images || inputs.all }} - with: - results: xcodebuild-wire-ios-images.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireImages - if: ${{ inputs.wire-ios-images || inputs.all }} - run: | - echo "Testing WireImages..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireImages -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-images.log | bundle exec xcpretty --report junit --output build/reports/WireImages.junit - exit ${PIPESTATUS[0]} - - # WireProtos - - - name: Build WireProtos - if: ${{ inputs.wire-ios-protos || inputs.all }} - run: | - echo "WireProtos has changes" - echo "Building WireProtos..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireProtos -resultBundlePath xcodebuild-wire-ios-protos.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-protos.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-protos || inputs.all }} - with: - results: xcodebuild-wire-ios-protos.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireProtos - if: ${{ inputs.wire-ios-protos || inputs.all }} - run: | - echo "Testing WireProtos..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireProtos -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-protos.log | bundle exec xcpretty - exit ${PIPESTATUS[0]} - - # WireMockTransport - - - name: Build WireMockTransport - if: ${{ inputs.wire-ios-mocktransport || inputs.all }} - run: | - echo "WireMockTransport has changes" - echo "Building WireMockTransport..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireMockTransport -resultBundlePath xcodebuild-wire-ios-mocktransport.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-mocktransport.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-mocktransport || inputs.all }} - with: - results: xcodebuild-wire-ios-mocktransport.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireMockTransport - if: ${{ inputs.wire-ios-mocktransport || inputs.all }} - run: | - echo "Testing WireMockTransport..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireMockTransport -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-mocktransport.log | bundle exec xcpretty --report junit --output build/reports/WireMockTransport.junit - exit ${PIPESTATUS[0]} - - # WireDataModel - - - name: Build WireDataModel - if: ${{ inputs.wire-ios-data-model || inputs.all }} - run: | - echo "WireDataModel has changes" - echo "Building WireDataModel..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireDataModel -resultBundlePath xcodebuild-wire-ios-data-model.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-data-model.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-data-model || inputs.all }} - with: - results: xcodebuild-wire-ios-data-model.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireDataModel - if: ${{ inputs.wire-ios-data-model || inputs.all }} - run: | - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireDataModel -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-data-model.log | bundle exec xcpretty --report junit --output build/reports/WireDataModel.junit - exit ${PIPESTATUS[0]} - - # WireAPI - - - name: Build WireAPI - if: ${{ inputs.wire-api || inputs.all }} - run: | - echo "WireAPI has changes" - echo "Building WireAPI..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireAPI-Package -resultBundlePath xcodebuild-wire-api.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-api.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-api || inputs.all }} - with: - results: xcodebuild-wire-api.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireAPI - if: ${{ inputs.wire-api || inputs.all }} - run: | - echo "Testing WireAPI..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme WireAPI-Package -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-api.log | bundle exec xcpretty --report junit --output build/reports/WireAPI.junit - exit ${PIPESTATUS[0]} - - # WireAnalytics - - - name: Build WireAnalytics - if: ${{ inputs.wire-analytics || inputs.all }} - run: | - echo "WireAnalytics has changes" - echo "Building WireAnalytics..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireAnalytics-Package -resultBundlePath xcodebuild-wire-analytics.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-analytics.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-analytics || inputs.all }} - with: - results: xcodebuild-wire-analytics.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireAnalytics - if: ${{ inputs.wire-analytics || inputs.all }} - run: | - echo "Testing WireAnalytics..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme WireAnalytics-Package -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-analytics.log | bundle exec xcpretty --report junit --output build/reports/WireAnalytics.junit - exit ${PIPESTATUS[0]} - - # WireDomain - - - name: Build WireDomain - if: ${{ inputs.wire-domain || inputs.all }} - run: | - echo "WireDomain has changes" - echo "Building WireDomain..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireDomain-Package -resultBundlePath xcodebuild-wire-domain.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-domain.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-domain || inputs.all }} - with: - results: xcodebuild-wire-domain.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireDomain - if: ${{ inputs.wire-domain || inputs.all }} - run: | - echo "Testing WireDomain..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme WireDomain-Package -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-domain.log | bundle exec xcpretty --report junit --output build/reports/WireDomain.junit - exit ${PIPESTATUS[0]} - - # WireDomain Project - - - name: Build WireDomain Project - if: ${{ inputs.wire-domain-project || inputs.all }} + - name: Find all .xcresult files + if: ${{ always() && github.event_name == 'pull_request' }} + id: find-xcresults run: | - echo "WireDomain Project has changes" - echo "Building WireDomain Project..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireDomain -resultBundlePath xcodebuild-wire-domain-project.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-domain-project.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-domain-project || inputs.all }} - with: - results: xcodebuild-wire-domain-project.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireDomain Project - if: ${{ inputs.wire-domain-project || inputs.all }} - run: | - echo "Testing WireDomain Project..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme WireDomain -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-domain-project.log | bundle exec xcpretty --report junit --output build/reports/WireDomainProject.junit - exit ${PIPESTATUS[0]} - - # WireRequestStrategy - - - name: Build WireRequestStrategy - if: ${{ inputs.wire-ios-request-strategy || inputs.all }} + # Find all .xcresult directories and convert them to a JSON array + files=`find artifacts/ -type d -name "*.xcresult" | jq -R . | jq -s .` + echo xcresult_files=${files} >> $GITHUB_OUTPUT + - name: Debug Print xcresult files run: | - echo "WireRequestStrategy has changes" - echo "Building WireRequestStrategy..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireRequestStrategy -resultBundlePath xcodebuild-wire-ios-request-strategy.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-request-strategy.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-request-strategy || inputs.all }} - with: - results: xcodebuild-wire-ios-request-strategy.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireRequestStrategy - if: ${{ inputs.wire-ios-request-strategy || inputs.all }} - run: | - echo "Testing WireRequestStrategy..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireRequestStrategy -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-request-strategy.log | bundle exec xcpretty --report junit --output build/reports/WireRequestStrategy.junit - exit ${PIPESTATUS[0]} - - # WireShareEngine - - - name: Build WireShareEngine - if: ${{ inputs.wire-ios-share-engine || inputs.all }} - run: | - echo "WireShareEngine has changes" - echo "Building WireShareEngine..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireShareEngine -resultBundlePath xcodebuild-wire-ios-share-engine.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-share-engine.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-share-engine || inputs.all }} - with: - results: xcodebuild-wire-ios-share-engine.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireShareEngine - if: ${{ inputs.wire-ios-share-engine || inputs.all }} - run: | - echo "Testing WireShareEngine..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireShareEngine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-share-engine.log | bundle exec xcpretty --report junit --output build/reports/WireShareEngine.junit - exit ${PIPESTATUS[0]} - - # WireSyncEngine - - - name: Build WireSyncEngine - if: ${{ inputs.wire-ios-sync-engine || inputs.all }} - run: | - echo "WireSyncEngine has changes" - echo "Building WireSyncEngine..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireSyncEngine -resultBundlePath xcodebuild-wire-ios-sync-engine.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-sync-engine.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-sync-engine || inputs.all }} - with: - results: xcodebuild-wire-ios-sync-engine.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireSyncEngine - if: ${{ inputs.wire-ios-sync-engine || inputs.all }} - run: | - echo "Testing WireSyncEngine..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireSyncEngine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-sync-engine.log | bundle exec xcpretty --report junit --output build/reports/WireSyncEngine.junit - exit ${PIPESTATUS[0]} - - # WireUI - - - name: Build WireUI - if: ${{ inputs.wire-ui || inputs.all }} - run: | - echo "WireUI has changes" - echo "Building WireUI..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireUI-Package -resultBundlePath xcodebuild-wire-ui.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ui.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ui || inputs.all }} - with: - results: xcodebuild-wire-ui.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireUI - if: ${{ inputs.wire-ui || inputs.all }} - run: | - echo "Testing WireUI..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme WireUI-Package -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ui.log | bundle exec xcpretty --report junit --output build/reports/WireUI.junit - exit ${PIPESTATUS[0]} - - # Wire-iOS - - - name: Build Wire-iOS - if: ${{ inputs.wire-ios || inputs.all }} - run: | - echo "Wire-iOS has changes" - echo "Building Wire-iOS..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme Wire-iOS -resultBundlePath xcodebuild-wire-ios.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios || inputs.all }} + echo "xcresult files: ${{ steps.find-xcresults.outputs.xcresult_files }}" + - name: Upload .xcresult files as artifact + if: always() + uses: actions/upload-artifact@v4 with: - results: xcodebuild-wire-ios.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + name: xcresults + path: artifacts/**/*.xcresult # Adjust this if necessary - - name: Test Wire-iOS - if: ${{ inputs.wire-ios || inputs.all }} - run: | - echo "Testing Wire-iOS..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme Wire-iOS -testPlan AllTests -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios.log | bundle exec xcpretty --report junit --output build/reports/Wire-iOS-EN.junit - exit ${PIPESTATUS[0]} - - - name: Test Wire-iOS German Locale Tests - if: ${{ inputs.wire-ios || inputs.all }} + # Scripts + - name: Test Scripts + if: ${{ contains(inputs.folders, 'scripts') || inputs.all }} run: | - echo "Testing Wire-iOS German Locale Tests..." - xcodebuild test -workspace wire-ios-mono.xcworkspace -scheme Wire-iOS -testPlan GermanLocaleTests -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-de.log | bundle exec xcpretty --report junit --output build/reports/Wire-iOS-DE.junit - exit ${PIPESTATUS[0]} + echo "Scripts has changes" + echo "Testing Scripts..." + xcrun swift test --package-path ./scripts - name: Upload Failed snapshots uses: actions/upload-artifact@v4 @@ -668,30 +139,6 @@ jobs: **/SnapshotResults/ xcodebuild*.log - # WORKAROUND: if we test WireNotificationEngine and then Wire-iOS, we'll get an error when trying to build - # Wire-iOS stating that symbols from the notification can't be found. to workaround this, test the notification - # after the Wire-iOS. - - name: Build WireNotificationEngine - if: ${{ inputs.wire-ios-notification-engine || inputs.all }} - run: | - echo "WireNotificationEngine has changes" - echo "Building WireNotificationEngine..." - xcodebuild build-for-testing -workspace wire-ios-mono.xcworkspace -scheme WireNotificationEngine -resultBundlePath xcodebuild-wire-ios-notification-engine.xcresult -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee xcodebuild-wire-ios-notification-engine.log | bundle exec xcpretty - - - uses: wireapp/analyze-xcoderesults-action@v1 - if: ${{ inputs.wire-ios-notification-engine || inputs.all }} - with: - results: xcodebuild-wire-ios-notification-engine.xcresult - warningAnnotations: true - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Test WireNotificationEngine - if: ${{ inputs.wire-ios-notification-engine || inputs.all }} - run: | - echo "Testing WireNotificationEngine..." - xcodebuild test -retry-tests-on-failure -workspace wire-ios-mono.xcworkspace -scheme WireNotificationEngine -destination 'platform=iOS Simulator,OS=${{ env.IOS_VERSION }},name=${{ env.IPHONE_MODEL }}' | tee -a xcodebuild-wire-ios-notification-engine.log | bundle exec xcpretty --report junit --output build/reports/WireNotificationEngine.junit - exit ${PIPESTATUS[0]} - - name: Save cache with warning counts # This step should only run for the test_develop.yml workflow if: ${{ !cancelled() && github.event.action == 'push' }} @@ -707,6 +154,7 @@ jobs: name: test-reports path: | build/reports/*.junit + artifacts/**/*.junit - name: Prepare visual representation of test results uses: EnricoMi/publish-unit-test-result-action/macos@v2 @@ -714,6 +162,7 @@ jobs: with: files: | build/reports/*.junit + artifacts/**/*.junit compare_to_earlier_commit: false - name: Archiving DerivedData Logs @@ -725,12 +174,58 @@ jobs: /Users/runner/Library/Developer/Xcode/DerivedData/**/Logs/** ~/Library/Logs/DiagnosticReports/** - - name: Notify on Wire if failed - if: ${{ failure() && github.ref_name == 'develop' }} + - name: Get Commit SHA + if: always() + id: get_commit_sha + run: echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_ENV + + - name: Notify on Wire for iOS Nightly 🤖 uses: 8398a7/action-slack@v3 + if: ${{ inputs.all }} with: status: ${{ job.status }} - text: "🆘 Tests for 'develop' failed 🆘\ncommit: https://github.com/wireapp/wire-ios-mono/commit/${{ github.sha }}\n**Triggered by:** ${{ github.triggering_actor }}\n**Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}\n" + text: | + **Tests for ${{ inputs.branch }}** + + **Commit:** [${{ env.commit_sha }}](https://github.com/wireapp/wire-ios-mono/commit/${{ env.commit_sha }}) + **Triggered by:** ${{ github.triggering_actor }} + **Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + - name: Notify on Wire for iOS CI + uses: 8398a7/action-slack@v3 + if: ${{ !inputs.all && failure() }} + with: + status: ${{ job.status }} + text: | + **🚨 Tests for ${{ inputs.branch }} failed 🆘** + + **Commit:** [${{ env.commit_sha }}](https://github.com/wireapp/wire-ios-mono/commit/${{ env.commit_sha }}) + **Triggered by:** ${{ github.triggering_actor }} + **Build log:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} + + analyze-xcresults: + needs: run-tests + if: ${{ always() && github.event_name == 'pull_request' }} + runs-on: ghcr.io/cirruslabs/macos-runner:sonoma + strategy: + matrix: + xcresult_file: ${{ fromJson(needs.run-tests.outputs.xcresult_files) }} + steps: + - name: Download .xcresult files + uses: actions/download-artifact@v4 + with: + name: xcresults + path: ./artifacts + + - name: Display downloaded files + run: ls -R + + - name: Analyze .xcresult file + uses: kronenthaler/analyze-xcoderesults-action@0.1.9 + with: + results: ${{ matrix.xcresult_file }} + warningAnnotations: true + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} upload-test-results-datadadog: runs-on: ubuntu-latest diff --git a/.github/workflows/test_develop.yml b/.github/workflows/test_develop.yml index 8dcc66dcc92..be6d5e80814 100644 --- a/.github/workflows/test_develop.yml +++ b/.github/workflows/test_develop.yml @@ -1,19 +1,23 @@ -name: Test Develop +name: Nightly Tests on: workflow_dispatch: - push: - branches: - - 'develop' - + schedule: + - cron: "0 21 * * *" + # This is what will cancel the workflow concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: - trigger_tests_develop: + trigger_tests: + strategy: + matrix: + branch: [develop, release/cycle-3.114] # List other branches here uses: ./.github/workflows/_reusable_run_tests.yml with: all: true + branch: ${{ matrix.branch }} + notify_secret: WIRE_IOS_NIGHTLY_WEBHOOK secrets: inherit diff --git a/.github/workflows/test_pr_changes.yml b/.github/workflows/test_pr_changes.yml index ad47680c4be..a8d36de6140 100644 --- a/.github/workflows/test_pr_changes.yml +++ b/.github/workflows/test_pr_changes.yml @@ -26,41 +26,21 @@ jobs: runs-on: ubuntu-latest # Set job outputs to values from filter step outputs: - wire-ios: ${{ steps.filter.outputs.wire-ios == 'true' || steps.filter.outputs.carthage == 'true' }} - wire-ui: ${{ steps.filter.outputs.wire-ui }} - wire-ios-sync-engine: ${{ steps.filter.outputs.wire-ios-sync-engine }} - wire-ios-data-model: ${{ steps.filter.outputs.wire-ios-data-model }} - wire-ios-system: ${{ steps.filter.outputs.wire-ios-system }} - wire-ios-request-strategy: ${{ steps.filter.outputs.wire-ios-request-strategy }} - wire-api: ${{ steps.filter.outputs.wire-api }} - wire-analytics: ${{ steps.filter.outputs.wire-analytics }} - wire-domain-project: ${{ steps.filter.outputs.wire-domain-project }} - wire-domain: ${{ steps.filter.outputs.wire-domain }} - wire-ios-transport: ${{ steps.filter.outputs.wire-ios-transport }} - wire-ios-share-engine: ${{ steps.filter.outputs.wire-ios-share-engine }} - wire-ios-cryptobox: ${{ steps.filter.outputs.wire-ios-cryptobox }} - wire-ios-mocktransport: ${{ steps.filter.outputs.wire-ios-mocktransport }} - wire-ios-notification-engine: ${{ steps.filter.outputs.wire-ios-notification-engine }} - wire-ios-protos: ${{ steps.filter.outputs.wire-ios-protos }} - wire-ios-images: ${{ steps.filter.outputs.wire-ios-images }} - wire-ios-link-preview : ${{ steps.filter.outputs.wire-ios-link-preview }} - wire-ios-utilities: ${{ steps.filter.outputs.wire-ios-utilities }} - wire-ios-testing: ${{ steps.filter.outputs.wire-ios-testing }} - wire-foundation: ${{ steps.filter.outputs.wire-foundation }} - scripts: ${{ steps.filter.outputs.scripts }} + folders: ${{ steps.filter.outputs.changes }} steps: - uses: actions/checkout@v4 with: - lfs: 'true' + lfs: 'false' # as long as we use lfs only for snapshotTesting it should not be useful here - uses: dorny/paths-filter@v2 id: filter with: filters: | wire-ios: - 'wire-ios/**' - wire-ui: + WireUI: - 'WireUI/**' + - 'wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireUIAll.xcscheme' wire-ios-share-engine: - 'wire-ios-share-engine/**' wire-ios-notification-engine: @@ -69,18 +49,13 @@ jobs: - 'wire-ios-sync-engine/**' wire-ios-request-strategy: - 'wire-ios-request-strategy/**' - wire-api: + WireAPI: - 'WireAPI/**' - wire-analytics: - - 'WireAnalytics/**' - wire-domain-project: - - 'WireDomain/Project/**' - - 'WireDomain/Sources/WireDomain/**' - - 'WireDomain/Sources/WireDomainSupport/**' - wire-domain: - - 'WireDomain/*.*' - - 'WireDomain/Sources/Package/**' - - 'WireDomain/Sources/PackageSupport/**' + WireAnalytics: + - 'WireAnalytics/Sources/WireAnalytics/**' + - 'WireAnalytics/Sources/WireDatadog/**' + WireDomain: + - 'WireDomain/**' wire-ios-data-model: - 'wire-ios-data-model/**' wire-ios-transport: @@ -99,8 +74,9 @@ jobs: - 'wire-ios-utilities/**' wire-ios-testing: - 'wire-ios-testing/**' - wire-foundation: + WireFoundation: - 'WireFoundation/**' + - 'wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireFoundationAll.xcscheme' wire-ios-system: - 'wire-ios-system/**' scripts: @@ -112,26 +88,7 @@ jobs: needs: detect-changes uses: ./.github/workflows/_reusable_run_tests.yml with: - wire-ios: ${{ needs.detect-changes.outputs.wire-ios == 'true' }} - wire-ui: ${{ needs.detect-changes.outputs.wire-ui == 'true' }} - wire-ios-sync-engine: ${{ needs.detect-changes.outputs.wire-ios-sync-engine == 'true' }} - wire-ios-data-model: ${{ needs.detect-changes.outputs.wire-ios-data-model == 'true' }} - wire-ios-system: ${{ needs.detect-changes.outputs.wire-ios-system == 'true' }} - wire-ios-request-strategy: ${{ needs.detect-changes.outputs.wire-ios-request-strategy == 'true' }} - wire-api: ${{ needs.detect-changes.outputs.wire-api == 'true' }} - wire-analytics: ${{ needs.detect-changes.outputs.wire-analytics == 'true' }} - wire-domain-project: ${{ needs.detect-changes.outputs.wire-domain-project == 'true' }} - wire-domain: ${{ needs.detect-changes.outputs.wire-domain == 'true' }} - wire-ios-transport: ${{ needs.detect-changes.outputs.wire-ios-transport == 'true' }} - wire-ios-share-engine: ${{ needs.detect-changes.outputs.wire-ios-share-engine == 'true' }} - wire-ios-cryptobox: ${{ needs.detect-changes.outputs.wire-ios-cryptobox == 'true' }} - wire-ios-mocktransport: ${{ needs.detect-changes.outputs.wire-ios-mocktransport == 'true' }} - wire-ios-notification-engine: ${{ needs.detect-changes.outputs.wire-ios-notification-engine == 'true' }} - wire-ios-protos: ${{ needs.detect-changes.outputs.wire-ios-protos == 'true' }} - wire-ios-images: ${{ needs.detect-changes.outputs.wire-ios-images == 'true' }} - wire-ios-link-preview: ${{ needs.detect-changes.outputs.wire-ios-link-preview == 'true' }} - wire-ios-utilities: ${{ needs.detect-changes.outputs.wire-ios-utilities == 'true' }} - wire-ios-testing: ${{ needs.detect-changes.outputs.wire-ios-testing == 'true' }} - wire-foundation: ${{ needs.detect-changes.outputs.wire-foundation == 'true' }} - scripts: ${{ needs.detect-changes.outputs.scripts == 'true' }} + folders: ${{ join(fromJson(needs.detect-changes.outputs.folders), ',') }} + branch: ${{ github.head_ref }} + notify_secret: WIRE_IOS_CI_WEBHOOK secrets: inherit diff --git a/WireAPI/Tests/TestPlans/AllTests.xctestplan b/WireAPI/Tests/TestPlans/AllTests.xctestplan index 919a44f0bbe..e8951419670 100644 --- a/WireAPI/Tests/TestPlans/AllTests.xctestplan +++ b/WireAPI/Tests/TestPlans/AllTests.xctestplan @@ -16,7 +16,7 @@ "testTargets" : [ { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireAPI", "identifier" : "WireAPITests", "name" : "WireAPITests" } diff --git a/WireAnalytics/Tests/TestPlans/AllTests.xctestplan b/WireAnalytics/Tests/TestPlans/AllTests.xctestplan index d14f0f7e868..1ce51f179d1 100644 --- a/WireAnalytics/Tests/TestPlans/AllTests.xctestplan +++ b/WireAnalytics/Tests/TestPlans/AllTests.xctestplan @@ -16,7 +16,7 @@ "testTargets" : [ { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireAnalytics", "identifier" : "WireAnalyticsTests", "name" : "WireAnalyticsTests" } diff --git a/WireFoundation/Tests/TestPlans/AllTests.xctestplan b/WireFoundation/Tests/TestPlans/AllTests.xctestplan index 91de191d340..52ab877364b 100644 --- a/WireFoundation/Tests/TestPlans/AllTests.xctestplan +++ b/WireFoundation/Tests/TestPlans/AllTests.xctestplan @@ -16,7 +16,7 @@ "testTargets" : [ { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireFoundation", "identifier" : "WireFoundationTests", "name" : "WireFoundationTests" } diff --git a/WireUI/Tests/TestPlans/AllTests.xctestplan b/WireUI/Tests/TestPlans/AllTests.xctestplan index 72f7ded87dd..a66f91c357a 100644 --- a/WireUI/Tests/TestPlans/AllTests.xctestplan +++ b/WireUI/Tests/TestPlans/AllTests.xctestplan @@ -21,59 +21,59 @@ "testTargets" : [ { "target" : { - "containerPath" : "container:", - "identifier" : "WireSidebarUITests", - "name" : "WireSidebarUITests" + "containerPath" : "container:WireUI", + "identifier" : "WireMainNavigationUITests", + "name" : "WireMainNavigationUITests" + } + }, + { + "target" : { + "containerPath" : "container:WireUI", + "identifier" : "WireSettingsUITests", + "name" : "WireSettingsUITests" } }, { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireUI", "identifier" : "WireDesignTests", "name" : "WireDesignTests" } }, { "target" : { - "containerPath" : "container:", - "identifier" : "WireReusableUIComponentsTests", - "name" : "WireReusableUIComponentsTests" + "containerPath" : "container:WireUI", + "identifier" : "WireSidebarUITests", + "name" : "WireSidebarUITests" } }, { "target" : { - "containerPath" : "container:", - "identifier" : "WireMainNavigationUITests", - "name" : "WireMainNavigationUITests" + "containerPath" : "container:WireUI", + "identifier" : "WireReusableUIComponentsTests", + "name" : "WireReusableUIComponentsTests" } }, { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireUI", "identifier" : "WireMoveToFolderUITests", "name" : "WireMoveToFolderUITests" } }, { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireUI", "identifier" : "WireAccountImageUITests", "name" : "WireAccountImageUITests" } }, { "target" : { - "containerPath" : "container:", + "containerPath" : "container:WireUI", "identifier" : "WireConversationListUITests", "name" : "WireConversationListUITests" } - }, - { - "target" : { - "containerPath" : "container:", - "identifier" : "WireSettingsUITests", - "name" : "WireSettingsUITests" - } } ], "version" : 1 diff --git a/fastlane/Fastfile b/fastlane/Fastfile index 1223a2f4e60..f3b305be417 100644 --- a/fastlane/Fastfile +++ b/fastlane/Fastfile @@ -3,6 +3,7 @@ require 'base64' require 'httparty' require 'json' require 'fastlane/action' +require_relative 'framework' opt_out_usage default_platform(:ios) @@ -41,12 +42,12 @@ platform :ios do before_all do |lane| ensure_xcode_version - create_keychain_if_needed unless [:prepare_for_tests].include?(lane) + create_keychain_if_needed unless [:prepare_for_tests, :select_frameworks, :generate_framework_list, :test_frameworks].include?(lane) `mkdir -p ./.post_build` Dir.chdir("..") do encoded_key = ENV['APPSTORE_API_KEY_BASE64'] if !File.exist?(appstoreconnect_api_key_file_path) && !encoded_key.nil? - puts "Setting AppStoreConnect API Key" + UI.message("Setting AppStoreConnect API Key") File.open(appstoreconnect_api_key_file_path, 'w+') {|f| f.write(Base64.decode64(encoded_key)) } end end @@ -56,10 +57,68 @@ platform :ios do begin delete_keychain if is_running_on_ci rescue - puts "No keychain found, skipping deletion..." + UI.verbose("No keychain found, skipping deletion...") end end + desc "Test frameworks given folders" + lane :test_frameworks do |options| + if options[:all] == "true" || options[:all] == "1" + schemas = Framework.all.values.map { |f| f.scheme } + else + if (options[:folders] == nil || options[:folders].empty?) && !is_running_on_ci + schemas = select_frameworks() + else + schemas = generate_framework_schemes(folders: options[:folders]) + end + end + + UI.message "🤖 No schemes to test" if schemas.empty? + + # hardcoded values that are required - not meaningful for testing + options[:build_type] = "Development" + options[:build_number] = 1 + build = Build.new(options: options) + + + UI.message "🤖 Testing schemas: #{schemas.join(', ')}" + + testplan = options[:testplan] || "AllTests" + schemas.each do |scheme| + UI.message "🤖 Testing scheme #{scheme} with plan #{testplan}" + test_plan(build, scheme, testplan) + end + end + + lane :select_frameworks do |options| + frameworks = Framework.all.values + select_all = "All" + framework_options = frameworks.map { |f| f.scheme } + [select_all] + + selected_choice = UI.select("Select a framework for testing:", framework_options) + if selected_choice == select_all + test_frameworks(all: "true") + else + framework = frameworks.find { |framework| framework.scheme == selected_choice } + + test_frameworks(folders: framework.name) + end + end + + desc "Generate list of frameworks' schemes to test from folders" + lane :generate_framework_schemes do |options| + frameworks = Framework.all + + folders = options[:folders].split(',') + matching_frameworks = folders.map { |folder| frameworks[folder] } + + unique_schemes = matching_frameworks.compact.map do |framework| + framework.schemes + end.flatten.uniq + + unique_schemes + end + desc "Prepare for tests" lane :prepare_for_tests do create_simulator_if_needed @@ -269,7 +328,9 @@ platform :ios do path: './wire-ios/Configuration/Release.xcconfig', name: 'WIRE_BUNDLE_ID' ) - puts "downloading provisioning profiles for bundle id: #{app_bundle_id}" + + UI.message("downloading provisioning profiles for bundle id: #{app_bundle_id}") + sigh( adhoc: build.should_sigh_adhoc, readonly: true, @@ -376,34 +437,53 @@ platform :ios do build = Build.new(options: options) for scheme in ["Wire-iOS", "WireDataModel", "WireSyncEngine"] do - run_tests( - testplan: "SecurityTests", - scheme: scheme, - skip_detect_devices: true, - configuration: "Debug", - # test_without_building: true, - sdk:"iphonesimulator", - destination: "platform=iOS Simulator,name=#{iPhoneNameForTesting},OS=#{ios_version}", - # code_coverage: true, - derived_data_path: "DerivedData", - buildlog_path: build.build_path, - output_directory: "#{build.artifact_path(with_filename: false)}/tests/#{scheme}", - output_types: "junit" - ) + test_plan(build, scheme, "SecurityTests") end end + + def test_plan(build, scheme, testplan) + if ENV['IOS_SIM_ID'].nil? + create_simulator_if_needed + end + if ENV['IOS_SIM_ID'].nil? + UI.user_error! "missing id for tests" + end + + run_tests( + testplan: testplan, + scheme: scheme, + skip_detect_devices: true, + configuration: "Debug", + # test_without_building: true, + sdk:"iphonesimulator", + destination: "platform=iOS Simulator,id=#{ENV['IOS_SIM_ID']},OS=#{ios_version}", + # code_coverage: true, + derived_data_path: "DerivedData", + buildlog_path: build.build_path, + result_bundle: true, + output_directory: "#{build.artifact_path(with_filename: false)}/tests/#{scheme}", + output_types: "junit", + cloned_source_packages_path: ENV['PACKAGES_DIR'], + disable_package_automatic_updates: true, + skip_package_dependencies_resolution: ENV["HAS_PACKAGES_CACHE_HIT"], + number_of_retries: 2 + ) + + end + def create_simulator_if_needed # Check if the simulator already exists existing_simulator = `xcrun simctl list devices | grep "#{iPhoneNameForTesting}" | grep "iOS#{ios_version}" | awk -F '[()]' '{print $2}'`.chomp if existing_simulator.empty? UI.message "create simulator #{iPhoneNameForTesting} - iOS#{ios_version}" - `xcrun simctl create "#{iPhoneNameForTesting} - iOS#{ios_version}" "#{iPhoneNameForTesting}" "iOS#{ios_version}"` + existing_simulator = `xcrun simctl create "#{iPhoneNameForTesting} - iOS#{ios_version}" "#{iPhoneNameForTesting}" "iOS#{ios_version}"` else UI.message "clear simulator content for #{existing_simulator}" `xcrun simctl erase #{existing_simulator}` end + ENV['IOS_SIM_ID'] = existing_simulator end # Upload to AppStore @@ -634,11 +714,6 @@ class Build @build_type == "Development" end - def internal_build - @build_type == "Internal" - end - - def rc_build @build_type == "RC" end @@ -707,8 +782,6 @@ class Build result = "playground-#{normalized_branch_name}/#{suffix}" when "Development" result = "development/#{suffix}" - when "Internal" - result = "internal/#{suffix}" when "AppStore" result = "release/appstore" when "RC" @@ -780,14 +853,11 @@ class Build "Wire-iOS-Playground" elsif development_build "Wire-iOS-Development" - elsif internal_build - "Wire-iOS-Internal" elsif appstore_build "Wire-iOS-App-Store" - elsif rc_build - "Wire-iOS-Release-Candidate" elsif beta_build "Wire-iOS-Beta" end end end + diff --git a/fastlane/framework.rb b/fastlane/framework.rb new file mode 100644 index 00000000000..4511089e6e0 --- /dev/null +++ b/fastlane/framework.rb @@ -0,0 +1,125 @@ +class Framework + attr_accessor :name, :dependencies, :relations + + def self.all + all_folders = [ + "wire-ios", + "wire-ios-canvas", + "wire-ios-cryptobox", + "wire-ios-data-model", + "wire-ios-images", + "wire-ios-link-preview", + "wire-ios-mocktransport", + "wire-ios-notification-engine", + "wire-ios-protos", + "wire-ios-request-strategy", + "wire-ios-share-engine", + "wire-ios-sync-engine", + "wire-ios-system", + "wire-ios-testing", + "wire-ios-transport", + "wire-ios-utilities", + "wire-ios-ziphy", + "WireAPI", + "WireAnalytics", + "WireDomain", + "WireUI", + "WireFoundation", + ] + + frameworks = all_folders.reduce({}) do |hash, framework| + hash["#{framework}"] ||= Framework.new(framework) + hash + end + + frameworks["wire-ios"].add_dependency(frameworks["wire-ios-notification-engine"]) + frameworks["wire-ios"].add_dependency(frameworks["wire-ios-share-engine"]) + frameworks["wire-ios"].add_dependency(frameworks["wire-ios-sync-engine"]) + frameworks["wire-ios"].add_dependency(frameworks["WireFoundation"]) + + + frameworks["wire-ios-notification-engine"].add_dependency(frameworks["wire-ios-request-strategy"]) + frameworks["wire-ios-sync-engine"].add_dependency(frameworks["wire-ios-request-strategy"]) + frameworks["wire-ios-sync-engine"].add_dependency(frameworks["WireAPI"]) + frameworks["wire-ios-sync-engine"].add_dependency(frameworks["WireDomain"]) + frameworks["wire-ios-sync-engine"].add_dependency(frameworks["WireAnalytics"]) + frameworks["wire-ios-share-engine"].add_dependency(frameworks["wire-ios-request-strategy"]) + + frameworks["wire-ios-request-strategy"].add_dependency(frameworks["wire-ios-data-model"]) + frameworks["wire-ios-request-strategy"].add_dependency(frameworks["WireAPI"]) + + frameworks["wire-ios-data-model"].add_dependency(frameworks["wire-ios-cryptobox"]) + frameworks["wire-ios-data-model"].add_dependency(frameworks["wire-ios-images"]) + frameworks["wire-ios-data-model"].add_dependency(frameworks["wire-ios-link-preview"]) + frameworks["wire-ios-data-model"].add_dependency(frameworks["wire-ios-protos"]) + frameworks["wire-ios-data-model"].add_dependency(frameworks["wire-ios-transport"]) + frameworks["wire-ios-data-model"].add_dependency(frameworks["WireFoundation"]) + + frameworks["wire-ios-mocktransport"].add_dependency(frameworks["wire-ios-testing"]) + frameworks["wire-ios-mocktransport"].add_dependency(frameworks["wire-ios-cryptobox"]) + frameworks["wire-ios-mocktransport"].add_dependency(frameworks["wire-ios-protos"]) + + frameworks["wire-ios-cryptobox"].add_dependency(frameworks["wire-ios-utilities"]) + frameworks["wire-ios-transport"].add_dependency(frameworks["wire-ios-utilities"]) + frameworks["wire-ios-link-preview"].add_dependency(frameworks["wire-ios-utilities"]) + frameworks["wire-ios-images"].add_dependency(frameworks["wire-ios-utilities"]) + + frameworks["wire-ios-utilities"].add_dependency(frameworks["wire-ios-system"]) + frameworks["wire-ios-utilities"].add_dependency(frameworks["WireFoundation"]) + + frameworks["wire-ios-testing"].add_dependency(frameworks["wire-ios-system"]) + + frameworks["WireDomain"].add_dependency(frameworks["wire-ios-transport"]) + frameworks["WireDomain"].add_dependency(frameworks["wire-ios-data-model"]) + frameworks["WireDomain"].add_dependency(frameworks["WireAPI"]) + frameworks["WireDomain"].add_dependency(frameworks["WireFoundation"]) + + frameworks["WireAPI"].add_dependency(frameworks["WireFoundation"]) + + frameworks + end + + def initialize(name) + @name = name + @dependencies = [] + @relations = [] + end + + def add_dependency(dependency) + @dependencies << dependency + dependency.relations << self + end + + def schemes + result = [scheme] + result << relations.map { |framework| framework.schemes } + result.flatten + end + + def scheme + to_scheme(name) + end + + private + + def to_scheme(name) + case name + when "wire-ios" + "Wire-iOS" + when "WireFoundation" + "WireFoundationAll" # use a custom scheme that includes all targets of WireFoundation, fastlane does not found WireUI-Package + when "WireUI" + "WireUIAll" # use a custom scheme that includes all targets of WireUI, fastlane does not found WireUI-Package + when "WireAPI" + "WireAPIAll" # if a package has multiple targets, fastlane does not found -Package + when "WireDomain" + name + when "WireAnalytics" + "WireAnalyticsAll" # if a package has multiple targets, fastlane does not found -Package + when "wire-ios-mocktransport" + "WireMockTransport" + else + name.gsub('ios-', '').split('-').map.with_index { |part, index| part.capitalize }.join + end + end +end diff --git a/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireAPIAll.xcscheme b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireAPIAll.xcscheme new file mode 100644 index 00000000000..0c37f1232b0 --- /dev/null +++ b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireAPIAll.xcscheme @@ -0,0 +1,112 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireAnalyticsAll.xcscheme b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireAnalyticsAll.xcscheme new file mode 100644 index 00000000000..36637a7d24d --- /dev/null +++ b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireAnalyticsAll.xcscheme @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireFoundationAll.xcscheme b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireFoundationAll.xcscheme new file mode 100644 index 00000000000..25ca2f8b510 --- /dev/null +++ b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireFoundationAll.xcscheme @@ -0,0 +1,114 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireUIAll.xcscheme b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireUIAll.xcscheme new file mode 100644 index 00000000000..0f349567f78 --- /dev/null +++ b/wire-ios-mono.xcworkspace/xcshareddata/xcschemes/WireUIAll.xcscheme @@ -0,0 +1,310 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +