From 30587d56fca4264a38746f93a0a2fb8631d7a908 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Tue, 3 Oct 2023 20:49:27 +0300 Subject: [PATCH 1/4] first varient --- .github/workflows/tests.yml | 56 +++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/tests.yml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 000000000..1bc01adbe --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,56 @@ +name: Testing BE +on: pull_request + +env: + SECRET_KEY: django-insecure-8p_=_(i8$#=t_n26md(d7=gpc%5sss!4-1a0cp(lir3-0x^$8% + PG_DB: db + PG_USER: postgres + PG_PASSWORD: postgres + DB_HOST: db + DB_PORT: 5432 + EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend + EMAIL_HOST: smtp.gmail.com + EMAIL_PORT: 587 + EMAIL_USE_TLS: 1 + EMAIL_HOST_USER: forumsoftserve@gmail.com + EMAIL_HOST_PASSWORD: evezhjqcfubkudrg + CORS_ORIGIN_WHITELIST: '' + +jobs: + build: + name: Testing + runs-on: ubuntu-latest + services: + # Label used to access the service container ? + postgres: + # Docker Hub image + image: postgres + # Provide the password for postgres + env: + POSTGRES_USER: postgres + POSTGRES_DB: db + POSTGRES_PASSWORD: postgres +# # Set health checks to wait until postgres has started + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + # Maps tcp port 5432 on service container to the host + - 5432:5432 + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-python@v3 + with: + python-verion: 3.10 + - name: install requirements.txt + run: | + python -m pip install --upgrade pip + pip install -r medsite/requirements.txt + - name: Create Migrations + run: | + python manage.py makemigrations + python manage.py migrate + - name: running tests + run: python manage.py test \ No newline at end of file From 7a84269387ab1a82eabf55165c675fa59e6178e2 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Tue, 3 Oct 2023 20:52:35 +0300 Subject: [PATCH 2/4] delete wrong path --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1bc01adbe..9cd7142bf 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -47,7 +47,7 @@ jobs: - name: install requirements.txt run: | python -m pip install --upgrade pip - pip install -r medsite/requirements.txt + pip install -r requirements.txt - name: Create Migrations run: | python manage.py makemigrations From e3158d196094c9085aca6a453e241311496f8c90 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Tue, 3 Oct 2023 20:55:25 +0300 Subject: [PATCH 3/4] change host --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 9cd7142bf..e5dd875fa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -6,7 +6,7 @@ env: PG_DB: db PG_USER: postgres PG_PASSWORD: postgres - DB_HOST: db + DB_HOST: 127.0.0.1 DB_PORT: 5432 EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend EMAIL_HOST: smtp.gmail.com From f7b089eefbfafae0b976ee7f6021de8a9bb7e784 Mon Sep 17 00:00:00 2001 From: Sofia Bilous Date: Wed, 4 Oct 2023 18:32:16 +0300 Subject: [PATCH 4/4] change env in Git Actins --- .github/workflows/tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e5dd875fa..c564a0fcd 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,10 +10,10 @@ env: DB_PORT: 5432 EMAIL_BACKEND: django.core.mail.backends.smtp.EmailBackend EMAIL_HOST: smtp.gmail.com - EMAIL_PORT: 587 + EMAIL_PORT: 572 EMAIL_USE_TLS: 1 - EMAIL_HOST_USER: forumsoftserve@gmail.com - EMAIL_HOST_PASSWORD: evezhjqcfubkudrg + EMAIL_HOST_USER: test@test.com + EMAIL_HOST_PASSWORD: Test1234 CORS_ORIGIN_WHITELIST: '' jobs: @@ -53,4 +53,4 @@ jobs: python manage.py makemigrations python manage.py migrate - name: running tests - run: python manage.py test \ No newline at end of file + run: python manage.py test