name: spectesting on: pull_request concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} cancel-in-progress: true jobs: specs_checking: # Don't run on private repo unless it is a PR. if: github.repository == 'Firebase/firebase-ios-sdk' runs-on: macos-12 outputs: matrix: ${{ steps.check_files.outputs.matrix }} podspecs: ${{ steps.check_files.outputs.podspecs }} steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - name: check files id: check_files env: pr_branch: ${{ github.event.pull_request.head.ref }} run: | # The output.json will have podspecs that will be tested. # ``` output.json # [{"podspec":"FirebaseABTesting.podspec"},{"podspec":"FirebaseAnalytics.podspec"}] # ``` # This array will help generate a matrix for jobs in GHA, taking # advantage of `include`. # https://docs.github.com/en/actions/learn-github-actions/workflow-syntax-for-github-actions#example-including-additional-values-into-combinations # The final matrix will be set as an env var in the GHA workflow, # This env var, matrix, will be passed as a matrix in the next job of # the workflow. # If multiple podspecs need to be excluded, escaping space is required # to split podspecs, e.g. get_updated_files.sh ... -e Firebase.podspec\ FirebaseABTesting.podspec ./scripts/health_metrics/get_updated_files.sh -p output.json -e Firebase.podspec\ FirebaseFunctions.podspec echo "::set-output name=matrix::{\"include\":$( cat output.json )}" # `podspecs` is to help determine if specs_testing job should be run. echo "::set-output name=podspecs::$(cat output.json)" specs_testing: needs: specs_checking if: ${{ needs.specs_checking.outputs.podspecs != '[]' }} runs-on: macos-12 strategy: fail-fast: false matrix: ${{fromJson(needs.specs_checking.outputs.matrix)}} env: PODSPEC: ${{ matrix.podspec }} steps: - name: Checkout code uses: actions/checkout@v3 with: fetch-depth: 0 - name: Init podspecs and source run: | mkdir specTestingLogs cd ReleaseTooling swift run podspecs-tester --git-root "${GITHUB_WORKSPACE}" --podspec ${PODSPEC} --skip-tests --temp-log-dir "${GITHUB_WORKSPACE}/specTestingLogs" - name: Upload Failed Testing Logs if: failure() uses: actions/upload-artifact@v2 with: name: specTestingLogs path: specTestingLogs/*.txt