RetroShare/.gitlab-ci.yml
2021-11-05 15:29:53 +01:00

108 lines
3.6 KiB
YAML

image: docker:stable
services:
- docker:stable-dind
stages:
- build
- test
workflow:
rules:
- if: $CI_MERGE_REQUEST_ID
- if: $CI_COMMIT_BRANCH
variables:
UBUNTU_TESTING_IMAGE_TAG: "$CI_REGISTRY_IMAGE/gitlabci_outputs/ubuntu_testing:$CI_COMMIT_SHA"
build-ubuntu-test-image:
stage: build
script:
- >
docker login "$CI_REGISTRY"
--username "$CI_REGISTRY_USER"
--password "$CI_REGISTRY_PASSWORD"
- mkdir Dockercontext
- >
docker build
-t $UBUNTU_TESTING_IMAGE_TAG
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--file $CI_PROJECT_DIR/build_scripts/GitlabCI/gitlabCI.Dockerfile
Dockercontext
- docker push $UBUNTU_TESTING_IMAGE_TAG
- echo UBUNTU_TESTING_IMAGE_TAG=$UBUNTU_TESTING_IMAGE_TAG
test-ubuntu:
stage: test
script:
- >
docker login "$CI_REGISTRY"
--username "$CI_REGISTRY_USER"
--password "$CI_REGISTRY_PASSWORD"
- echo UBUNTU_TESTING_IMAGE_TAG=$UBUNTU_TESTING_IMAGE_TAG
- docker pull $UBUNTU_TESTING_IMAGE_TAG
- >
docker run --name retroshare --detach --tty $UBUNTU_TESTING_IMAGE_TAG
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:
stage: build
script:
- mkdir Dockercontext
- >
docker build -t retroshare:android_arm_latest
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--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:
stage: build
script:
- mkdir Dockercontext
- >
docker build -t retroshare:android_arm64_latest
$($CI_PROJECT_DIR/build_scripts/GitlabCI/getRepoArgs.sh)
--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