[iOS] Fix inaccurate timestamp on crash reports #4434
This file contains hidden or 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: ios | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| # Cancel in-progress CI jobs when a new commit is pushed to a PR. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| jobs: | |
| pre_check: | |
| name: pre_check | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_run: ${{ steps.check_changes.outputs.run_tests }} | |
| steps: | |
| # Checkout repo to Github Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Check for Bazel build file changes | |
| id: bazel_check | |
| run: | | |
| ./ci/check_bazel.sh //examples/swift:ios_app //platform/swift //test/platform/swift | |
| continue-on-error: true | |
| - name: Check for workflow file changes | |
| id: workflow_check | |
| run: | | |
| ./ci/files_changed.sh .github/workflows/ios.yaml MODULE.bazel MODULE.bazel.lock | |
| continue-on-error: true | |
| - name: Determine if tests should run | |
| id: check_changes_separate | |
| run: | | |
| bazel_status="${{ steps.bazel_check.outputs.check_result }}" | |
| workflow_status="${{ steps.workflow_check.outputs.check_result }}" | |
| # Log the values of bazel_status and workflow_status for diagnostics | |
| echo "bazel_status: $bazel_status" | |
| echo "workflow_status: $workflow_status" | |
| # Check if any status indicates a relevant change or error | |
| if [[ "$bazel_status" == "1" || "$workflow_status" == "1" ]]; then | |
| echo "An unexpected issue occurred during checks." | |
| exit 1 | |
| elif [[ "$bazel_status" == "0" || "$workflow_status" == "0" ]]; then | |
| echo "Changes detected in one or more checks. Running tests." | |
| echo "run_tests=true" >> $GITHUB_ENV | |
| elif [[ "$bazel_status" == "2" && "$workflow_status" == "2" ]]; then | |
| echo "No relevant changes found." | |
| echo "run_tests=false" >> $GITHUB_ENV | |
| else | |
| echo "Unknown issue." | |
| exit 1 | |
| fi | |
| shell: bash | |
| - name: Run downstream tests if changes are detected | |
| id: check_changes | |
| if: env.run_tests == 'true' | |
| run: ./ci/run_tests.sh | |
| swift_hello_world: | |
| name: swift_hello_world | |
| timeout-minutes: 40 | |
| needs: "pre_check" | |
| if: needs.pre_check.outputs.should_run == 'true' | |
| runs-on: macos-15 | |
| steps: | |
| # Checkout repo to Github Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bazel | |
| uses: bazel-contrib/setup-bazel@0.15.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }}-${{ github.job }} | |
| repository-cache: true | |
| - name: "Install dependencies" | |
| run: ./ci/mac_ci_setup.sh | |
| - run: ./bazelw build --config ci --config release-ios //examples/swift/hello_world:ios_app | |
| name: "Build app" | |
| # TODO(snowp): Add some kind of assertion that the app does that it's supposed to | |
| - run: ./bazelw run --config ci --config release-ios //examples/swift/hello_world:ios_app &> /tmp/envoy.log & | |
| name: "Run app" | |
| unit_tests: | |
| name: unit tests | |
| needs: "pre_check" | |
| if: needs.pre_check.outputs.should_run == 'true' | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Install dependencies | |
| run: | | |
| HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 brew install protobuf flatbuffers | |
| echo "/opt/homebrew/opt/protobuf/bin" >> "$GITHUB_PATH" | |
| echo "/opt/homebrew/opt/flatbuffers/bin" >> "$GITHUB_PATH" | |
| - name: Rust tests | |
| run: SKIP_PROTO_GEN=1 cargo test --package swift_bridge | |
| tests: | |
| runs-on: macos-14 | |
| needs: "pre_check" | |
| if: needs.pre_check.outputs.should_run == 'true' | |
| steps: | |
| # Checkout repo to Github Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Bazel | |
| uses: bazel-contrib/setup-bazel@0.15.0 | |
| with: | |
| bazelisk-cache: true | |
| disk-cache: ${{ github.workflow }}-${{ github.job }} | |
| repository-cache: true | |
| - name: "Install dependencies" | |
| run: ./ci/mac_ci_setup.sh | |
| - name: Run iOS tests | |
| run: env -u ANDROID_NDK_HOME ./bazelw test $(./bazelw query 'kind(ios_unit_test, //test/platform/swift/unit_integration/...)') --test_tag_filters=macos_only --test_output=errors --config ci --config ios | |
| verify_ios: | |
| runs-on: ubuntu-latest | |
| needs: ["tests", "swift_hello_world", "unit_tests"] | |
| if: always() | |
| steps: | |
| # Checkout repo to Github Actions runner | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 1 | |
| - run: | | |
| ./ci/check_result.sh ${{ needs.tests.result }} \ | |
| && ./ci/check_result.sh ${{ needs.swift_hello_world.result }} |