-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #212 from City-of-Helsinki/develop
Release 20210202
- Loading branch information
Showing
17 changed files
with
240 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
name: MVJ CI | ||
|
||
on: | ||
push: | ||
branches: [master, develop] | ||
pull_request: | ||
branches: [master, develop] | ||
|
||
jobs: | ||
build: | ||
env: | ||
DATABASE_URL: 'postgis://postgres:postgres@localhost/github_actions' | ||
|
||
runs-on: ubuntu-18.04 | ||
strategy: | ||
matrix: | ||
python: [3.6, 3.7] | ||
|
||
services: | ||
postgres: | ||
image: postgis/postgis:10-2.5 | ||
env: | ||
POSTGRES_USER: postgres | ||
POSTGRES_PASSWORD: postgres | ||
POSTGRES_DB: github_actions | ||
ports: | ||
- 5432:5432 | ||
# needed because the postgres container does not provide a healthcheck | ||
options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python }} | ||
|
||
- name: Install postgis prerequisites | ||
run: sudo apt-get install gdal-bin | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -U pip | ||
pip install codecov -r requirements.txt -r requirements-dev.txt | ||
- name: Check and run migrations | ||
env: | ||
DATABASE_URL: ${{ env.DATABASE_URL }} | ||
run: | | ||
python manage.py makemigrations --dry-run --check | ||
python manage.py migrate | ||
- name: Run black, flake8 and isort | ||
run: | | ||
black --check . | ||
flake8 | ||
isort . --check-only --diff | ||
- name: Run tests | ||
run: | | ||
pytest -ra -vvv --doctest-modules --cov=. | ||
./run-type-checks | ||
- name: Run codecov | ||
run: codecov |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
leasing/migrations/0027_change_rent_base_fields_required.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import enumfields.fields | ||
from django.db import migrations, models | ||
|
||
import leasing.enums | ||
|
||
|
||
def forwards_func(apps, schema_editor): | ||
ContractRent = apps.get_model("leasing", "ContractRent") # noqa: N806 | ||
|
||
contract_rents_with_missing_data_qs = ContractRent.objects.exclude( | ||
base_amount__isnull=False | ||
) | ContractRent.objects.exclude(base_amount_period__isnull=False) | ||
|
||
for contract_rent in contract_rents_with_missing_data_qs: | ||
if not contract_rent.base_amount: | ||
contract_rent.base_amount = contract_rent.amount | ||
if not contract_rent.base_amount_period: | ||
contract_rent.base_amount_period = contract_rent.period | ||
contract_rent.save() | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("leasing", "0026_land_use_agreement_estate_remove_unique"), | ||
] | ||
|
||
operations = [ | ||
migrations.RunPython(forwards_func, migrations.RunPython.noop), | ||
migrations.AlterField( | ||
model_name="contractrent", | ||
name="base_amount", | ||
field=models.DecimalField( | ||
decimal_places=2, max_digits=10, verbose_name="Base amount" | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="contractrent", | ||
name="base_amount_period", | ||
field=enumfields.fields.EnumField( | ||
enum=leasing.enums.PeriodType, | ||
max_length=30, | ||
verbose_name="Base amount period", | ||
), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.