RetroShare/.gitlab-ci.yml
Gioacchino Mazzurco e384613809
Android: provide Dockerfile and use it for GitalbCI
Add support for installing Android SDK NDK directly into
  prepare-toolchain-clang.sh
Modernize prepare-toolchain-clang.sh
Add support to install Qt based on installer 4.X to prepare-toolchain-clang.sh
Setub GtlabCI to build android APK based on the produced Docker image
2021-08-31 10:03:40 +02:00

110 lines
4.2 KiB
YAML

image: docker:stable
services:
- docker:stable-dind
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH
build-and-test:
script:
- >
if [ -n "$CI_MERGE_REQUEST_ID" ]; then
REPO_ARGS="--build-arg REPO_URL=$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" ;
REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ;
else
REPO_ARGS="--build-arg REPO_URL=$CI_REPOSITORY_URL" ;
REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_COMMIT_BRANCH" ;
fi ;
export REPO_ARGS ;
echo REPO_ARGS=$REPO_ARGS ;
- mkdir Dockercontext
- >
docker build -t retroshare:testing $REPO_ARGS
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/gitlabCI.Dockerfile
Dockercontext
- >
docker run --name retroshare --detach --tty retroshare:testing
retroshare-service --jsonApiPort 9092
- apk add jq
- >
docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsJsonApi/version | jq
- >
docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsLoginHelper/getLocations | jq
- >
docker exec retroshare
curl --verbose --data
'{ "location":{ "mLocationName":"Test 1", "mPgpName":"Test2" },
"password":"Test 3", "caller_data":"Test 5" }'
http://127.0.0.1:9092/rsLoginHelper/createLocation | jq
- >
docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsLoginHelper/getLocations | jq
- >
docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsLoginHelper/isLoggedIn | jq
- >
docker exec retroshare
curl --verbose http://127.0.0.1:9092/rsMsgs/getChatLobbyList | jq
- docker container stop retroshare
build-android-arm-apk:
script:
- >
if [ -n "$CI_MERGE_REQUEST_ID" ]; then
REPO_ARGS="--build-arg REPO_URL=$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" ;
REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ;
else
REPO_ARGS="--build-arg REPO_URL=$CI_REPOSITORY_URL" ;
REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_COMMIT_BRANCH" ;
fi ;
export REPO_ARGS ;
echo REPO_ARGS=$REPO_ARGS ;
- mkdir Dockercontext
- >
docker build -t retroshare:android_arm_latest $REPO_ARGS
--build-arg ANDROID_PLATFORM_VER=16
--build-arg ANDROID_NDK_ARCH=arm
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile
Dockercontext
# see https://stackoverflow.com/a/59055906
- >
docker cp
$(docker create --rm retroshare:android_arm_latest):/retroshare-service-android-build/android-build/build/outputs/apk/debug/android-build-debug.apk
$CI_PROJECT_DIR/RetroShare_Android_Service-arm.apk
artifacts:
paths:
- RetroShare_Android_Service-arm.apk
# Use separate runner to avoid no space left on device
build-android-arm64-apk:
script:
- >
if [ -n "$CI_MERGE_REQUEST_ID" ]; then
REPO_ARGS="--build-arg REPO_URL=$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" ;
REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ;
else
REPO_ARGS="--build-arg REPO_URL=$CI_REPOSITORY_URL" ;
REPO_ARGS="$REPO_ARGS --build-arg REPO_BRANCH=$CI_COMMIT_BRANCH" ;
fi ;
export REPO_ARGS ;
echo REPO_ARGS=$REPO_ARGS ;
- mkdir Dockercontext
- >
docker build -t retroshare:android_arm64_latest $REPO_ARGS
--build-arg ANDROID_PLATFORM_VER=21
--build-arg ANDROID_NDK_ARCH=arm64
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/Android.Dockerfile
Dockercontext
- >
docker cp
$(docker create --rm retroshare:android_arm64_latest):/retroshare-service-android-build/android-build/build/outputs/apk/debug/android-build-debug.apk
$CI_PROJECT_DIR/RetroShare_Android_Service-arm64.apk
artifacts:
paths:
- RetroShare_Android_Service-arm64.apk