mirror of https://github.com/grpc/grpc-java.git
Replace Kokoro ARM build with GitHub Actions
The Kokoro aarch64 build runs on x86 with an emulator, and has always been flaky due to the slow execution speed. At present it is continually failing due to deadline exceededs. GitHub Actions is running on aarch64 hardware, so is much faster (4 minutes vs 30 minutes, without including the speedup from GitHub Action's caching).
This commit is contained in:
parent
4a10a38166
commit
ea3f644eef
|
@ -0,0 +1,41 @@
|
|||
name: GitHub Actions Branch Testing
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- 'v1.*'
|
||||
schedule:
|
||||
- cron: '54 19 * * SUN' # weekly at a "random" time
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
arm64:
|
||||
runs-on: ubuntu-24.04-arm
|
||||
strategy:
|
||||
matrix:
|
||||
jre: [17]
|
||||
fail-fast: false # Should swap to true if we grow a large matrix
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-java@v4
|
||||
with:
|
||||
java-version: ${{ matrix.jre }}
|
||||
distribution: 'temurin'
|
||||
|
||||
- name: Gradle cache
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
~/.gradle/caches
|
||||
~/.gradle/wrapper
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-gradle-
|
||||
|
||||
- name: Build
|
||||
run: ./gradlew -Dorg.gradle.parallel=true -Dorg.gradle.jvmargs='-Xmx1g' -PskipAndroid=true -PskipCodegen=true -PerrorProne=false test
|
||||
|
|
@ -1,13 +0,0 @@
|
|||
# Config file for internal CI
|
||||
|
||||
# Location of the continuous shell script in repository.
|
||||
build_file: "grpc-java/buildscripts/kokoro/linux_aarch64.sh"
|
||||
timeout_mins: 60
|
||||
|
||||
action {
|
||||
define_artifacts {
|
||||
regex: "github/grpc-java/**/build/test-results/**/sponge_log.xml"
|
||||
regex: "github/grpc-java/mvn-artifacts/**"
|
||||
regex: "github/grpc-java/artifacts/**"
|
||||
}
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -veux -o pipefail
|
||||
|
||||
if [[ -f /VERSION ]]; then
|
||||
cat /VERSION
|
||||
fi
|
||||
|
||||
readonly GRPC_JAVA_DIR="$(cd "$(dirname "$0")"/../.. && pwd)"
|
||||
|
||||
. "$GRPC_JAVA_DIR"/buildscripts/kokoro/kokoro.sh
|
||||
trap spongify_logs EXIT
|
||||
|
||||
cd github/grpc-java
|
||||
|
||||
buildscripts/qemu_helpers/prepare_qemu.sh
|
||||
|
||||
buildscripts/run_arm64_tests_in_docker.sh
|
|
@ -1,26 +0,0 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Setup and configure qemu userspace emulator on kokoro worker so that we can seamlessly emulate processes running
|
||||
# inside docker containers.
|
||||
|
||||
set -ex
|
||||
|
||||
# show pre-existing qemu registration
|
||||
cat /proc/sys/fs/binfmt_misc/qemu-aarch64 || true
|
||||
|
||||
# Kokoro ubuntu1604 workers have already qemu-user and qemu-user-static packages installed, but it's and old version that:
|
||||
# * prints warning about some syscalls (e.g "qemu: Unsupported syscall: 278")
|
||||
# * doesn't register with binfmt_misc with the persistent ("F") flag we need (see below)
|
||||
#
|
||||
# To overcome the above limitations, we use the https://github.com/multiarch/qemu-user-static
|
||||
# docker image to provide a new enough version of qemu-user-static and register it with
|
||||
# the desired binfmt_misc flags. The most important flag we need is "F" (set by "--persistent yes"),
|
||||
# which allows the qemu-aarch64-static binary to be loaded eagerly at the time of registration with binfmt_misc.
|
||||
# That way, we can emulate aarch64 binaries running inside docker containers transparently, without needing the emulator
|
||||
# binary to be accessible from the docker image we're emulating.
|
||||
# Note that on newer distributions (such as glinux), simply "apt install qemu-user-static" is sufficient
|
||||
# to install qemu-user-static with the right flags.
|
||||
docker run --rm --privileged multiarch/qemu-user-static:5.2.0-2 --reset --credential yes --persistent yes
|
||||
|
||||
# Print current qemu reqistration to make sure everything is setup correctly.
|
||||
cat /proc/sys/fs/binfmt_misc/qemu-aarch64
|
|
@ -1,47 +0,0 @@
|
|||
#!/bin/bash
|
||||
set -ex
|
||||
|
||||
readonly grpc_java_dir="$(dirname "$(readlink -f "$0")")/.."
|
||||
|
||||
if [[ -t 0 ]]; then
|
||||
DOCKER_ARGS="-it"
|
||||
else
|
||||
# The input device on kokoro is not a TTY, so -it does not work.
|
||||
DOCKER_ARGS=
|
||||
fi
|
||||
|
||||
|
||||
cat <<EOF >> "${grpc_java_dir}/gradle.properties"
|
||||
skipAndroid=true
|
||||
skipCodegen=true
|
||||
org.gradle.parallel=true
|
||||
org.gradle.jvmargs=-Xmx1024m
|
||||
EOF
|
||||
|
||||
export JAVA_OPTS="-Duser.home=/grpc-java/.current-user-home -Djava.util.prefs.userRoot=/grpc-java/.current-user-home/.java/.userPrefs"
|
||||
|
||||
# build under x64 docker image to save time over building everything under
|
||||
# aarch64 emulator. We've already built and tested the protoc binaries
|
||||
# so for the rest of the build we will be using "-PskipCodegen=true"
|
||||
# avoid further complicating the build.
|
||||
docker run $DOCKER_ARGS --rm=true -v "${grpc_java_dir}":/grpc-java -w /grpc-java \
|
||||
--user "$(id -u):$(id -g)" -e JAVA_OPTS \
|
||||
openjdk:11-jdk-slim-buster \
|
||||
./gradlew build -x test
|
||||
|
||||
# Build and run java tests under aarch64 image.
|
||||
# To be able to run this docker container on x64 machine, one needs to have
|
||||
# qemu-user-static properly registered with binfmt_misc.
|
||||
# The most important flag binfmt_misc flag we need is "F" (set by "--persistent yes"),
|
||||
# which allows the qemu-aarch64-static binary to be loaded eagerly at the time of registration with binfmt_misc.
|
||||
# That way, we can emulate aarch64 binaries running inside docker containers transparently, without needing the emulator
|
||||
# binary to be accessible from the docker image we're emulating.
|
||||
# Note that on newer distributions (such as glinux), simply "apt install qemu-user-static" is sufficient
|
||||
# to install qemu-user-static with the right flags.
|
||||
# A note on the "docker run" args used:
|
||||
# - run docker container under current user's UID to avoid polluting the workspace
|
||||
# - set the user.home property to avoid creating a "?" directory under grpc-java
|
||||
docker run $DOCKER_ARGS --rm=true -v "${grpc_java_dir}":/grpc-java -w /grpc-java \
|
||||
--user "$(id -u):$(id -g)" -e JAVA_OPTS \
|
||||
arm64v8/openjdk:11-jdk-slim-buster \
|
||||
./gradlew build
|
Loading…
Reference in New Issue