mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-02-22 07:49:56 -05:00
Initial work on GitlabCI
This commit is contained in:
parent
e0462b8411
commit
8098eb1225
57
.gitlab-ci.yml
Normal file
57
.gitlab-ci.yml
Normal file
@ -0,0 +1,57 @@
|
||||
image: docker:stable
|
||||
|
||||
services:
|
||||
- docker:stable-dind
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
|
||||
build-and-test:
|
||||
script:
|
||||
- mkdir Dockercontext
|
||||
- >
|
||||
docker login "$CI_REGISTRY"
|
||||
--username "$CI_REGISTRY_USER" --password "$CI_REGISTRY_PASSWORD"
|
||||
- docker pull "$CI_REGISTRY_IMAGE:base"
|
||||
- >
|
||||
if [ -n "$CI_MERGE_REQUEST_ID" ]; then
|
||||
MR_ARGS="--build-arg REPO_URL=$CI_MERGE_REQUEST_SOURCE_PROJECT_URL" ;
|
||||
MR_ARGS="$MR_ARGS --build-arg REPO_BRANCH=$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" ;
|
||||
export MR_ARGS ;
|
||||
fi
|
||||
- >
|
||||
docker build -t "$CI_REGISTRY_IMAGE:testing" $MR_ARGS
|
||||
--file /builds/RetroShare/RetroShare/build_scripts/GitlabCI/gitlabCI.Dockerfile
|
||||
Dockercontext
|
||||
- >
|
||||
docker run --name retroshare --detach --tty
|
||||
"$CI_REGISTRY_IMAGE:testing"
|
||||
retroshare-service --jsonApiPort 9092
|
||||
- docker exec retroshare apt-get install -y curl
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose http://127.0.0.1:9092/jsonApiServer/version
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose http://127.0.0.1:9092/rsMsgs/getChatLobbyList
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose http://127.0.0.1:9092/rsLoginHelper/getLocations
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose --data
|
||||
'{ "location":{ "mLocationName":"Test 1", "mPpgName":"Test2",
|
||||
"makeHidden":false, "makeAutoTor":false }, "password":"Test 3",
|
||||
"caller_data":"Test 5" }'
|
||||
http://127.0.0.1:9092/rsLoginHelper/createLocation
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose http://127.0.0.1:9092/rsLoginHelper/getLocations
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose http://127.0.0.1:9092/rsLoginHelper/isLoggedIn
|
||||
- >
|
||||
docker exec retroshare
|
||||
curl --verbose http://127.0.0.1:9092/rsMsgs/getChatLobbyList
|
||||
- docker container stop retroshare
|
43
build_scripts/GitlabCI/base.Dockerfile
Normal file
43
build_scripts/GitlabCI/base.Dockerfile
Normal file
@ -0,0 +1,43 @@
|
||||
## Add +--build-arg FRESHCLONE=$(date +%s)+ to docker build commandline to
|
||||
## force cloning a new
|
||||
|
||||
## To prepare an image suitable as base for Gitlab CI use
|
||||
# docker build -t "${CI_REGISTRY_IMAGE}:base" --build-arg KEEP_SOURCE=true --build-arg REPO_DEPTH="" -f base.Dockerfile .
|
||||
|
||||
## Now you need to tag it so you can later push it
|
||||
# docker tag ${ID_OF_THE_CREATED_IMAGE} registry.gitlab.com/retroshare/${CI_REGISTRY_IMAGE}:base
|
||||
|
||||
## To push it to gitlab CI registry you need first to login and the to push
|
||||
# docker login registry.gitlab.com
|
||||
# docker push registry.gitlab.com/retroshare/${CI_REGISTRY_IMAGE}:base
|
||||
|
||||
|
||||
## To run the container
|
||||
# docker run -it -p 127.0.0.1:9092:9092 "${CI_REGISTRY_IMAGE}:base" retroshare-service --jsonApiPort 9092 --jsonApiBindAddress 0.0.0.0
|
||||
|
||||
FROM ubuntu
|
||||
|
||||
ARG CACHEBUST=0
|
||||
RUN \
|
||||
apt-get update -y && apt-get upgrade -y && \
|
||||
apt-get install -y build-essential libssl-dev libbz2-dev libsqlite3-dev \
|
||||
libsqlcipher-dev libupnp-dev pkg-config libz-dev \
|
||||
qt5-default libxapian-dev qttools5-dev doxygen rapidjson-dev \
|
||||
git cmake
|
||||
|
||||
ARG FRESHCLONE=0
|
||||
ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
|
||||
ARG REPO_BRANCH=master
|
||||
ARG REPO_DEPTH="--depth 2000"
|
||||
ARG KEEP_SOURCE=false
|
||||
RUN apt-get update -y && apt-get upgrade -y
|
||||
RUN git clone $REPO_DEPTH $REPO_URL -b $REPO_BRANCH && cd RetroShare && \
|
||||
git fetch --tags && cd ..
|
||||
RUN \
|
||||
mkdir RetroShare-build && cd RetroShare-build && \
|
||||
qmake ../RetroShare \
|
||||
CONFIG+=no_retroshare_plugins CONFIG+=ipv6 \
|
||||
CONFIG+=retroshare_service CONFIG+=no_retroshare_gui \
|
||||
CONFIG+=rs_jsonapi CONFIG+=rs_deep_search && \
|
||||
(make -j$(nproc) || make -j$(nproc) || make) && make install && \
|
||||
cd .. && rm -rf RetroShare-build && ($KEEP_SOURCE || rm -rf RetroShare)
|
17
build_scripts/GitlabCI/gitlabCI.Dockerfile
Normal file
17
build_scripts/GitlabCI/gitlabCI.Dockerfile
Normal file
@ -0,0 +1,17 @@
|
||||
FROM registry.gitlab.com/retroshare/retroshare:base
|
||||
|
||||
RUN apt-get update -y && apt-get upgrade -y
|
||||
|
||||
ARG REPO_URL=https://gitlab.com/RetroShare/RetroShare.git
|
||||
ARG REPO_BRANCH=master
|
||||
RUN \
|
||||
cd RetroShare && git remote add testing $REPO_URL && \
|
||||
git fetch --tags testing $REPO_BRANCH && \
|
||||
git reset --hard testing/$REPO_BRANCH
|
||||
RUN \
|
||||
mkdir RetroShare-build && cd RetroShare-build && \
|
||||
qmake ../RetroShare CONFIG+=no_retroshare_gui \
|
||||
CONFIG+=retroshare_service \
|
||||
CONFIG+=rs_jsonapi CONFIG+=rs_deep_search && \
|
||||
(make -j$(nproc) || make -j$(nproc) || make) && make install && \
|
||||
cd .. && rm -rf RetroShare-build
|
Loading…
x
Reference in New Issue
Block a user