From 3d91dbea71612f065247081e869065e41e1e5d55 Mon Sep 17 00:00:00 2001 From: Izzatul Muttaqin <izzatul.muttaqin@gmail.com> Date: Tue, 24 Sep 2019 19:34:58 -0400 Subject: [PATCH 1/5] functional test and ci --- .gitlab-ci.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c556300..979f50b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,6 +1,7 @@ stages: - test - deploy + - functional_test UnitTest: image: python:3.6 @@ -33,3 +34,20 @@ Deployment: url: $HEROKU_APP_HOST only: - master + +TestFunctional: + image: python:3.6 + stage: test_functional + before_script: + - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - + - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list + - pip3 install -r requirements.txt + - apt-get update -qq && apt-get install -y -qq unzip + - apt-get install -y google-chrome-stable + - apt-get install -y xvfb + - wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip + - unzip chromedriver_linux64.zip + - python manage.py runserver 8000 & + when: on_success + script: + - python3 functional_tests.py -- GitLab From 74e9b4806ba2921fc50d2629643765fc25dd327f Mon Sep 17 00:00:00 2001 From: Izzatul Muttaqin <izzatul.muttaqin@gmail.com> Date: Tue, 24 Sep 2019 19:45:58 -0400 Subject: [PATCH 2/5] Change deploy ci --- .gitlab-ci.yml | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 979f50b..d60fd15 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -7,13 +7,13 @@ UnitTest: image: python:3.6 stage: test before_script: - - pip install -r requirements.txt - - pip install requests - - pip install django-environ - - python manage.py makemigrations - - python manage.py migrate - - python manage.py collectstatic --no-input - - python manage.py runserver 8000 & + - pip3 install -r requirements.txt + - pip3 install requests + - pip3 install django-environ + - python3 manage.py makemigrations + - python3 manage.py migrate + - python3 manage.py collectstatic --no-input + - python3 manage.py runserver 8000 & when: on_success script: - coverage run --include='personal_*' manage.py test @@ -28,7 +28,8 @@ Deployment: script: - dpl --provider=heroku --app=$HEROKU_APPNAME --api-key=$HEROKU_APIKEY - export HEROKU_API_KEY=$HEROKU_APIKEY - - heroku run --app $HEROKU_APPNAME migrate + - heroku ps:scale web=1 migrate=1 --app $HEROKU_APPNAME + - heroku ps:restart --app=$HEROKU_APPNAME environment: name: production url: $HEROKU_APP_HOST @@ -42,12 +43,15 @@ TestFunctional: - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list - pip3 install -r requirements.txt + - pip3 install requests + - pip3 install django-environ - apt-get update -qq && apt-get install -y -qq unzip - apt-get install -y google-chrome-stable - apt-get install -y xvfb - wget https://chromedriver.storage.googleapis.com/2.41/chromedriver_linux64.zip - unzip chromedriver_linux64.zip - - python manage.py runserver 8000 & when: on_success script: - python3 functional_tests.py + only: + - master \ No newline at end of file -- GitLab From d07cc84409c1da576d82b6a91bc6bf0c0222beb6 Mon Sep 17 00:00:00 2001 From: Izzatul Muttaqin <izzatul.muttaqin@gmail.com> Date: Tue, 24 Sep 2019 19:47:52 -0400 Subject: [PATCH 3/5] Change deploy ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d60fd15..142bf98 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -36,7 +36,7 @@ Deployment: only: - master -TestFunctional: +FunctionalTest: image: python:3.6 stage: test_functional before_script: -- GitLab From e41bf8f97f9a739f9820e9d560c3f3a346a825a9 Mon Sep 17 00:00:00 2001 From: Izzatul Muttaqin <izzatul.muttaqin@gmail.com> Date: Tue, 24 Sep 2019 19:49:01 -0400 Subject: [PATCH 4/5] Change deploy ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 142bf98..79983f8 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ Deployment: FunctionalTest: image: python:3.6 - stage: test_functional + stage: funtional_test before_script: - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list -- GitLab From e05b4ead3403a93226582abd7965526c13c269f7 Mon Sep 17 00:00:00 2001 From: Izzatul Muttaqin <izzatul.muttaqin@gmail.com> Date: Tue, 24 Sep 2019 19:49:47 -0400 Subject: [PATCH 5/5] Change deploy ci --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 79983f8..f4b3a69 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -38,7 +38,7 @@ Deployment: FunctionalTest: image: python:3.6 - stage: funtional_test + stage: functional_test before_script: - wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add - - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google.list -- GitLab