|
| 1 | +# Podspec presubmit test setup |
| 2 | + |
| 3 | +Podspec presubmit test is to help ensure podspec is releasable. 'pod spec lint' will run for SDKs |
| 4 | +with sources of |
| 5 | + |
| 6 | +- https://github.com/firebase/SpecsTesting |
| 7 | +- https://github.com/firebase/SpecsDev.git |
| 8 | +- https://github.com/firebase/SpecsStaging.git |
| 9 | +- https://cdn.cocoapods.org/ |
| 10 | + |
| 11 | +where [SpecsTesting](https://github.com/firebase/SpecsTesting) is generated from the head of the |
| 12 | +master branch of [firebase-ios-sdk repo](https://github.com/firebase/firebase-ios-sdk). |
| 13 | + |
| 14 | +The [prerelease workflow](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/prerelease.yml#L11-L46) |
| 15 | +will update the [SpecsTesting repo](https://github.com/firebase/SpecsTesting) nightly from the |
| 16 | +head of the master branch. |
| 17 | +In order to let presubmit tests run on the latest podspec repo, [SpecsTesting repo](https://github.com/firebase/SpecsTesting) |
| 18 | +will be updated when a PR with changed podspecs is merged. |
| 19 | +When this PR is merged, changed podspecs will be `pod repo push`ed to the podspec repo in |
| 20 | +[postsubmit tests](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/prerelease.yml#L48-L94). |
| 21 | + |
| 22 | +Since `pod spec lint` will test podspecs with remote sources. One PR with changes on multiple |
| 23 | +podspecs are not encouraged. Changes with multiple podspecs, including their dependencies, might |
| 24 | +fail presubmit tests. |
| 25 | + |
| 26 | +## Set up presubmit tests |
| 27 | + |
| 28 | +To set up presubmit tests, we can add a new job in SDK workflows. An example of `FirebaseDatabase` |
| 29 | +is shown below. |
| 30 | +`github.event.pull_request.merged != true && github.event.action != 'closed'` is to trigger this |
| 31 | +job in presubmit. |
| 32 | +``` |
| 33 | + podspec-presubmit: |
| 34 | + # Don't run on private repo unless it is a PR. |
| 35 | + if: github.repository == 'Firebase/firebase-ios-sdk' && github.event.pull_request.merged != true && github.event.action != 'closed' |
| 36 | + runs-on: macOS-latest |
| 37 | + steps: |
| 38 | + - uses: actions/checkout@v2 |
| 39 | + - name: Setup Bundler |
| 40 | + run: scripts/setup_bundler.sh |
| 41 | + - name: Build and test |
| 42 | + run: scripts/third_party/travis/retry.sh pod spec lint FirebaseDatabase.podspec --skip-tests --sources='https://github.com/firebase/SpecsTesting','https://github.com/firebase/SpecsDev.git','https://github.com/firebase/SpecsStaging.git','https://cdn.cocoapods.org/' |
| 43 | +
|
| 44 | +``` |
| 45 | + |
| 46 | +Once a PR is merged, [`update_SpecsTesting_repo` job](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/prerelease.yml#L48) |
| 47 | +in the [prerelease workflow](https://github.com/firebase/firebase-ios-sdk/blob/master/.github/workflows/prerelease.yml) |
| 48 | +will automatically `pod repo push` changed podspecs in postsubmits, |
0 commit comments