Skip to content

Commit

Permalink
ci: run mobile GitHub Actions on every PR (#24407)
Browse files Browse the repository at this point in the history
But early-exit for changes that shouldn't impact Envoy Mobile.

On top of `mobile/**` changes and changes to workflow files, now when
Envoy dependencies are updated in `bazel/repository_locations.bzl`,
mobile CI jobs will run too.

Signed-off-by: JP Simard <jp@jpsim.com>
  • Loading branch information
jpsim committed Dec 7, 2022
1 parent e521eda commit 11ca6cd
Show file tree
Hide file tree
Showing 12 changed files with 220 additions and 192 deletions.
44 changes: 38 additions & 6 deletions .github/workflows/android_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ on:
push:
branches:
- main
paths:
- 'mobile/**'
- '.github/workflows/**'
pull_request:
paths:
- 'mobile/**'
- '.github/workflows/**'

jobs:
androidbuild:
Expand All @@ -19,15 +13,21 @@ jobs:
timeout-minutes: 90
steps:
- uses: actions/checkout@v1
- id: should_run
name: 'Check whether to run'
run: ./mobile/tools/should_run_ci.sh
- uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
if: steps.should_run.outputs.run_ci_job == 'true'
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh --android
- name: 'Build envoy.aar distributable'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -43,20 +43,27 @@ jobs:
timeout-minutes: 50
steps:
- uses: actions/checkout@v1
- id: should_run
name: 'Check whether to run'
run: ./mobile/tools/should_run_ci.sh
- uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
if: steps.should_run.outputs.run_ci_job == 'true'
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- run: cd mobile && ./ci/mac_ci_setup.sh --android
if: steps.should_run.outputs.run_ci_job == 'true'
name: 'Install dependencies'
- name: 'Start simulator'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_start_emulator.sh
# Return to using:
# cd mobile && ./bazelw mobile-install --fat_apk_cpu=x86_64 --start_app //examples/java/hello_world:hello_envoy
# When https://github.com/envoyproxy/envoy-mobile/issues/853 is fixed.
- name: 'Start java app'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -68,6 +75,7 @@ jobs:
adb install -r --no-incremental bazel-bin/examples/java/hello_world/hello_envoy.apk
adb shell am start -n io.envoyproxy.envoymobile.helloenvoy/.MainActivity
- name: 'Check connectivity'
if: steps.should_run.outputs.run_ci_job == 'true'
run: adb logcat -e "received headers with status 200" -m 1
kotlinhelloworld:
name: kotlin_helloworld
Expand All @@ -76,20 +84,27 @@ jobs:
timeout-minutes: 50
steps:
- uses: actions/checkout@v1
- id: should_run
name: 'Check whether to run'
run: ./mobile/tools/should_run_ci.sh
- uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
if: steps.should_run.outputs.run_ci_job == 'true'
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh --android
- name: 'Start simulator'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_start_emulator.sh
# Return to using:
# ./bazelw mobile-install --fat_apk_cpu=x86_64 --start_app //examples/kotlin/hello_world:hello_envoy_kt
# When https://github.com/envoyproxy/envoy-mobile/issues/853 is fixed.
- name: 'Start kotlin app'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -101,6 +116,7 @@ jobs:
adb install -r --no-incremental bazel-bin/examples/kotlin/hello_world/hello_envoy_kt.apk
adb shell am start -n io.envoyproxy.envoymobile.helloenvoykotlin/.MainActivity
- name: 'Check connectivity'
if: steps.should_run.outputs.run_ci_job == 'true'
run: adb logcat -e "received headers with status 200" -m 1
kotlinbaselineapp:
name: kotlin_baseline_app
Expand All @@ -109,20 +125,27 @@ jobs:
timeout-minutes: 50
steps:
- uses: actions/checkout@v1
- id: should_run
name: 'Check whether to run'
run: ./mobile/tools/should_run_ci.sh
- uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
if: steps.should_run.outputs.run_ci_job == 'true'
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh --android
- name: 'Start simulator'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_start_emulator.sh
# Return to using:
# ./bazelw mobile-install --fat_apk_cpu=x86_64 --start_app //examples/kotlin/hello_world:hello_envoy_kt
# When https://github.com/envoyproxy/envoy-mobile/issues/853 is fixed.
- name: 'Start kotlin app'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -134,6 +157,7 @@ jobs:
adb install -r --no-incremental bazel-bin/test/kotlin/apps/baseline/hello_envoy_kt.apk
adb shell am start -n io.envoyproxy.envoymobile.helloenvoybaselinetest/.MainActivity
- name: 'Check connectivity'
if: steps.should_run.outputs.run_ci_job == 'true'
run: adb logcat -e "received headers with status 301" -m 1
kotlinexperimentalapp:
name: kotlin_experimental_app
Expand All @@ -142,20 +166,27 @@ jobs:
timeout-minutes: 50
steps:
- uses: actions/checkout@v1
- id: should_run
name: 'Check whether to run'
run: ./mobile/tools/should_run_ci.sh
- uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
if: steps.should_run.outputs.run_ci_job == 'true'
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh --android
- name: 'Start simulator'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_start_emulator.sh
# Return to using:
# ./bazelw mobile-install --fat_apk_cpu=x86_64 --start_app //examples/kotlin/hello_world:hello_envoy_kt
# When https://github.com/envoyproxy/envoy-mobile/issues/853 is fixed.
- name: 'Start kotlin app'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -167,4 +198,5 @@ jobs:
adb install -r --no-incremental bazel-bin/test/kotlin/apps/experimental/hello_envoy_kt.apk
adb shell am start -n io.envoyproxy.envoymobile.helloenvoyexperimentaltest/.MainActivity
- name: 'Check connectivity'
if: steps.should_run.outputs.run_ci_job == 'true'
run: adb logcat -e "received headers with status 200" -m 1
57 changes: 15 additions & 42 deletions .github/workflows/android_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ on:
push:
branches:
- main
paths:
- 'mobile/**'
- '.github/workflows/**'
pull_request:
paths:
- 'mobile/**'
- '.github/workflows/**'

jobs:
kotlintestsmac:
Expand All @@ -21,29 +15,22 @@ jobs:
timeout-minutes: 90
steps:
- uses: actions/checkout@v1
- id: check_context
- id: should_run
name: 'Check whether to run'
run: |
if git rev-parse --abbrev-ref HEAD | grep -q ^main$ || git diff --name-only origin/main | grep -qe common/ -e java/ -e kotlin/ -e bazel/ -e ^\.bazelrc$ -e ^envoy$ -e ^WORKSPACE$ -e ^.github/workflows/android_tests.yml$ ; then
echo "Tests will run."
echo "run_tests=true" >> $GITHUB_OUTPUT
else
echo "Skipping tests."
echo "run_tests=false" >> $GITHUB_OUTPUT
fi
run: ./mobile/tools/should_run_ci.sh
- name: 'Java setup'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh
- name: 'Run Kotlin library tests'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -59,29 +46,22 @@ jobs:
timeout-minutes: 120
steps:
- uses: actions/checkout@v1
- id: check_context
- id: should_run
name: 'Check whether to run'
run: |
if git rev-parse --abbrev-ref HEAD | grep -q ^main$ || git diff --name-only origin/main | grep -qe common/ -e java/ -e kotlin/ -e bazel/ -e ^\.bazelrc$ -e ^envoy$ -e ^WORKSPACE$ -e ^.github/workflows/android_tests.yml$ ; then
echo "Tests will run."
echo "run_tests=true" >> $GITHUB_OUTPUT
else
echo "Skipping tests."
echo "run_tests=false" >> $GITHUB_OUTPUT
fi
run: ./mobile/tools/should_run_ci.sh
- name: 'Java setup'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh
- name: 'Run Java library tests'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand All @@ -107,29 +87,22 @@ jobs:
- uses: actions/checkout@v1
- name: Add safe directory
run: git config --global --add safe.directory /__w/envoy/envoy
- id: check_context
- id: should_run
name: 'Check whether to run'
run: |
if git rev-parse --abbrev-ref HEAD | grep -q ^main$ || git diff --name-only origin/main | grep -qe common/ -e java/ -e kotlin/ -e bazel/ -e ^\.bazelrc$ -e ^envoy$ -e ^WORKSPACE$ -e ^.github/workflows/android_tests.yml$ ; then
echo "Tests will run."
echo "run_tests=true" >> $GITHUB_OUTPUT
else
echo "Skipping tests."
echo "run_tests=false" >> $GITHUB_OUTPUT
fi
run: ./mobile/tools/should_run_ci.sh
- name: 'Java setup'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install dependencies'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/linux_ci_setup.sh
- name: 'Run Kotlin library integration tests'
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
21 changes: 4 additions & 17 deletions .github/workflows/asan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ on:
push:
branches:
- main
paths:
- 'mobile/**'
- '.github/workflows/**'
pull_request:
paths:
- 'mobile/**'
- '.github/workflows/**'

jobs:
asan:
Expand All @@ -26,18 +20,11 @@ jobs:
- uses: actions/checkout@v1
- name: Add safe directory
run: git config --global --add safe.directory /__w/envoy/envoy
- id: check_context
- id: should_run
name: 'Check whether to run'
run: |
if git rev-parse --abbrev-ref HEAD | grep -q ^main$ || git diff --name-only origin/main | grep -qe common/ -e bazel/ -e ^\.bazelrc$ -e ^envoy$ -e ^WORKSPACE$ -e ^.github/workflows/asan.yml$ ; then
echo "Tests will run."
echo "run_tests=true" >> $GITHUB_OUTPUT
else
echo "Skipping tests."
echo "run_tests=false" >> $GITHUB_OUTPUT
fi
run: ./mobile/tools/should_run_ci.sh
- uses: actions/setup-java@c3ac5dd0ed8db40fedb61c32fbe677e6b355e94c
if: steps.check-cache.outputs.cache-hit != 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
with:
java-version: '8'
java-package: jdk
Expand All @@ -46,7 +33,7 @@ jobs:
- name: 'Run tests'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: steps.check_context.outputs.run_tests == 'true'
if: steps.should_run.outputs.run_ci_job == 'true'
run: |
cd mobile && ./bazelw test --test_output=all \
--test_env=ENVOY_IP_TEST_VERSIONS=v4only \
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,7 @@ on:
push:
branches:
- main
paths:
- 'mobile/**'
- '.github/workflows/**'
pull_request:
paths:
- 'mobile/**'
- '.github/workflows/**'

jobs:
unittests:
Expand All @@ -19,9 +13,14 @@ jobs:
timeout-minutes: 120
steps:
- uses: actions/checkout@v1
- id: should_run
name: 'Check whether to run'
run: ./mobile/tools/should_run_ci.sh
- name: 'Install dependencies'
if: steps.should_run.outputs.run_ci_job == 'true'
run: cd mobile && ./ci/mac_ci_setup.sh
- name: 'Run tests'
if: steps.should_run.outputs.run_ci_job == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
Loading

0 comments on commit 11ca6cd

Please sign in to comment.