Skip to content

Commit a0fcd50

Browse files
committed
Adopt for github workflow
1 parent 44af173 commit a0fcd50

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

tests/settings.py

+11-3
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,14 @@
258258
# logging debugging messages to to a file.
259259
debug_file_path = os.environ.get("RESOLWE_LOG_FILE", os.devnull)
260260

261+
github_actions = os.environ.get("GITHUB_ACTIONS") == "true"
262+
console_level = "WARNING"
263+
default_logger_handlers = ["file"]
264+
265+
if github_actions:
266+
console_level = "DEBUG"
267+
default_logger_handlers = ["console", "file"]
268+
261269
LOGGING = {
262270
"version": 1,
263271
"disable_existing_loggers": False,
@@ -269,19 +277,19 @@
269277
"handlers": {
270278
"console": {
271279
"class": "logging.StreamHandler",
272-
"level": "WARNING",
280+
"level": console_level,
273281
"formatter": "standard",
274282
},
275283
"file": {
276284
"class": "logging.handlers.RotatingFileHandler",
277285
"filename": debug_file_path,
278286
"formatter": "standard",
279-
#"maxBytes": 1024 * 1024 * 10, # 10 MB
287+
"maxBytes": 1024 * 1024 * 100, # 100 MB
280288
},
281289
},
282290
"loggers": {
283291
"": {
284-
"handlers": ["file"],
292+
"handlers": default_logger_handlers,
285293
"level": "DEBUG",
286294
},
287295
},

tox.ini

+1-5
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ extras =
3535
!docs: test
3636
passenv =
3737
# Pass environment variables controlling project's tests.
38-
py{36,37,38}{,-storage-credentials},migrations: RESOLWE_* DOCKER_* DJANGO_TEST_PROCESSES TRAVIS LC_*
38+
py{36,37,38}{,-storage-credentials},migrations: RESOLWE_* DOCKER_* DJANGO_TEST_PROCESSES TRAVIS LC_* GITHUB_*
3939
whitelist_externals =
4040
migrations: bash
4141
migrations: psql
@@ -82,10 +82,6 @@ commands =
8282
packaging: python setup.py check --metadata --restructuredtext --strict
8383

8484
# Migrations commands:
85-
migrations: psql --username={env:RESOLWE_POSTGRESQL_USER:resolwe} \
86-
migrations: --host={env:RESOLWE_POSTGRESQL_HOST:localhost} \
87-
migrations: --port={env:RESOLWE_POSTGRESQL_PORT:5432} \
88-
migrations: --command='CREATE DATABASE "'{env:RESOLWE_POSTGRESQL_NAME:resolwe}'"'
8985
migrations: python tests/manage.py migrate
9086
migrations: bash -c '[[ $(./tests/manage.py makemigrations --dry-run) = '\
9187
migrations: '"No changes detected" ]] || exit 1'

0 commit comments

Comments
 (0)