-
Notifications
You must be signed in to change notification settings - Fork 10
136 lines (128 loc) · 4.77 KB
/
ios.yaml
File metadata and controls
136 lines (128 loc) · 4.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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 }}