From cba3bd43b6caac96a7cd4488f7dcdc73104be7db Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 09:11:13 +0800 Subject: [PATCH 01/34] github actions --- .github/workflows/build-test-pr.yaml | 29 ++++++++++++ dockerize/docker-compose.test.yml | 67 ++++++++++++++++++++++++++++ 2 files changed, 96 insertions(+) create mode 100644 .github/workflows/build-test-pr.yaml create mode 100644 dockerize/docker-compose.test.yml diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml new file mode 100644 index 00000000..e74cb444 --- /dev/null +++ b/.github/workflows/build-test-pr.yaml @@ -0,0 +1,29 @@ +name: pr-test +on: + pull_request: + branches: + - master +jobs: + docker-test: + runs-on: ubuntu-20.04 + env: + DATABASE_NAME: gis + DATABASE_USERNAME: docker + DATABASE_PASSWORD: docker + DATABASE_HOST: db + DJANGO_SETTINGS_MODULE: settings_docker + VIRTUAL_HOST: plugins.kartoza.com + VIRTUAL_PORT: 8080 + RABBITMQ_HOST: rabbitmq + ALLOW_IP_RANGE: 0.0.0.0/0 + POSTGRES_USER: docker + POSTGRES_PASS: docker + RABBIT_PASSWORD: rabbit_test_password + USER: rabbit_user + RABBITMQ_NODENAME: rabbit + steps: + - uses: actions/checkout@v2 + - name: Build containers + run: docker-compose --file dockerize/docker-compose.test.yml build + - name: Run container + run: docker-compose --file dockerize/docker-compose.test.yml up -d \ No newline at end of file diff --git a/dockerize/docker-compose.test.yml b/dockerize/docker-compose.test.yml new file mode 100644 index 00000000..f4b19492 --- /dev/null +++ b/dockerize/docker-compose.test.yml @@ -0,0 +1,67 @@ +version: '3' +services: + db: + image: kartoza/postgis:9.6-2.4 + environment: + - ALLOW_IP_RANGE=0.0.0.0/0 + - POSTGRES_USER=docker + - POSTGRES_PASS=docker + volumes: + - ./backups:/backups + restart: unless-stopped + + devweb: + build: docker + hostname: uwsgi + environment: + - DATABASE_NAME=gis + - DATABASE_USERNAME=docker + - DATABASE_PASSWORD=docker + - DATABASE_HOST=db + - DJANGO_SETTINGS_MODULE=settings_docker + - VIRTUAL_HOST=plugins.kartoza.com + - VIRTUAL_PORT=8080 + - RABBITMQ_HOST=rabbitmq + volumes: + - ../qgis-app:/home/web/django_project + - ./static:/home/web/static:rw + - ./static:/home/web/media:rw + links: + - db:db + - rabbitmq:rabbitmq + - worker:worker + restart: unless-stopped + user: root + + rabbitmq: + image: library/rabbitmq:3.6 + hostname: rabbitmq + environment: + - RABBIT_PASSWORD=rabbit_test_password + - USER=rabbit_user + - RABBITMQ_NODENAME=rabbit + restart: unless-stopped + + worker: + # Note you cannot scale if you use container_name + container_name: qgis-plugins-worker + build: docker + hostname: uwsgi + working_dir: /home/web/django_project + command: celery -A plugins worker -l info + environment: + - DATABASE_NAME=gis + - DATABASE_USERNAME=docker + - DATABASE_PASSWORD=docker + - DATABASE_HOST=db + - DJANGO_SETTINGS_MODULE=settings_docker + - VIRTUAL_HOST=plugins.kartoza.com + - VIRTUAL_PORT=8080 + - RABBITMQ_HOST=rabbitmq + volumes: + - ../qgis-app:/home/web/django_project + - ./static:/home/web/static:rw + - ./static:/home/web/media:rw + links: + - db:db + - rabbitmq:rabbitmq From 32aa60f80dce3d724695f21e6adc17e47cd8e6ab Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 09:23:57 +0800 Subject: [PATCH 02/34] github actions --- .github/workflows/build-test-pr.yaml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index e74cb444..bfaec022 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -26,4 +26,14 @@ jobs: - name: Build containers run: docker-compose --file dockerize/docker-compose.test.yml build - name: Run container - run: docker-compose --file dockerize/docker-compose.test.yml up -d \ No newline at end of file + run: docker-compose --file dockerize/docker-compose.test.yml up -d + - name: Install additional dependencies + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install coverage flake8' + - name: Run coverage test + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test --settings=core.settings.test_docker' + - name: Run coverage report + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage xml' + - name: Upload coverage to codecov + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file From 7a75543b98389525b41c04cd29792f493813cedd Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 09:31:02 +0800 Subject: [PATCH 03/34] github actions --- .github/workflows/build-test-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index bfaec022..1b1658b9 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -30,7 +30,7 @@ jobs: - name: Install additional dependencies run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install coverage flake8' - name: Run coverage test - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test --settings=core.settings.test_docker' + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test' - name: Run coverage report run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov From 7b0f56407bbd0a2c62173e212211d3b937ddea9d Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 09:42:02 +0800 Subject: [PATCH 04/34] github actions --- .github/workflows/build-test-pr.yaml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 1b1658b9..b6b61c82 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -25,8 +25,14 @@ jobs: - uses: actions/checkout@v2 - name: Build containers run: docker-compose --file dockerize/docker-compose.test.yml build - - name: Run container - run: docker-compose --file dockerize/docker-compose.test.yml up -d + - name: Run db container + run: docker-compose --file dockerize/docker-compose.test.yml up -d db + - name: Run rabbitmq container + run: docker-compose --file dockerize/docker-compose.test.yml up -d rabbitmq + - name: Run worker container + run: docker-compose --file dockerize/docker-compose.test.yml up -d worker + - name: Run devweb container + run: docker-compose --file dockerize/docker-compose.test.yml up -d devweb - name: Install additional dependencies run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install coverage flake8' - name: Run coverage test From 7af1860b8525c76e12956b12e3e770fe5ae8f750 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 09:54:01 +0800 Subject: [PATCH 05/34] github actions --- .github/workflows/build-test-pr.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index b6b61c82..32070462 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -42,4 +42,7 @@ jobs: - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: - token: ${{ secrets.CODECOV_TOKEN }} \ No newline at end of file + token: ${{ secrets.CODECOV_TOKEN }} + - name: Run flake8 + run: | + docker-compose -f deployment/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api && flake8 ./base && flake8./styles && flake8 ./geopackages flake8 ./models' \ No newline at end of file From 18b566670f306f3adaeab8eb8e8fd356b5d9af1c Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 09:57:11 +0800 Subject: [PATCH 06/34] github actions --- .github/workflows/build-test-pr.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 32070462..690aba84 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -44,5 +44,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} - name: Run flake8 - run: | - docker-compose -f deployment/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api && flake8 ./base && flake8./styles && flake8 ./geopackages flake8 ./models' \ No newline at end of file + run: docker-compose -f deployment/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api && flake8 ./base && flake8./styles && flake8 ./geopackages flake8 ./models' \ No newline at end of file From f80d076c3c21bb3de011db4d6004e1e6b04103d1 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 10:23:07 +0800 Subject: [PATCH 07/34] github actions --- .github/workflows/build-test-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 690aba84..eb752b71 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -44,4 +44,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} - name: Run flake8 - run: docker-compose -f deployment/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api && flake8 ./base && flake8./styles && flake8 ./geopackages flake8 ./models' \ No newline at end of file + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api && flake8 ./base && flake8./styles && flake8 ./geopackages flake8 ./models' \ No newline at end of file From 1ada8dfa2c928bf2008f3d936e9dcefc2e97e130 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Sun, 8 Aug 2021 11:18:03 +0800 Subject: [PATCH 08/34] github actions --- .github/workflows/build-test-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index eb752b71..9cd8dfb4 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -44,4 +44,4 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} - name: Run flake8 - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api && flake8 ./base && flake8./styles && flake8 ./geopackages flake8 ./models' \ No newline at end of file + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api ./base ./styles ./geopackages ./models' \ No newline at end of file From 0acefd90e21f5fb74ea5dfdd84eb7453e8a510f4 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Mon, 9 Aug 2021 07:59:50 +0800 Subject: [PATCH 09/34] added .flake8 --- .flake8 | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 .flake8 diff --git a/.flake8 b/.flake8 new file mode 100644 index 00000000..92438ab1 --- /dev/null +++ b/.flake8 @@ -0,0 +1,8 @@ +[flake8] +exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py,/plugins +max-line-length = 79 + +# E12x continuation line indentation +# E251 no spaces around keyword / parameter equals +# E303 too many blank lines (3) +ignore = E125,E126,E251,E303,W504,W60,F405 From 0f1dac0ed7e2301f846046f32c7d0d07c7051312 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:13:07 +0800 Subject: [PATCH 10/34] updated github action --- .github/workflows/build-test-pr.yaml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 9cd8dfb4..a66797c1 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -3,9 +3,33 @@ on: pull_request: branches: - master + push: + branches: + - master jobs: - docker-test: - runs-on: ubuntu-20.04 + lint: + runs-on: ubuntu-latest + strategy: + matrix: + python-version: + - 3.7 + steps: + - uses: actions/checkout@v2 + + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v2 + + - name: Test installing development dependencies + working-directory: deployment/docker + run: | + python -m pip install --upgrade pip + pip install flake8 + - name: Run Flake8 test + run: flake8 . + + + test: + runs-on: ubuntu-latest env: DATABASE_NAME: gis DATABASE_USERNAME: docker From 14e050e913bc91bb57de5d291c40fceaeaad157e Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:14:47 +0800 Subject: [PATCH 11/34] updated github action --- .github/workflows/build-test-pr.yaml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index a66797c1..603ce307 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -20,13 +20,12 @@ jobs: uses: actions/setup-python@v2 - name: Test installing development dependencies - working-directory: deployment/docker - run: | - python -m pip install --upgrade pip - pip install flake8 - - name: Run Flake8 test - run: flake8 . - + working-directory: deployment/docker + run: | + python -m pip install --upgrade pip + pip install flake8 + - name: Run Flake8 test + run: flake8 . test: runs-on: ubuntu-latest From e858ab718b331499147126761c9097c320c5510d Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:20:16 +0800 Subject: [PATCH 12/34] updated github action --- .github/workflows/build-test-pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 603ce307..723bc1ba 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -24,9 +24,9 @@ jobs: run: | python -m pip install --upgrade pip pip install flake8 - - name: Run Flake8 test - run: flake8 . + - name: Run Flake8 test + run: flake8 . test: runs-on: ubuntu-latest env: From e0ed604786323a80ddf1708d694d7c5a388e11ba Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:22:24 +0800 Subject: [PATCH 13/34] updated github action --- .github/workflows/build-test-pr.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 723bc1ba..75051a87 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -20,7 +20,6 @@ jobs: uses: actions/setup-python@v2 - name: Test installing development dependencies - working-directory: deployment/docker run: | python -m pip install --upgrade pip pip install flake8 From 6e8b41cae4cd36cc84d5b7eb34d72e4e8ccb73b2 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:26:05 +0800 Subject: [PATCH 14/34] updated github action --- .github/workflows/build-test-pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 75051a87..0ca03488 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -25,6 +25,7 @@ jobs: pip install flake8 - name: Run Flake8 test + working-directory: qgis-app run: flake8 . test: runs-on: ubuntu-latest From 14c8753f15e19a71e7b419b0af94b38ebe313b7d Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:37:06 +0800 Subject: [PATCH 15/34] updated github action --- .flake8 | 4 +++- .github/workflows/build-test-pr.yaml | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 92438ab1..24055736 100644 --- a/.flake8 +++ b/.flake8 @@ -1,5 +1,7 @@ [flake8] -exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py,/plugins +exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py, + # we don't check this for now, until it's been fixed. otherwise it will throw lot of errors + */plugins max-line-length = 79 # E12x continuation line indentation diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 0ca03488..75051a87 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -25,7 +25,6 @@ jobs: pip install flake8 - name: Run Flake8 test - working-directory: qgis-app run: flake8 . test: runs-on: ubuntu-latest From 576e68cba3430ddab7cc1c430f4ae6607e043449 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:42:41 +0800 Subject: [PATCH 16/34] updated github action --- .flake8 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 24055736..4de89a0d 100644 --- a/.flake8 +++ b/.flake8 @@ -1,10 +1,10 @@ [flake8] exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py, # we don't check this for now, until it's been fixed. otherwise it will throw lot of errors - */plugins + */plugins,*/userexport,*/lib/templatetags,*/vagrant_asset max-line-length = 79 # E12x continuation line indentation # E251 no spaces around keyword / parameter equals # E303 too many blank lines (3) -ignore = E125,E126,E251,E303,W504,W60,F405 +ignore = E121,E125,E126,E127,E251,E303,W503,W504,W60,F405 From 11f023efc381a73a86cab5a0a989c86f80506767 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 17:53:41 +0800 Subject: [PATCH 17/34] updated github action --- .flake8 | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.flake8 b/.flake8 index 4de89a0d..1df5c1d8 100644 --- a/.flake8 +++ b/.flake8 @@ -1,10 +1,11 @@ [flake8] exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py, # we don't check this for now, until it's been fixed. otherwise it will throw lot of errors - */plugins,*/userexport,*/lib/templatetags,*/vagrant_asset + */plugins/*,*/userexport/*,*/lib/templatetags/*,*/vagrant_assets/*,*/users/*, + */settings*, */qgis_context_processor.py,*/search_sites.py,*/manage.py,*/wsgi.py max-line-length = 79 # E12x continuation line indentation # E251 no spaces around keyword / parameter equals # E303 too many blank lines (3) -ignore = E121,E125,E126,E127,E251,E303,W503,W504,W60,F405 +ignore = E121,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405 From 0079632b18f8c2ad02b87a295f5dde919cfa7ed7 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 18:16:55 +0800 Subject: [PATCH 18/34] updated github action --- .flake8 | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.flake8 b/.flake8 index 1df5c1d8..5ac24663 100644 --- a/.flake8 +++ b/.flake8 @@ -1,11 +1,22 @@ [flake8] exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/*,*/__init__.py, + */manage.py,*/wsgi.py, # we don't check this for now, until it's been fixed. otherwise it will throw lot of errors - */plugins/*,*/userexport/*,*/lib/templatetags/*,*/vagrant_assets/*,*/users/*, - */settings*, */qgis_context_processor.py,*/search_sites.py,*/manage.py,*/wsgi.py + qgis-app/plugins/*, + qgis-app/userexport/*, + qgis-app/lib/templatetags/*, + qgis-app/vagrant_assets/*, + qgis-app/users/*, + qgis-app/settings*, + qgis-app/qgis_context_processor.py, + qgis-app/search_sites.py, + qgis-app/urls.py, + qgis-app/custom_haystack_urls.py, + qgis-app/middleware.py, + qgis-app/homepage.py max-line-length = 79 # E12x continuation line indentation # E251 no spaces around keyword / parameter equals # E303 too many blank lines (3) -ignore = E121,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405 +ignore = E121,E122,E123,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405 From 31fdb7384f26f3ebb5ddafe2ffb932c50e15177b Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 13 Aug 2021 18:18:28 +0800 Subject: [PATCH 19/34] updated github action --- .flake8 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.flake8 b/.flake8 index 5ac24663..dd50e4bb 100644 --- a/.flake8 +++ b/.flake8 @@ -5,7 +5,7 @@ exclude = */docs/*,*/.tox/*,*/.venv/*,*/.pycharm_helpers/*,*/migrations/*,docs/* qgis-app/plugins/*, qgis-app/userexport/*, qgis-app/lib/templatetags/*, - qgis-app/vagrant_assets/*, + vagrant_assets/*, qgis-app/users/*, qgis-app/settings*, qgis-app/qgis_context_processor.py, From a1e11eb0422cac5530b454d81dca6f9e7ffe68fc Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:20:18 +0800 Subject: [PATCH 20/34] update gh action --- .flake8 | 2 +- .github/workflows/build-test-pr.yaml | 24 ++++++++++-------------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/.flake8 b/.flake8 index dd50e4bb..7b4789c0 100644 --- a/.flake8 +++ b/.flake8 @@ -19,4 +19,4 @@ max-line-length = 79 # E12x continuation line indentation # E251 no spaces around keyword / parameter equals # E303 too many blank lines (3) -ignore = E121,E122,E123,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405 +ignore = E121,E122,E123,E124,E125,E126,E127,E128,E251,E303,W503,W504,W60,F405 diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 75051a87..e7463056 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -46,24 +46,20 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build containers - run: docker-compose --file dockerize/docker-compose.test.yml build - - name: Run db container - run: docker-compose --file dockerize/docker-compose.test.yml up -d db - - name: Run rabbitmq container - run: docker-compose --file dockerize/docker-compose.test.yml up -d rabbitmq - - name: Run worker container - run: docker-compose --file dockerize/docker-compose.test.yml up -d worker - - name: Run devweb container - run: docker-compose --file dockerize/docker-compose.test.yml up -d devweb + run: docker-compose build + - name: Run docker-compose services + working-directory: dockerize + run: | + make build + make db + make devweb - name: Install additional dependencies - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install coverage flake8' + run: docker-compose exec -T devweb bash -c 'pip install coverage flake8' - name: Run coverage test - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test' + run: docker-compose exec -T devweb bash -c 'coverage run manage.py test' - name: Run coverage report - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage xml' + run: docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: token: ${{ secrets.CODECOV_TOKEN }} - - name: Run flake8 - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'flake8 ./api ./base ./styles ./geopackages ./models' \ No newline at end of file From 01cc25b05a1cc5bbd3d1ff7fc46895dffa2c9d52 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:21:55 +0800 Subject: [PATCH 21/34] update gh action --- .github/workflows/build-test-pr.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index e7463056..82307c23 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -45,8 +45,6 @@ jobs: RABBITMQ_NODENAME: rabbit steps: - uses: actions/checkout@v2 - - name: Build containers - run: docker-compose build - name: Run docker-compose services working-directory: dockerize run: | From 63ae37c3fa4cd15abd534038323979b18df0790f Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:29:47 +0800 Subject: [PATCH 22/34] update gh action --- .github/workflows/build-test-pr.yaml | 27 +++++++-------------------- 1 file changed, 7 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 82307c23..d7a0af03 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -28,21 +28,8 @@ jobs: run: flake8 . test: runs-on: ubuntu-latest - env: - DATABASE_NAME: gis - DATABASE_USERNAME: docker - DATABASE_PASSWORD: docker - DATABASE_HOST: db - DJANGO_SETTINGS_MODULE: settings_docker - VIRTUAL_HOST: plugins.kartoza.com - VIRTUAL_PORT: 8080 - RABBITMQ_HOST: rabbitmq - ALLOW_IP_RANGE: 0.0.0.0/0 - POSTGRES_USER: docker - POSTGRES_PASS: docker - RABBIT_PASSWORD: rabbit_test_password - USER: rabbit_user - RABBITMQ_NODENAME: rabbit + needs: + - lint steps: - uses: actions/checkout@v2 - name: Run docker-compose services @@ -51,12 +38,12 @@ jobs: make build make db make devweb - - name: Install additional dependencies - run: docker-compose exec -T devweb bash -c 'pip install coverage flake8' - name: Run coverage test - run: docker-compose exec -T devweb bash -c 'coverage run manage.py test' - - name: Run coverage report - run: docker-compose exec -T devweb bash -c 'coverage xml' + working-directory: dockerize + run: | + docker-compose exec -T devweb bash -c 'pip install coverage' + docker-compose exec -T devweb bash -c 'coverage run manage.py test' + docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From 73500071022aad4ec7c952bd25fa2bd4494a917e Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:36:44 +0800 Subject: [PATCH 23/34] update gh action --- .github/workflows/build-test-pr.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index d7a0af03..2d58d894 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -41,9 +41,12 @@ jobs: - name: Run coverage test working-directory: dockerize run: | - docker-compose exec -T devweb bash -c 'pip install coverage' - docker-compose exec -T devweb bash -c 'coverage run manage.py test' - docker-compose exec -T devweb bash -c 'coverage xml' + cat << EOF | docker-compose exec -T devweb bash + pip install coverage +# -c 'pip install coverage' +# docker-compose exec -T devweb bash -c 'coverage run manage.py test' +# docker-compose exec -T devweb bash -c 'coverage xml' + EOF - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From fc2f045d1b577b307a16f2f1a1b74560b47ec9f2 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:41:16 +0800 Subject: [PATCH 24/34] update gh action --- .github/workflows/build-test-pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 2d58d894..0d0c0c3f 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -43,10 +43,10 @@ jobs: run: | cat << EOF | docker-compose exec -T devweb bash pip install coverage + EOF # -c 'pip install coverage' # docker-compose exec -T devweb bash -c 'coverage run manage.py test' # docker-compose exec -T devweb bash -c 'coverage xml' - EOF - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From dbc1b86afddb3f38a85af7c04e93ec11a8da740b Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:46:53 +0800 Subject: [PATCH 25/34] update gh action --- .github/workflows/build-test-pr.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 0d0c0c3f..798c16fa 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -41,10 +41,7 @@ jobs: - name: Run coverage test working-directory: dockerize run: | - cat << EOF | docker-compose exec -T devweb bash - pip install coverage - EOF -# -c 'pip install coverage' + docker-compose exec -T devweb bash -c 'pip install coverage' # docker-compose exec -T devweb bash -c 'coverage run manage.py test' # docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov From 1a729d3a9acc363271c943d8e65c39fc6b1e7881 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 14:55:21 +0800 Subject: [PATCH 26/34] update gh action --- .github/workflows/build-test-pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 798c16fa..d7a0af03 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -42,8 +42,8 @@ jobs: working-directory: dockerize run: | docker-compose exec -T devweb bash -c 'pip install coverage' -# docker-compose exec -T devweb bash -c 'coverage run manage.py test' -# docker-compose exec -T devweb bash -c 'coverage xml' + docker-compose exec -T devweb bash -c 'coverage run manage.py test' + docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From e0cbca2bee7db8793c7556f813488cc5541f4392 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 15:00:43 +0800 Subject: [PATCH 27/34] update gh action --- .github/workflows/build-test-pr.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index d7a0af03..d08b0d1d 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -41,9 +41,9 @@ jobs: - name: Run coverage test working-directory: dockerize run: | - docker-compose exec -T devweb bash -c 'pip install coverage' - docker-compose exec -T devweb bash -c 'coverage run manage.py test' - docker-compose exec -T devweb bash -c 'coverage xml' + docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'pip install coverage' +# docker-compose exec -T devweb bash -c 'coverage run manage.py test' +# docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From 66f4a2423b292e42859f231b723bc0cef0132737 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 15:14:26 +0800 Subject: [PATCH 28/34] update gh action --- .github/workflows/build-test-pr.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index d08b0d1d..7c674efb 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -42,6 +42,8 @@ jobs: working-directory: dockerize run: | docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'pip install coverage' + docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage run manage.py test' + docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage xml' # docker-compose exec -T devweb bash -c 'coverage run manage.py test' # docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov From 9d3d865e7e8c75074fa57db12b2bea5f9d872461 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 15:21:38 +0800 Subject: [PATCH 29/34] update gh action --- .github/workflows/build-test-pr.yaml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 7c674efb..eb1812e7 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -38,12 +38,16 @@ jobs: make build make db make devweb - - name: Run coverage test - working-directory: dockerize - run: | - docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'pip install coverage' - docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage run manage.py test' - docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage xml' + - name: install coveage + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install flake8' + - name: run coverage + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test' +# - name: Run coverage test +# working-directory: dockerize +# run: | +# docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'pip install coverage' +# docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage run manage.py test' +# docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage xml' # docker-compose exec -T devweb bash -c 'coverage run manage.py test' # docker-compose exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov From 26efc4b037e87f765893f39ca345ca20584241a8 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 15:38:15 +0800 Subject: [PATCH 30/34] update gh action --- .github/workflows/build-test-pr.yaml | 32 +++++++++++++--------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index eb1812e7..2e133d0e 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -32,24 +32,22 @@ jobs: - lint steps: - uses: actions/checkout@v2 - - name: Run docker-compose services - working-directory: dockerize - run: | - make build - make db - make devweb - - name: install coveage - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install flake8' - - name: run coverage + - name: Build containers + run: docker-compose --file dockerize/docker-compose.test.yml build + - name: Run db container + run: docker-compose --file dockerize/docker-compose.test.yml up -d db + - name: Run rabbitmq container + run: docker-compose --file dockerize/docker-compose.test.yml up -d rabbitmq + - name: Run worker container + run: docker-compose --file dockerize/docker-compose.test.yml up -d worker + - name: Run devweb container + run: docker-compose --file dockerize/docker-compose.test.yml up -d devweb + - name: Install additional dependencies + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install coverage flake8' + - name: Run coverage test run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test' -# - name: Run coverage test -# working-directory: dockerize -# run: | -# docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'pip install coverage' -# docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage run manage.py test' -# docker-compose exec -f dockerize/docker-compose.yml -T devweb bash -c 'coverage xml' -# docker-compose exec -T devweb bash -c 'coverage run manage.py test' -# docker-compose exec -T devweb bash -c 'coverage xml' + - name: Run coverage report + run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From e86a43141125d47e3be06f05b5c005c55db83e9b Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 16:42:45 +0800 Subject: [PATCH 31/34] update gh action --- .github/workflows/build-test-pr.yaml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 2e133d0e..8b83329a 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -33,21 +33,21 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build containers - run: docker-compose --file dockerize/docker-compose.test.yml build + run: docker-compose --file dockerize/docker-compose.yml build - name: Run db container - run: docker-compose --file dockerize/docker-compose.test.yml up -d db + run: docker-compose --file dockerize/docker-compose.yml up -d db - name: Run rabbitmq container - run: docker-compose --file dockerize/docker-compose.test.yml up -d rabbitmq + run: docker-compose --file dockerize/docker-compose.yml up -d rabbitmq - name: Run worker container - run: docker-compose --file dockerize/docker-compose.test.yml up -d worker + run: docker-compose --file dockerize/docker-compose.yml up -d worker - name: Run devweb container - run: docker-compose --file dockerize/docker-compose.test.yml up -d devweb + run: docker-compose --file dockerize/docker-compose.yml up -d devweb - name: Install additional dependencies - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'pip install coverage flake8' + run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'pip install coverage flake8' - name: Run coverage test - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage run manage.py test' + run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage run manage.py test' - name: Run coverage report - run: docker-compose -f dockerize/docker-compose.test.yml exec -T devweb bash -c 'coverage xml' + run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From 3cfdf99b03b947d20c3fb697f9a73c59af2eac31 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 16:50:02 +0800 Subject: [PATCH 32/34] update gh action --- .github/workflows/build-test-pr.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 8b83329a..3a25e646 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -33,7 +33,8 @@ jobs: steps: - uses: actions/checkout@v2 - name: Build containers - run: docker-compose --file dockerize/docker-compose.yml build + working-directory: dockerize + run: docker-compose build - name: Run db container run: docker-compose --file dockerize/docker-compose.yml up -d db - name: Run rabbitmq container From 9dbf2dbdc256a9ccbb6ce657a4aa26f4488eaeb7 Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 16:59:50 +0800 Subject: [PATCH 33/34] update gh action --- .github/workflows/build-test-pr.yaml | 40 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 3a25e646..36b2a5b7 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -32,23 +32,33 @@ jobs: - lint steps: - uses: actions/checkout@v2 - - name: Build containers + - name: Run docker-compose build working-directory: dockerize run: docker-compose build - - name: Run db container - run: docker-compose --file dockerize/docker-compose.yml up -d db - - name: Run rabbitmq container - run: docker-compose --file dockerize/docker-compose.yml up -d rabbitmq - - name: Run worker container - run: docker-compose --file dockerize/docker-compose.yml up -d worker - - name: Run devweb container - run: docker-compose --file dockerize/docker-compose.yml up -d devweb - - name: Install additional dependencies - run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'pip install coverage flake8' - - name: Run coverage test - run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage run manage.py test' - - name: Run coverage report - run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage xml' + - name: Run the containers + working-directory: dockerize + run: docker-compose up -d db devweb +# - name: Run rabbitmq container +# run: docker-compose --file dockerize/docker-compose.yml up -d rabbitmq +# - name: Run worker container +# run: docker-compose --file dockerize/docker-compose.yml up -d worker +# - name: Run devweb container +# run: docker-compose --file dockerize/docker-compose.yml up -d devweb + - name: Run Coverage test + working-directory: dockerize + run: | + cat << EOF | docker-compose exec -T devweb bash + pip install coverage + python manage.py makemigrations + python manage.py migrate + coverage run manage.py test + coverage xml + EOF +# run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'pip install coverage flake8' +# - name: Run coverage test +# run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage run manage.py test' +# - name: Run coverage report +# run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov uses: codecov/codecov-action@v1 with: From f805e6494e3f5c8422d8059669bc45d0bbf18d8f Mon Sep 17 00:00:00 2001 From: Sumandari Date: Fri, 20 Aug 2021 17:06:17 +0800 Subject: [PATCH 34/34] update gh action --- .github/workflows/build-test-pr.yaml | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/.github/workflows/build-test-pr.yaml b/.github/workflows/build-test-pr.yaml index 36b2a5b7..712a1b81 100644 --- a/.github/workflows/build-test-pr.yaml +++ b/.github/workflows/build-test-pr.yaml @@ -38,12 +38,6 @@ jobs: - name: Run the containers working-directory: dockerize run: docker-compose up -d db devweb -# - name: Run rabbitmq container -# run: docker-compose --file dockerize/docker-compose.yml up -d rabbitmq -# - name: Run worker container -# run: docker-compose --file dockerize/docker-compose.yml up -d worker -# - name: Run devweb container -# run: docker-compose --file dockerize/docker-compose.yml up -d devweb - name: Run Coverage test working-directory: dockerize run: | @@ -54,12 +48,7 @@ jobs: coverage run manage.py test coverage xml EOF -# run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'pip install coverage flake8' -# - name: Run coverage test -# run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage run manage.py test' -# - name: Run coverage report -# run: docker-compose -f dockerize/docker-compose.yml exec -T devweb bash -c 'coverage xml' - name: Upload coverage to codecov - uses: codecov/codecov-action@v1 + uses: codecov/codecov-action@v2 with: token: ${{ secrets.CODECOV_TOKEN }}