Main Branch Health #436
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: "Main Branch Health" | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "0 7 * * *" | |
env: | |
XCODE_VERSION: "15.4" | |
jobs: | |
tuist-generation: | |
runs-on: macos-latest | |
timeout-minutes: 8 | |
name: Run Tuist Generation | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Run Tuist Generation | |
uses: ./.github/actions/run-tuist-generation | |
- name: Cache Build Dependencies | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./ApolloDev.xcodeproj | |
./ApolloDev.xcworkspace | |
./Derived/* | |
key: ${{ github.run_id }}-dependencies | |
run-swift-builds: | |
runs-on: macos-latest | |
timeout-minutes: 15 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: apollo-ios | |
- package: apollo-ios-codegen | |
- package: apollo-ios-pagination | |
name: Run swift build for SPM packages | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Run Swift Build | |
shell: bash | |
run: | | |
cd ${{ matrix.package }} && swift build | |
build-and-unit-test: | |
runs-on: macos-latest | |
needs: tuist-generation | |
timeout-minutes: 20 | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
# macOS_current | |
- destination: platform=macOS,arch=x86_64 | |
scheme: ApolloTests | |
test-plan: Apollo-CITestPlan | |
name: Apollo Unit Tests - macOS | |
run-js-tests: false | |
# iOS_current | |
- destination: platform=iOS Simulator,OS=17.0,name=iPhone 15 | |
scheme: ApolloTests | |
test-plan: Apollo-CITestPlan | |
name: Apollo Unit Tests - iOS 17.0 | |
run-js-tests: false | |
# tvOS_current | |
- destination: platform=tvOS Simulator,OS=17.0,name=Apple TV | |
scheme: ApolloTests | |
test-plan: Apollo-CITestPlan | |
name: Apollo Unit Tests - tvOS ${{ vars.TVOS_VERSION }} | |
run-js-tests: false | |
# Codegen CLI Test | |
- destination: platform=macOS,arch=x86_64 | |
scheme: CodegenCLITests | |
test-plan: CodegenCLITestPlan | |
name: Codegen CLI Unit Tests - macOS | |
run-js-tests: false | |
# CodegenLib Test | |
- destination: platform=macOS,arch=x86_64 | |
scheme: ApolloCodegenTests | |
test-plan: Apollo-Codegen-CITestPlan | |
name: Codegen Lib Unit Tests - macOS | |
run-js-tests: true | |
# ApolloPagination Tests | |
- destination: platform=macOS,arch=x86_64 | |
scheme: ApolloPaginationTests | |
test-plan: Apollo-PaginationTestPlan | |
name: ApolloPagination Unit Tests - macOS | |
run-js-tests: false | |
name: ${{ matrix.name }} | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Retrieve Build Cache | |
uses: actions/cache@v3 | |
with: | |
path: | | |
./ApolloDev.xcodeproj | |
./ApolloDev.xcworkspace | |
./Derived/* | |
key: ${{ github.run_id }}-dependencies | |
fail-on-cache-miss: true | |
- name: Build and Test | |
uses: ./.github/actions/build-and-run-unit-tests | |
with: | |
destination: ${{ matrix.destination }} | |
scheme: ${{ matrix.scheme }} | |
test-plan: ${{ matrix.test-plan }} | |
- name: Run-JS-Tests | |
if: ${{ matrix.run-js-tests == true }} | |
shell: bash | |
working-directory: apollo-ios-codegen/Sources/GraphQLCompiler/JavaScript/ | |
run: | | |
npm install && npm test | |
- name: Save xcodebuild logs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}-logs | |
path: | | |
DerivedData/Logs/Build | |
- name: Save crash logs | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}-crashes | |
path: | | |
~/Library/Logs/DiagnosticReports | |
- name: Zip Result Bundle | |
if: ${{ failure() }} | |
shell: bash | |
working-directory: TestResults | |
run: | | |
zip -r ResultBundle.zip ResultBundle.xcresult | |
- name: Save test results | |
if: ${{ failure() }} | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.name }}-results | |
path: | | |
TestResults/ResultBundle.zip | |
run-codegen-test-configurations: | |
runs-on: macos-latest | |
timeout-minutes: 20 | |
name: Codegen Test Configurations - macOS | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Test Codegen Configurations | |
shell: bash | |
run: | | |
./scripts/run-test-codegen-configurations.sh -t | |
run-cocoapods-integration-tests: | |
runs-on: macos-latest | |
timeout-minutes: 20 | |
name: Cocoapods Integration Tests - macOS | |
steps: | |
- uses: maxim-lobanov/setup-xcode@v1 | |
with: | |
xcode-version: ${{ env.XCODE_VERSION }} | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Export ENV Variables | |
shell: bash | |
working-directory: apollo-ios | |
run: | | |
apollo_ios_sha=$(git rev-parse HEAD) | |
echo "APOLLO_IOS_SHA=$apollo_ios_sha" >> ${GITHUB_ENV} | |
- name: Run CocoaPods Integration Tests | |
id: run-cocoapods-integration-tests | |
uses: ./.github/actions/run-cocoapods-integration-tests | |
send-slack-status-notification: | |
runs-on: macos-latest | |
if: ${{ always() }} | |
timeout-minutes: 5 | |
needs: [tuist-generation, run-swift-builds, build-and-unit-test, run-codegen-test-configurations, run-cocoapods-integration-tests] | |
name: Send Slack status notification | |
steps: | |
- uses: slackapi/slack-github-action@v1.26.0 | |
with: | |
channel-id: ${{ secrets.APOLLO_IOS_HEALTH_SLACK_CHANNEL_ID }} | |
payload: | | |
{ | |
"blocks": [ | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "`main` Branch Health (${{ github.sha }}):" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Run Tuist Generation: ${{ needs.tuist-generation.result }}" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Build SPM packages: ${{ needs.run-swift-builds.result }}" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Build and Unit Test: ${{ needs.build-and-unit-test.result }}" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Codegen Test Configurations - macOS: ${{ needs.run-codegen-test-configurations.result }}" | |
} | |
}, | |
{ | |
"type": "section", | |
"text": { | |
"type": "mrkdwn", | |
"text": "Cocoapods Integration Tests - macOS: ${{ needs.run-cocoapods-integration-tests.result }}" | |
} | |
} | |
] | |
} | |
slack-message: | |
env: | |
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }} |