forked from protocolbuffers/protobuf
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request protocolbuffers#8638 from jtattermusch/php_aarch64…
…_tests Run PHP aarch64 tests on the CI (with an emulator)
- Loading branch information
Showing
6 changed files
with
90 additions
and
0 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
kokoro/linux/aarch64/php_build_and_run_tests_with_qemu_aarch64.sh
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# Install composer | ||
curl -sS https://getcomposer.org/installer | php | ||
mkdir -p "$HOME/bin" | ||
mv composer.phar "$HOME/bin/composer" | ||
PATH="$HOME/bin:$PATH" | ||
|
||
# go to the repo root | ||
cd $(dirname $0)/../../.. | ||
|
||
cd php | ||
|
||
composer install | ||
composer test | ||
composer test_c |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
set -ex | ||
|
||
# go to the repo root | ||
cd $(dirname $0)/../../.. | ||
|
||
# there is no php testing docker image readily available, so we build | ||
# our own. It's a aarch64 image, but that's fine since qemu will | ||
# automatically be used to run the commands in the dockerfile. | ||
docker build -t testimage_protobuf_php_arm64v8 kokoro/linux/aarch64/testimage_protobuf_php_arm64v8 | ||
|
||
if [[ -t 0 ]]; then | ||
DOCKER_TTY_ARGS="-it" | ||
else | ||
# The input device on kokoro is not a TTY, so -it does not work. | ||
DOCKER_TTY_ARGS= | ||
fi | ||
|
||
# crosscompile protoc as we will later need it for the php build. | ||
# we build it under the dockcross/manylinux2014-aarch64 image so that the resulting protoc binary is compatible | ||
# with a wide range of linux distros (including any docker images we will use later to build and test php) | ||
kokoro/linux/aarch64/dockcross_helpers/run_dockcross_manylinux2014_aarch64.sh kokoro/linux/aarch64/protoc_crosscompile_aarch64.sh | ||
|
||
# use an actual aarch64 docker image (with a real aarch64 php) to run build & test protobuf php under an emulator | ||
# * mount the protobuf root as /work to be able to access the crosscompiled files | ||
# * to avoid running the process inside docker as root (which can pollute the workspace with files owned by root), we force | ||
# running under current user's UID and GID. To be able to do that, we need to provide a home directory for the user | ||
# otherwise the UID would be homeless under the docker container and pip install wouldn't work. For simplicity, | ||
# we just run map the user's home to a throwaway temporary directory | ||
docker run $DOCKER_TTY_ARGS --rm --user "$(id -u):$(id -g)" -e "HOME=/home/fake-user" -v "$(mktemp -d):/home/fake-user" -v "$(pwd)":/work -w /work testimage_protobuf_php_arm64v8 kokoro/linux/aarch64/php_build_and_run_tests_with_qemu_aarch64.sh |
3 changes: 3 additions & 0 deletions
3
kokoro/linux/aarch64/testimage_protobuf_php_arm64v8/Dockerfile
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
FROM arm64v8/debian:buster | ||
|
||
RUN apt-get update && apt-get install -y php7.3-cli php7.3-dev php7.3-bcmath composer phpunit curl git valgrind && apt-get clean |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
# | ||
# This is the top-level script we give to Kokoro as the entry point for | ||
# running the "continuous" and "presubmit" jobs. | ||
|
||
set -ex | ||
|
||
# Change to repo root | ||
cd $(dirname $0)/../../.. | ||
|
||
# Initialize any submodules. | ||
git submodule update --init --recursive | ||
|
||
kokoro/linux/aarch64/qemu_helpers/prepare_qemu.sh | ||
|
||
kokoro/linux/aarch64/test_php_aarch64.sh |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Config file for running tests in Kokoro | ||
|
||
# Location of the build script in repository | ||
build_file: "protobuf/kokoro/linux/php_aarch64/build.sh" | ||
timeout_mins: 120 | ||
|
||
action { | ||
define_artifacts { | ||
regex: "**/sponge_log.xml" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Config file for running tests in Kokoro | ||
|
||
# Location of the build script in repository | ||
build_file: "protobuf/kokoro/linux/php_aarch64/build.sh" | ||
timeout_mins: 120 | ||
|
||
action { | ||
define_artifacts { | ||
regex: "**/sponge_log.xml" | ||
} | ||
} |