Skip to content

Commit

Permalink
Fix workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaud-morvan committed Oct 5, 2022
1 parent caedbfd commit b9ed2f4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,25 @@ jobs:
runs-on: ubuntu-18.04
timeout-minutes: 60
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
TX_USR: ${{ secrets.TX_USR }}
TX_PWD: ${{ secrets.TX_PWD }}
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
steps:
- name: Install packages
run: sudo apt-get install -y gettext python3-virtualenv
- uses: actions/checkout@v1
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 10
- name: Build
run: make build
- name: Lint
run: make check
- name: Tests
run: make test
- name: Docker compose logs
if: ${{ always() }}
if: always()
run: |
docker-compose logs
docker-compose down -v --remove-orphans
Expand Down
21 changes: 20 additions & 1 deletion c2cgeoform/tests/__init__.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,32 @@
import os
import time
import unittest
from pyramid import testing
from pyramid.paster import get_appsettings
from sqlalchemy import engine_from_config
from sqlalchemy import engine_from_config, text
from webob.multidict import MultiDict

from c2cgeoform.models import (DBSession, Base)
from c2cgeoform.settings import apply_local_settings
from c2cgeoform import init_deform


def wait_for_db(engine):
sleep_time = 1
max_sleep = 30
while sleep_time < max_sleep:
try:
with engine.connect() as connection:
connection.execute(text("SELECT 1;"))
return
except Exception as e:
print(str(e))
print("Waiting for the DataBase server to be reachable")
time.sleep(sleep_time)
sleep_time *= 2
exit(1) # noqa


class DatabaseTestCase(unittest.TestCase):
def setUp(self): # noqa
curdir = os.path.dirname(os.path.abspath(__file__))
Expand All @@ -20,6 +37,8 @@ def setUp(self): # noqa
engine = engine_from_config(settings, 'sqlalchemy.')
DBSession.configure(bind=engine)

wait_for_db(engine)

from .models_test import Person, EmploymentStatus, Tag # noqa
Base.metadata.create_all(engine)
self.cleanup()
Expand Down

0 comments on commit b9ed2f4

Please sign in to comment.