|
| 1 | +name: GitHub Actions |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | +jobs: |
| 8 | + validation: |
| 9 | + name: Validation |
| 10 | + runs-on: macOS-11 |
| 11 | + strategy: |
| 12 | + matrix: |
| 13 | + xcode_version: |
| 14 | + - "12.2" |
| 15 | + env: |
| 16 | + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + |
| 20 | + - name: Get ruby gem cache |
| 21 | + id: gem-cache |
| 22 | + uses: actions/cache@v2 |
| 23 | + with: |
| 24 | + path: vendor/bundle |
| 25 | + key: ${{ runner.os }}-1-gem-${{ hashFiles('Gemfile.lock') }} |
| 26 | + restore-keys: ${{ runner.os }}-1-gem- |
| 27 | + |
| 28 | + - name: Install ruby gems |
| 29 | + if: steps.gem-cache.cache.outputs.cache-hit != 'true' |
| 30 | + run: make gem |
| 31 | + |
| 32 | + - name: Get SwiftPM cache |
| 33 | + uses: actions/cache@v2 |
| 34 | + with: |
| 35 | + path: Tools/.build |
| 36 | + key: ${{ runner.os }}-${{ matrix.xcode_version }}-1-spm-${{ hashFiles('Tools/Package.resolved') }} |
| 37 | + restore-keys: ${{ runner.os }}-${{ matrix.xcode_version }}-1-spm- |
| 38 | + |
| 39 | + - name: Podspec lint |
| 40 | + run: make pod-lib-lint |
| 41 | + |
| 42 | + - name: Validation |
| 43 | + run: make all && [ -z "$(git status --porcelain)" ] && make lint |
| 44 | + env: |
| 45 | + SPM_FORCE_BUILD: 1 |
| 46 | + |
| 47 | + test: |
| 48 | + name: Test on macOS |
| 49 | + runs-on: macOS-11.0 |
| 50 | + strategy: |
| 51 | + matrix: |
| 52 | + xcode_version: |
| 53 | + - "12.2" |
| 54 | + env: |
| 55 | + DEVELOPER_DIR: /Applications/Xcode_${{ matrix.xcode_version }}.app |
| 56 | + steps: |
| 57 | + - uses: actions/checkout@v2 |
| 58 | + - name: Show environments |
| 59 | + run: | |
| 60 | + swift --version |
| 61 | + xcodebuild -version |
| 62 | +
|
| 63 | + - name: Get ruby gem cache |
| 64 | + id: gem-cache |
| 65 | + uses: actions/cache@v2 |
| 66 | + with: |
| 67 | + path: vendor/bundle |
| 68 | + key: ${{ runner.os }}-1-gem-${{ hashFiles('Gemfile.lock') }} |
| 69 | + restore-keys: ${{ runner.os }}-1-gem- |
| 70 | + |
| 71 | + - name: Get npm cache |
| 72 | + id: npm-cache |
| 73 | + uses: actions/cache@v2 |
| 74 | + with: |
| 75 | + path: node_modules |
| 76 | + key: ${{ runner.os }}-0-npm-${{ hashFiles('package-lock.json') }} |
| 77 | + restore-keys: ${{ runner.os }}-0-npm- |
| 78 | + |
| 79 | + - name: Get CocoaPods cache |
| 80 | + id: cocoapods-cache |
| 81 | + uses: actions/cache@v2 |
| 82 | + with: |
| 83 | + path: Pods |
| 84 | + key: ${{ runner.os }}-1-cocoapods-${{ hashFiles('Example/Podfile.lock') }} |
| 85 | + restore-keys: ${{ runner.os }}-1-cocoapods- |
| 86 | + |
| 87 | + - name: Install npm packages |
| 88 | + if: steps.npm-cache.cache.outputs.cache-hit != 'true' |
| 89 | + run: make npm |
| 90 | + |
| 91 | + - name: Install ruby gems |
| 92 | + if: steps.gem-cache.cache.outputs.cache-hit != 'true' |
| 93 | + run: make gem |
| 94 | + |
| 95 | + - name: Install CocoaPods packages |
| 96 | + if: steps.cocoapods-cache.cache.outputs.cache-hit != 'true' |
| 97 | + run: pod-install |
| 98 | + |
| 99 | + - name: Generate snapshots |
| 100 | + run: set -o pipefail && xcodebuild build-for-testing test-without-building -workspace Example/Example.xcworkspace -scheme SampleApp -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 12 Pro' ENABLE_TESTABILITY=YES | xcpretty -c |
| 101 | + |
| 102 | + - name: Visual regression test |
| 103 | + run: npx percy upload Snapshots |
| 104 | + env: |
| 105 | + PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }} |
0 commit comments