From 43305da24ae8cc85ac46e8b1c8e6acd32981d9b5 Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:30:03 +0530 Subject: [PATCH 1/3] Refactor workflow to properly wait for migrations --- .github/workflows/cypress.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index f66f9a37bd8..56e932b4849 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -24,14 +24,21 @@ jobs: repository: coronasafe/care path: care - - name: Run docker compose up on care 🐳 + - name: Start care docker containers 🐳 run: | - cd care + cd care make docker_config_file=docker-compose.pre-built.yaml up - sleep 60s + until docker-compose -f docker-compose.pre-built.yaml exec -T backend bash -c "python manage.py showmigrations | grep -q '\[ \]'"; do + >&2 echo "Migrations are not yet applied - sleeping" + sleep 5 + done + cd .. + + - name: Load dummy data into care backend 📂 + run: | + cd care docker compose exec backend bash -c "python manage.py load_dummy_data" cd .. - # Voluntarily kept 60 seconds delay to wait for migrations to complete. - name: Check care is up ♻ run: curl -o /dev/null -s -w "%{http_code}\n" http://localhost:9000 From 72eed09a12547ebd97783328fcff6880b26f897e Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 12 Sep 2023 15:45:17 +0530 Subject: [PATCH 2/3] use while --- .github/workflows/cypress.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 56e932b4849..6dede288aae 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -28,10 +28,11 @@ jobs: run: | cd care make docker_config_file=docker-compose.pre-built.yaml up - until docker-compose -f docker-compose.pre-built.yaml exec -T backend bash -c "python manage.py showmigrations | grep -q '\[ \]'"; do + while docker-compose -f docker-compose.pre-built.yaml exec -T backend bash -c "python manage.py showmigrations | grep -q '\[ \]'"; do >&2 echo "Migrations are not yet applied - sleeping" sleep 5 done + echo "Migrations are applied" cd .. - name: Load dummy data into care backend 📂 From 88c915e004f87b7a9939bd0089472e2c5b6c18dd Mon Sep 17 00:00:00 2001 From: Ashesh3 <3626859+Ashesh3@users.noreply.github.com> Date: Tue, 12 Sep 2023 17:13:11 +0530 Subject: [PATCH 3/3] Fix command and remove cypress videos --- .github/workflows/cypress.yaml | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/.github/workflows/cypress.yaml b/.github/workflows/cypress.yaml index 6dede288aae..130f360d2ef 100644 --- a/.github/workflows/cypress.yaml +++ b/.github/workflows/cypress.yaml @@ -28,7 +28,7 @@ jobs: run: | cd care make docker_config_file=docker-compose.pre-built.yaml up - while docker-compose -f docker-compose.pre-built.yaml exec -T backend bash -c "python manage.py showmigrations | grep -q '\[ \]'"; do + while docker compose exec backend bash -c "python manage.py showmigrations 2>/dev/null | cat | grep -q '\[ \]'"; do >&2 echo "Migrations are not yet applied - sleeping" sleep 5 done @@ -101,10 +101,3 @@ jobs: name: cypress-screenshots path: cypress/screenshots - # Test run video was always captured, so this action uses "always()" condition - - name: Upload cypress videos 📹 - uses: actions/upload-artifact@v3 - if: always() - with: - name: cypress-videos - path: cypress/videos