spm #191
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: spm | |
on: | |
pull_request: | |
schedule: | |
# Run every day at 11pm (PST) - cron uses UTC times | |
- cron: '0 7 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
changed_today: | |
runs-on: ubuntu-latest | |
name: Check if the repo was updated today | |
outputs: | |
WAS_CHANGED: ${{ steps.check_changed.outputs.WAS_CHANGED }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: check_changed | |
name: Check | |
if: ${{ github.event_name == 'schedule' }} | |
run: echo '::set-output name=WAS_CHANGED::'$(test -n "$(git log --format=%H --since='24 hours ago')" && echo 'true' || echo 'false') | |
spm-package-resolved: | |
runs-on: macos-14 | |
outputs: | |
cache_key: ${{ steps.generate_cache_key.outputs.cache_key }} | |
env: | |
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 | |
FIREBASE_MAIN: 1 | |
DISABLE_INTEGRATION_TESTS: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Generate Swift Package.resolved | |
id: swift_package_resolve | |
run: | | |
swift package resolve | |
- name: Generate cache key | |
id: generate_cache_key | |
run: | | |
cache_key="${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }}" | |
echo "cache_key=${cache_key}" >> "$GITHUB_OUTPUT" | |
- uses: actions/cache/save@v4 | |
id: cache | |
with: | |
path: .build | |
key: ${{ runner.os }}-spm-${{ hashFiles('**/Package.resolved') }} | |
spm: | |
needs: [changed_today, spm-package-resolved] | |
if: ${{ github.event_name == 'pull_request' || needs.changed_today.outputs.WAS_CHANGED == 'true' }} | |
strategy: | |
matrix: | |
os: [macos-14] | |
# GitHub actions' runners do not include visionOS. https://github.com/actions/runner-images/issues/10559 | |
target: [iOS, tvOS, macOS, catalyst] | |
xcode: [Xcode_15.2, Xcode_15.4, Xcode_16] | |
runs-on: ${{ matrix.os }} | |
env: | |
FIREBASECI_USE_LATEST_GOOGLEAPPMEASUREMENT: 1 | |
FIREBASE_MAIN: 1 | |
DISABLE_INTEGRATION_TESTS: 1 | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/cache/restore@v4 | |
with: | |
path: .build | |
key: ${{needs.spm-package-resolved.outputs.cache_key}} | |
- name: Xcode | |
run: sudo xcode-select -s /Applications/${{ matrix.xcode }}.app/Contents/Developer | |
- name: Setup Scripts Directory | |
run: ./setup-scripts.sh | |
- name: Unit Tests | |
run: scripts/third_party/travis/retry.sh scripts/build.sh FirebaseDataConnect ${{ matrix.target }} spm |