Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Kotahi
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Omo Oaiya
Kotahi
Commits
00128047
Commit
00128047
authored
4 years ago
by
Ilia Eriomenco
Browse files
Options
Downloads
Patches
Plain Diff
ci: added templating for all tests in eLife pipeline
parent
90190d00
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
._gitlab-ci.elife.yml
+273
-0
273 additions, 0 deletions
._gitlab-ci.elife.yml
.gitlab-ci.elife.yml
+35
-133
35 additions, 133 deletions
.gitlab-ci.elife.yml
with
308 additions
and
133 deletions
._gitlab-ci.elife.yml
0 → 100644
+
273
−
0
View file @
00128047
variables
:
IMAGE_ORG
:
kotahi
IMAGE_NAME
:
kotahi
ELIFE_SERVER_IP
:
54.87.88.111
stages
:
-
build
-
deploy
-
test
build
:
image
:
docker:20.10.5
variables
:
DOCKER_BUILDKIT
:
1
services
:
-
docker:20.10.5-dind
stage
:
build
before_script
:
-
cp app/brand-instances-configs/elife.json app/brandConfig.json
script
:
-
|
if [ -z "$DOCKERHUB_USERNAME_ELIFE" ] || [ -z "$DOCKERHUB_PASSWORD_ELIFE" ]; then echo "Not pushing" && exit 0; fi
docker login -u $DOCKERHUB_USERNAME_ELIFE -p $DOCKERHUB_PASSWORD_ELIFE
docker pull $IMAGE_ORG/$IMAGE_NAME:latest || true
docker build \
--file ./Dockerfile-production \
--cache-from $CI_REGISTRY_IMAGE:latest \
--tag $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA \
--tag $IMAGE_ORG/$IMAGE_NAME:latest .
docker build --file ./Dockerfile-ci --cache-from $IMAGE_ORG/$IMAGE_NAME-dev:latest --tag $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA --tag $IMAGE_ORG/$IMAGE_NAME-dev:latest .
docker push $IMAGE_ORG/$IMAGE_NAME:$CI_COMMIT_SHA
docker push $IMAGE_ORG/$IMAGE_NAME:latest
docker push $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
docker push $IMAGE_ORG/$IMAGE_NAME-dev:latest
deploy
:
stage
:
deploy
image
:
docker:19.03.13
before_script
:
-
export SSH_KEY=$SSH_KEY_ELIFE
-
export DOCKERHUB_USERNAME=$DOCKERHUB_USERNAME_ELIFE
-
export DOCKERHUB_PASSWORD=$DOCKERHUB_PASSWORD_ELIFE
-
export IMAGE_ORG=$IMAGE_ORG
-
export IMAGE_NAME=$IMAGE_NAME
-
eval $(ssh-agent -s)
-
echo "$SSH_KEY" | tr -d '\r' | ssh-add -
-
mkdir -p ~/.ssh
-
chmod 700 ~/.ssh
-
ssh-keyscan $ELIFE_SERVER_IP >> ~/.ssh/known_hosts
-
chmod 644 ~/.ssh/known_hosts
script
:
-
|
ssh ubuntu@$ELIFE_SERVER_IP "sudo docker login -u $DOCKERHUB_USERNAME -p $DOCKERHUB_PASSWORD &&
sudo docker pull $IMAGE_ORG/$IMAGE_NAME:latest &&
sudo supervisorctl stop kotahi &&
cd /home/ubuntu/kotahi &&
sudo docker-compose down &&
sudo supervisorctl start kotahi"
lint
:
allow_failure
:
true
image
:
$IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
stage
:
test
variables
:
GIT_STRATEGY
:
none
script
:
-
cd ${HOME}
-
npm run lint
.test_template
:
&run_test_template
image
:
$IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
stage
:
test
variables
:
GIT_STRATEGY
:
none
# setup data for postgres image
POSTGRES_USER
:
kotahidev
POSTGRES_PASSWORD
:
kotahidev
# used by psql
PGUSER
:
kotahidev
PGPASSWORD
:
kotahidev
INSTANCE_NAME
:
elife
services
:
-
postgres
.script_template
:
&run_script_template
-
cd ${HOME}
-
apt-get -y install postgresql-client
# this is needed for pgboss initial setup
-
psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# use the example env for tests
-
cp .env.example .env
# specify host here else it confuses the linked postgres image
-
POSTGRES_HOST=postgres yarn test:all:chrome:$TEST_ITEM
test-chrome
:
<<
:
*run_test_template
variables
:
TEST_ITEM
:
elife
script
:
-
*run_script_template
# .test_template: &run_test_template
# image: $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
# stage: test
# variables:
# GIT_STRATEGY: none
# # setup data for postgres image
# POSTGRES_USER: kotahidev
# POSTGRES_PASSWORD: kotahidev
# # used by psql
# PGUSER: kotahidev
# PGPASSWORD: kotahidev
# # this is used to ignore self signed certs
# START_SERVER_AND_TEST_INSECURE: 1
# INSTANCE_NAME: elife
# services:
# - postgres
# #.script_template: &run_script_template
# # - cd ${HOME}
# # - apt-get -y install postgresql-client
# # # this is needed for pgboss initial setup
# # - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # # use the example env for tests
# # - cp .env.example .env
# # - # specify host here else it confuses the linked postgres image
# # - POSTGRES_HOST=postgres yarn test:all:chrome:$TEST_ITEM
# test-chrome:
# <<: *run_test_template
# variables:
# TEST_ITEM: elife
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife
# test-chrome-samsung:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:samsung
# test-chrome-samsung-tablet:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:samsung:tablet
# test-chrome-iPhone:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:iPhone
# test-chrome-iPhone-tablet:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:iPhone:tablet
# test-chrome-hd-laptop:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:hd:laptop
# test-firefox:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife
# test-firefox-samsung:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:samsung
# test-firefox-samsung-tablet:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:samsung:tablet
# test-firefox-iPhone:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:iPhone
# test-firefox-iPhone-tablet:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:iPhone:tablet
# test-firefox-hd-laptop:
# <<: *run_test_template
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:hd:laptop
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.gitlab-ci.elife.yml
+
35
−
133
View file @
00128047
...
@@ -78,8 +78,6 @@ lint:
...
@@ -78,8 +78,6 @@ lint:
# used by psql
# used by psql
PGUSER
:
kotahidev
PGUSER
:
kotahidev
PGPASSWORD
:
kotahidev
PGPASSWORD
:
kotahidev
# this is used to ignore self signed certs
#START_SERVER_AND_TEST_INSECURE: 1
INSTANCE_NAME
:
elife
INSTANCE_NAME
:
elife
services
:
services
:
-
postgres
-
postgres
...
@@ -92,184 +90,88 @@ lint:
...
@@ -92,184 +90,88 @@ lint:
# use the example env for tests
# use the example env for tests
-
cp .env.example .env
-
cp .env.example .env
# specify host here else it confuses the linked postgres image
# specify host here else it confuses the linked postgres image
-
POSTGRES_HOST=postgres yarn test:all:
chrome:
$TEST_ITEM
-
POSTGRES_HOST=postgres yarn test:all:$TEST_ITEM
test-chrome
:
test-chrome
:
<<
:
*run_test_template
<<
:
*run_test_template
variables
:
variables
:
TEST_ITEM
:
elife
TEST_ITEM
:
"
chrome:
elife
"
script
:
script
:
-
*run_script_template
-
*run_script_template
# .test_template: &run_test_template
# image: $IMAGE_ORG/$IMAGE_NAME-dev:$CI_COMMIT_SHA
# stage: test
# variables:
# GIT_STRATEGY: none
# # setup data for postgres image
# POSTGRES_USER: kotahidev
# POSTGRES_PASSWORD: kotahidev
# # used by psql
# PGUSER: kotahidev
# PGPASSWORD: kotahidev
# # this is used to ignore self signed certs
# START_SERVER_AND_TEST_INSECURE: 1
# INSTANCE_NAME: elife
# services:
# - postgres
# #.script_template: &run_script_template
# # - cd ${HOME}
# # - apt-get -y install postgresql-client
# # # this is needed for pgboss initial setup
# # - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # # use the example env for tests
# # - cp .env.example .env
# # - # specify host here else it confuses the linked postgres image
# # - POSTGRES_HOST=postgres yarn test:all:chrome:$TEST_ITEM
# test-chrome:
# <<: *run_test_template
# variables:
# TEST_ITEM: elife
# script:
# - cd ${HOME}
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife
# test-chrome-samsung:
# test-chrome-samsung:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "chrome:elife:samsung"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:samsung
# test-chrome-samsung-tablet:
# test-chrome-samsung-tablet:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "chrome:elife:samsung:tablet"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:samsung:tablet
# test-chrome-iPhone:
# test-chrome-iPhone:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "chrome:elife:iPhone"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:iPhone
# test-chrome-iPhone-tablet:
# test-chrome-iPhone-tablet:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "chrome:elife:iPhone:tablet"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:iPhone:tablet
# test-chrome-hd-laptop:
# test-chrome-hd-laptop:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "chrome:elife:hd:laptop"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:chrome:elife:hd:laptop
# test-firefox:
# test-firefox:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "firefox:elife"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife
# test-firefox-samsung:
# test-firefox-samsung:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "firefox:elife:samsung"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:samsung
# test-firefox-samsung-tablet:
# test-firefox-samsung-tablet:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "firefox:elife:samsung:tablet"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:samsung:tablet
# test-firefox-iPhone:
# test-firefox-iPhone:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "firefox:elife:iPhone"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:iPhone
# test-firefox-iPhone-tablet:
# test-firefox-iPhone-tablet:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "firefox:elife:iPhone:tablet"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:iPhone:tablet
# test-firefox-hd-laptop:
# test-firefox-hd-laptop:
# <<: *run_test_template
# <<: *run_test_template
# variables:
# TEST_ITEM: "firefox:elife:hd:laptop"
# script:
# script:
# - cd ${HOME}
# - *run_script_template
# - apt-get -y install postgresql-client
# # this is needed for pgboss initial setup
# - psql -h postgres -U kotahidev -d kotahidev -c "create extension pgcrypto;"
# # use the example env for tests
# - cp .env.example .env
# # specify host here else it confuses the linked postgres image
# - POSTGRES_HOST=postgres yarn test:all:firefox:elife:hd:laptop
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment