diff --git a/.github/workflows/create-docker-action.yml b/.github/workflows/create-docker-action.yml index 4bb7cca..76a4df2 100644 --- a/.github/workflows/create-docker-action.yml +++ b/.github/workflows/create-docker-action.yml @@ -2,14 +2,64 @@ name: Create and publish a Docker image on: push: - branches: ['master'] + branches: ['main', 'chore/*', 'feature/*', 'bug/*'] env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} jobs: + sonarcloud: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # Disabling shallow clone is recommended for improving relevancy of reporting + fetch-depth: 0 + - name: SonarCloud Scan + uses: sonarsource/sonarcloud-github-action@master + with: + args: > + -Dsonar.organization=sartography + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + + run_tests: + runs-on: ubuntu-latest + services: + postgres: + image: postgres + env: + POSTGRES_PASSWORD: postgres + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 + ports: + - 5432:5432 + steps: + - name: Checkout repository + uses: actions/checkout@v2 + - uses: browser-actions/setup-chrome@latest + with: + chrome-version: stable + - uses: actions/setup-python@v3 + with: + python-version: '3.9' + architecture: 'x64' + - run: psql -h localhost -c 'create database pb_test;' -U postgres + - run: pip install pipenv + - run: pipenv install --dev + - run: pipenv run coverage run -m pytest + - run: pipenv run coverage xml -i + build-and-push-image: + needs: + - run_tests + - sonarcloud runs-on: ubuntu-latest permissions: contents: read diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index d6d8e8f..0000000 --- a/.travis.yml +++ /dev/null @@ -1,38 +0,0 @@ -language: python - -python: - - "3.8" - -services: - - postgresql - - docker - -addons: - chrome: stable - sonarcloud: - organization: "sartography" - -before_install: - - psql -c 'create database pb_test;' -U postgres - -install: - - pipenv install --dev - -env: - global: - - TESTING=true - - SQLALCHEMY_DATABASE_URI="postgresql://postgres:@localhost:5432/pb_test" - -script: - - pipenv run coverage run -m pytest - - pipenv run coverage xml -i - -after_success: - - sonar-scanner - -notifications: - email: - on_success: change - on_failure: always - recipients: - - dan@sartography.com diff --git a/config/default.py b/config/default.py index dc628fa..ba942a8 100644 --- a/config/default.py +++ b/config/default.py @@ -17,7 +17,7 @@ APPLICATION_ROOT = re.sub(r'//', '/', '/%s/' % environ.get('APPLICATION_ROOT', d DB_HOST = environ.get('DB_HOST', default="localhost") DB_PORT = environ.get('DB_PORT', default="5432") -DB_NAME = environ.get('DB_NAME', default="pb") +DB_NAME = environ.get('DB_NAME', default="pb2") DB_USER = environ.get('DB_USER', default="crc_user") DB_PASSWORD = environ.get('DB_PASSWORD', default="crc_pass") SQLALCHEMY_DATABASE_URI = environ.get(