This repository has been archived by the owner. It is now read-only.
Permalink
237 lines (204 sloc)
7.81 KB
| # Xcode | |
| # Build, test, and archive an Xcode workspace on macOS. | |
| # Add steps that install certificates, test, sign, and distribute an app, save build artifacts, and more: | |
| # https://docs.microsoft.com/azure/devops/pipelines/languages/xcode | |
| jobs: | |
| # Job to Build the Browsers | |
| - job: Cliqz_IOS_CI_Build | |
| timeoutInMinutes: 60 | |
| strategy: | |
| matrix: | |
| Ghostery: | |
| brand: 'ghostery' | |
| scheme: 'Fennec' | |
| actions: 'clean build test' | |
| testbranch: 'master' | |
| Lumen: | |
| brand: 'lumen' | |
| scheme: 'Lumen' | |
| actions: 'clean build' | |
| testbranch: 'web-performance' | |
| pool: | |
| vmImage: 'macOS 10.13' | |
| steps: | |
| - bash: | | |
| sudo xcode-select --switch /Applications/Xcode_10.1.app | |
| displayName: 'Change XCode to 10.1' | |
| - script: $(which carthage) bootstrap --verbose --platform ios --color auto --cache-builds | |
| displayName: 'Carthage Bootstrap' | |
| - task: NodeTool@0 | |
| displayName: 'Define Node to v9.11.2' | |
| inputs: | |
| versionSpec: '9.11.2' | |
| - bash: | | |
| set -x | |
| npm i -g npm@6.5 | |
| /usr/local/bin/npm ci | |
| /usr/local/bin/npm run bundle-ghostery | |
| displayName: 'Install and Build React Native' | |
| - bash: | | |
| gem install cocoapods -v 1.5.3 | |
| pod _1.5.3_ install | |
| displayName: 'POD install' | |
| - script: xcodebuild -workspace Client.xcworkspace -scheme $(scheme) -sdk iphonesimulator -destination "platform=iOS Simulator,OS=12.1,name=iPhone 6s" OTHER_SWIFT_FLAGS='$(value) -DAUTOMATION' ONLY_ACTIVE_ARCH=NO -derivedDataPath $(actions) | |
| displayName: 'Xcode Build for Simulator' | |
| - task: ArchiveFiles@2 | |
| displayName: 'Archive Build' | |
| inputs: | |
| rootFolderOrFile: 'clean/Build/Products/$(scheme)-iphonesimulator/Client.app' | |
| archiveType: 'zip' | |
| tarCompression: 'none' | |
| archiveFile: '$(Build.ArtifactStagingDirectory)/$(scheme).zip' | |
| - task: PublishBuildArtifacts@1 | |
| displayName: 'Publish Build' | |
| inputs: | |
| pathtoPublish: '$(Build.ArtifactStagingDirectory)' | |
| artifactName: $(scheme) | |
| # Job to Test the Build | |
| - job: Cliqz_IOS_CI_Test | |
| dependsOn: Cliqz_IOS_CI_Build | |
| condition: and(succeeded(), eq(variables['Build.SourceBranchName'], 'master')) | |
| timeoutInMinutes: 120 | |
| strategy: | |
| matrix: | |
| Ghostery: | |
| brand: 'ghostery' | |
| scheme: 'Fennec' | |
| testbranch: 'azure-pipelines' | |
| Lumen: | |
| brand: 'lumen' | |
| scheme: 'Lumen' | |
| testbranch: 'web-performance' | |
| pool: | |
| vmImage: 'macOS 10.13' | |
| steps: | |
| - script: git clone https://github.com/cliqz-oss/cliqz-mobile-tests.git --branch $(testbranch) --single-branch | |
| displayName: Clone Tests Repo | |
| - bash: | | |
| sudo xcode-select --switch /Applications/Xcode_10.1.app | |
| xcrun simctl create Test-iPhone6s com.apple.CoreSimulator.SimDeviceType.iPhone-6s com.apple.CoreSimulator.SimRuntime.iOS-12-1 > cliqz-mobile-tests/dev.id | |
| xcrun simctl boot $(cat cliqz-mobile-tests/dev.id) | |
| sleep 10 | |
| xcrun simctl list | |
| displayName: 'Create a Test Simulator' | |
| - task: NodeTool@0 | |
| displayName: 'Define Node to v11.11' | |
| inputs: | |
| versionSpec: '11.10' | |
| - task: DownloadBuildArtifacts@0 | |
| displayName: 'Download Build' | |
| inputs: | |
| artifactName: $(scheme) | |
| downloadPath: $(System.DefaultWorkingDirectory) | |
| - task: ExtractFiles@1 | |
| inputs: | |
| archiveFilePatterns: '$(scheme)/$(scheme).zip' | |
| destinationFolder: 'build/' | |
| cleanDestinationFolder: true | |
| - bash: | | |
| xcrun simctl boot $(cat dev.id) | |
| xcrun simctl install booted build/Client.app/ | |
| cd cliqz-mobile-tests | |
| npm install --global npm json-stringify-safe | |
| source azure-scripts/setup.sh ios | |
| sleep 10 | |
| source azure-scripts/appium.sh | |
| source run.sh | |
| source azure-scripts/cleanup.sh ios | |
| condition: and(eq(variables['brand'], 'lumen'), eq(variables['Build.SourceBranchName'], 'master')) | |
| displayName: 'Setup and Run Tests' | |
| - script: pip install awscli | |
| condition: and(eq(variables['brand'], 'lumen'), eq(variables['Build.SourceBranchName'], 'master')) | |
| displayName: 'Install AWS CLI' | |
| - bash: | | |
| DATE=`date '+%Y-%m-%d_%H-%M-%S'` | |
| aws s3 cp cliqz-mobile-tests/reports/Data.txt s3://cliqz-test-artifact-upload/dump/$DATE.txt | |
| aws s3 cp cliqz-mobile-tests/reports/Performance.xls s3://cliqz-test-artifact-upload/xls/$DATE.xls | |
| env: | |
| AWS_ACCESS_KEY_ID: $(aws.keyid) | |
| AWS_SECRET_ACCESS_KEY: $(aws.secret) | |
| AWS_DEFAULT_REGION: $(aws.region) | |
| AWS_DEFAULT_OUTPUT: text | |
| condition: and(eq(variables['brand'], 'lumen'), eq(variables['Build.SourceBranchName'], 'master')) | |
| displayName: 'Copy to AWS S3' | |
| - bash: | | |
| echo "*** Performance Test Results ***" | |
| cat cliqz-mobile-tests/reports/performance.txt | |
| condition: and(eq(variables['brand'], 'lumen'), eq(variables['Build.SourceBranchName'], 'master')) | |
| displayName: 'Print Results/Reports' | |
| - task: ArchiveFiles@2 | |
| condition: and(always(), eq(variables['brand'], 'lumen'), eq(variables['Build.SourceBranchName'], 'master')) | |
| displayName: 'Archive Performance Result' | |
| inputs: | |
| rootFolderOrFile: 'cliqz-mobile-tests/reports/' | |
| archiveType: 'zip' | |
| tarCompression: 'none' | |
| archiveFile: '$(Build.ArtifactStagingDirectory)/performance.zip' | |
| - task: PublishBuildArtifacts@1 | |
| condition: and(always(), eq(variables['brand'], 'lumen'), eq(variables['Build.SourceBranchName'], 'master')) | |
| displayName: 'Publish Artifacts' | |
| inputs: | |
| pathtoPublish: '$(Build.ArtifactStagingDirectory)' | |
| artifactName: '$(Build.BuildId)' | |
| publishLocation: 'Container' | |
| - bash: | | |
| export DEV_NAME="Test-iPhone6s" | |
| export DEV_UDID=$(cat dev.id) | |
| xcrun simctl boot $(cat dev.id) | |
| xcrun simctl install booted build/Client.app/ | |
| sleep 10 | |
| cd cliqz-mobile-tests | |
| source scripts/azure-scripts/setup.sh ios | |
| source scripts/azure-scripts/envs.sh ios | |
| source scripts/azure-scripts/appium.sh | |
| python testRunner.py || true | |
| source scripts/azure-scripts/cleanup.sh ios | |
| condition: ne(variables['brand'], 'lumen') | |
| displayName: 'Setup and Run Tests' | |
| - bash: | | |
| echo "*** Appium Test Reports ***" | |
| cat cliqz-mobile-tests/*-testreport.log | |
| condition: ne(variables['brand'], 'lumen') | |
| displayName: 'Print Results/Reports' | |
| - task: PublishTestResults@2 | |
| condition: and(always(), ne(variables['brand'], 'lumen')) | |
| displayName: 'Publish JUnit Test' | |
| inputs: | |
| testResultsFormat: 'JUnit' | |
| testResultsFiles: 'cliqz-mobile-tests/test-reports/*.xml' | |
| - task: ArchiveFiles@2 | |
| condition: and(always(), ne(variables['brand'], 'lumen')) | |
| displayName: 'Archive Screenshots' | |
| inputs: | |
| rootFolderOrFile: 'cliqz-mobile-tests/screenshots' | |
| archiveType: 'zip' | |
| tarCompression: 'none' | |
| archiveFile: '$(Build.ArtifactStagingDirectory)/screenshots.zip' | |
| - task: ArchiveFiles@2 | |
| condition: and(always(), ne(variables['brand'], 'lumen')) | |
| displayName: 'Archive Logs' | |
| inputs: | |
| rootFolderOrFile: 'cliqz-mobile-tests/logs' | |
| archiveType: 'zip' | |
| tarCompression: 'none' | |
| archiveFile: '$(Build.ArtifactStagingDirectory)/logs.zip' | |
| - task: ArchiveFiles@2 | |
| condition: and(always(), ne(variables['brand'], 'lumen')) | |
| displayName: 'Archive Reports Folder' | |
| inputs: | |
| rootFolderOrFile: 'cliqz-mobile-tests/test-reports' | |
| archiveType: 'zip' | |
| tarCompression: 'none' | |
| archiveFile: '$(Build.ArtifactStagingDirectory)/reports.zip' | |
| - task: PublishBuildArtifacts@1 | |
| condition: and(always(), ne(variables['brand'], 'lumen')) | |
| displayName: 'Publish Artifacts' | |
| inputs: | |
| pathtoPublish: '$(Build.ArtifactStagingDirectory)' | |
| artifactName: '$(Build.BuildId)' | |
| publishLocation: 'Container' | |
| - bash: | | |
| cd cliqz-mobile-tests | |
| source scripts/azure-scripts/parseReports.sh | |
| condition: ne(variables['brand'], 'lumen') | |
| displayName: 'Parse Reports' |