|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + workflow_dispatch: |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 8 | + cancel-in-progress: true |
| 9 | +defaults: |
| 10 | + run: |
| 11 | + shell: bash |
| 12 | + |
| 13 | +jobs: |
| 14 | + tests: |
| 15 | + name: Integration and Unit tests |
| 16 | + runs-on: macos-12 |
| 17 | + strategy: |
| 18 | + matrix: |
| 19 | + environment: [iOS, tvOS, macOS] |
| 20 | + steps: |
| 21 | + - name: Checkout repository |
| 22 | + uses: actions/checkout@v3 |
| 23 | + with: |
| 24 | + token: ${{ secrets.GH_TOKEN }} |
| 25 | + - name: Setup Ruby 2.6.6 |
| 26 | + uses: ruby/setup-ruby@v1 |
| 27 | + with: |
| 28 | + ruby-version: 2.6.6 |
| 29 | + bundler-cache: true |
| 30 | + - name: Cache installed Pods |
| 31 | + uses: actions/cache@v3 |
| 32 | + with: |
| 33 | + path: Pods |
| 34 | + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} |
| 35 | + restore-keys: | |
| 36 | + ${{ runner.os }}-pods- |
| 37 | + - name: Cache Swift Package Manager |
| 38 | + uses: actions/cache@v3 |
| 39 | + with: |
| 40 | + path: | |
| 41 | + .build |
| 42 | + ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts |
| 43 | + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |
| 44 | + restore-keys: | |
| 45 | + ${{ runner.os }}-spm- |
| 46 | + - name: Pre-load simulators list |
| 47 | + if: ${{ matrix.environment != 'macOS' }} |
| 48 | + run: xcrun simctl list -j |
| 49 | + - name: Run ${{ matrix.environment }} unit tests |
| 50 | + run: bundle exec fastlane test --env $(echo ${{ matrix.environment }} | tr '[:upper:]' '[:lower:]') |
| 51 | + acceptance-tests: |
| 52 | + name: Acceptance tests |
| 53 | + runs-on: macos-12 |
| 54 | + steps: |
| 55 | + - name: Checkout repository |
| 56 | + uses: actions/checkout@v3 |
| 57 | + - name: Setup Ruby 2.6.6 |
| 58 | + uses: ruby/setup-ruby@v1 |
| 59 | + with: |
| 60 | + ruby-version: 2.6.6 |
| 61 | + bundler-cache: true |
| 62 | + - name: Cache installed Pods |
| 63 | + uses: actions/cache@v3 |
| 64 | + with: |
| 65 | + path: Pods |
| 66 | + key: ${{ runner.os }}-pods-${{ hashFiles('**/Podfile.lock') }} |
| 67 | + restore-keys: | |
| 68 | + ${{ runner.os }}-pods- |
| 69 | + - name: Cache Swift Package Manager |
| 70 | + uses: actions/cache@v3 |
| 71 | + with: |
| 72 | + path: | |
| 73 | + .build |
| 74 | + ~/Library/Developer/Xcode/DerivedData/**/SourcePackages/checkouts |
| 75 | + key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} |
| 76 | + restore-keys: | |
| 77 | + ${{ runner.os }}-spm- |
| 78 | + - name: Checkout mock-server action |
| 79 | + uses: actions/checkout@v3 |
| 80 | + with: |
| 81 | + repository: pubnub/client-engineering-deployment-tools |
| 82 | + ref: v1 |
| 83 | + token: ${{ secrets.GH_TOKEN }} |
| 84 | + path: .github/.release/actions |
| 85 | + - name: Run mock server action |
| 86 | + uses: ./.github/.release/actions/actions/mock-server |
| 87 | + with: |
| 88 | + token: ${{ secrets.GH_TOKEN }} |
| 89 | + features-path: Tests/PubNubContractTest/Features/ |
| 90 | + - name: Preapre Xcode environment |
| 91 | + run: | |
| 92 | + bundle install --jobs=3 --retry=3 |
| 93 | + bundle exec pod install |
| 94 | + - name: Run stable acceptance tests |
| 95 | + run: | |
| 96 | + bundle exec fastlane contract_test --env contract |
| 97 | + mv Results/CucumberishTestResults-PubNubContractTests.json Results/main.json |
| 98 | + - name: Run beta acceptance tests |
| 99 | + run: | |
| 100 | + bundle exec fastlane contract_test --env contract-beta && FASTLANE_EXITCODE="${PIPESTATUS[0]}" |
| 101 | + mv Results/CucumberishTestResults-PubNubContractTestsBeta.json Results/beta.json |
| 102 | + - name: Upload acceptance tests reports |
| 103 | + uses: actions/upload-artifact@v3 |
| 104 | + with: |
| 105 | + name: acceptance-test-reports |
| 106 | + path: Results/*.json |
| 107 | + retention-days: 7 |
0 commit comments