Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] mobile/ci: Add reusable workflow #30188

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 101 additions & 0 deletions .github/workflows/_mobile_ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
name: Envoy mobile CI

permissions:
contents: read

on:
workflow_call:
inputs:
target:
required: true
type: string
name:
required: true
type: string
command:
required: true
type: string
build_image:
type: string
runs-on:
required: true
type: string
timeout-minutes:
type: number
default: 20

diskspace_hack:
type: boolean
default: false
skip:
type: boolean
default: false
env:
type: string
default: |
CC: /opt/llvm/bin/clang
CXX: /opt/llvm/bin/clang++

concurrency:
group: ${{ github.workflow }}-${{ inputs.target }}
cancel-in-progress: true

jobs:
mobile_ci:
if: ${{ ! inputs.skip }}
runs-on: ${{ inputs.runs-on }}
name: ${{ inputs.target }}
permissions:
contents: read
packages: read
timeout-minutes: ${{ inputs.timeout-minutes }}
steps:
- name: Pre-cleanup
# Using the defaults in
# https://github.com/envoyproxy/toolshed/blob/main/gh-actions/diskspace/action.yml.
uses: envoyproxy/toolshed/gh-actions/[email protected]
if: ${{ inputs.diskpace_hack }}
- uses: actions/checkout@v4
- name: Add safe directory
run: git config --global --add safe.directory /__w/envoy/envoy

- name: 'Java setup'
if: contains(inputs.runs-on, 'macos')
uses: actions/setup-java@0ab4596768b603586c0de567f2430c30f5b0d2b0
with:
java-version: '8'
java-package: jdk
architecture: x64
distribution: zulu
- name: 'Install mac dependencies'
if: contains(inputs.runs-on, 'macos')
run: |
cd mobile
./ci/mac_ci_setup.sh

- name: Set Environment Variables
run: |
if [[ -z "${{ inputs.env }}" ]]; then
exit 0
fi
read -ra vars <<< ${{ inputs.env }}
for [[ var in "${vars[@]}" ]]; do
IFS=': ' read -ra parts <<< "$var"
export "${parts[0]}=${parts[1]}"
done
- name: ${{ inputs.name }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [[ -z "${{ inputs.build_image }}" ]]; then
${{ inputs.command }}
exit 0
fi
docker run \
--volume="${PWD}:/source" \
--workdir="/source/mobile" \
-e GITHUB_TOKEN \
-e CC \
-e CXX \
${{ inputs.build_image }} \
${{ inputs.command }}
103 changes: 42 additions & 61 deletions .github/workflows/mobile-android_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,68 +21,49 @@ jobs:
permissions:
contents: read

javatestslinux:
if: ${{ needs.env.outputs.mobile_android_tests == 'true' }}
android_test:
name: ${{ matrix.target }}
needs: env
permissions:
contents: read
packages: read
name: java_tests_linux
runs-on: ${{ needs.env.outputs.agent_ubuntu }}
timeout-minutes: 90
steps:
- name: Pre-cleanup
# Using the defaults in
# https://github.com/envoyproxy/toolshed/blob/main/gh-actions/diskspace/action.yml.
uses: envoyproxy/toolshed/gh-actions/[email protected]
- uses: actions/checkout@v4
- name: Add safe directory
run: git config --global --add safe.directory /__w/envoy/envoy
- name: 'Run Kotlin library integration tests'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CC: /opt/llvm/bin/clang
CXX: /opt/llvm/bin/clang++
run: |
docker run --volume="${PWD}:/source" --workdir="/source/mobile" \
-e GITHUB_TOKEN -e CC -e CXX ${{ needs.env.outputs.build_image_ubuntu_mobile }} \
./bazelw test \
--build_tests_only \
--config=test-android \
--config=mobile-remote-ci \
--define=signal_trace=disabled \
//test/java/...

kotlintestslinux:
if: ${{ needs.env.outputs.mobile_android_tests == 'true' }}
needs: env
permissions:
contents: read
packages: read
# Only kotlin tests are executed since with linux:
# https://github.com/envoyproxy/envoy-mobile/issues/1418.
name: kotlin_tests_linux
runs-on: ${{ needs.env.outputs.agent_ubuntu }}
timeout-minutes: 90
steps:
- name: Pre-cleanup
# Using the defaults in
# https://github.com/envoyproxy/toolshed/blob/main/gh-actions/diskspace/action.yml.
uses: envoyproxy/toolshed/gh-actions/[email protected]
- uses: actions/checkout@v4
- name: Add safe directory
run: git config --global --add safe.directory /__w/envoy/envoy
- name: 'Run Kotlin library integration tests'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CC: /opt/llvm/bin/clang
CXX: /opt/llvm/bin/clang++
run: |
docker run --volume="${PWD}:/source" --workdir="/source/mobile" \
-e GITHUB_TOKEN -e CC -e CXX ${{ needs.env.outputs.build_image_ubuntu_mobile }} \
./bazelw test \
--build_tests_only \
--config=test-android \
--config=mobile-remote-ci \
--define=signal_trace=disabled \
//test/kotlin/...
strategy:
fail-fast: false
matrix:
include:
# Only kotlin tests are executed since with linux:
# https://github.com/envoyproxy/envoy-mobile/issues/1418.
- target: kotlin_tests_linux
name: Run Kotlin library integration tests
diskspace_hack: true
timeout-minutes: 90
runs-on: ${{ needs.env.outputs.agent_ubuntu }}
command: |
./bazelw test \
--build_tests_only \
--config=test-android \
--config=mobile-remote-ci \
--define=signal_trace=disabled \
//test/kotlin/...
- target: java_tests_linux
name: Run Java library tests
timeout-minutes: 120
runs-on: ${{ needs.env.outputs.agent_ubuntu }}
phlax marked this conversation as resolved.
Show resolved Hide resolved
run: |
./bazelw test \
--build_tests_only \
--config=test-android \
--config=mobile-remote-ci \
--define=signal_trace=disabled \
//test/java/...
uses: ./.github/workflows/_mobile_ci.yml
with:
target: ${{ matrix.target }}
name: ${{ matrix.name }}
env: ${{ matrix.env }}
command: ${{ matrix.command }}
build_image: ${{ needs.env.outputs.build_image_ubuntu_mobile }}
diskspace_hack: ${{ matrix.diskspace_hack == 'true' }}
runs-on: ${{ matrix.runs-on }}
timeout-minutes: ${{ fromJSON(matrix.timeout-minutes) }}
skip: ${{ needs.env.outputs.mobile_android_tests != 'true' }}
Loading