Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Machina Callida
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
0
Merge Requests
0
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
callidus
Machina Callida
Commits
937eb7a9
Commit
937eb7a9
authored
Jul 15, 2020
by
Konstantin Schulz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
backend CI should now fail if any unit test fails
parent
792c713a
Pipeline
#12439
passed with stages
in 2 minutes and 41 seconds
Changes
7
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
12 deletions
+23
-12
.gitlab-ci.yml
.gitlab-ci.yml
+1
-1
coverage_local.sh
coverage_local.sh
+2
-2
mc_backend/.coveragerc
mc_backend/.coveragerc
+1
-0
mc_backend/coverage_backend.sh
mc_backend/coverage_backend.sh
+4
-0
mc_backend/mcserver/app/__init__.py
mc_backend/mcserver/app/__init__.py
+12
-8
mc_backend/mcserver/config.py
mc_backend/mcserver/config.py
+2
-0
mc_frontend/src/app/helper.service.ts
mc_frontend/src/app/helper.service.ts
+1
-1
No files found.
.gitlab-ci.yml
View file @
937eb7a9
...
...
@@ -17,7 +17,7 @@ ci_frontend:
ci_backend
:
stage
:
ci
script
:
-
docker-compose run --rm
mcserver bash -c "source ../venv/bin/activate && coverage run --rcfile=.coveragerc tests.py && coverage combine && coverage report -m"
> ci_backend.log
-
docker-compose run --rm
--entrypoint="./coverage_backend.sh" mcserver
> ci_backend.log
artifacts
:
paths
:
-
ci_backend.log
...
...
coverage_local.sh
View file @
937eb7a9
docker-compose build
docker-compose run
--rm
--entrypoint
=
"npm run test-ci"
mc_frontend
>
ci_frontend.log
docker-compose run
--rm
mcserver bash
-c
"source ../venv/bin/activate && coverage run --rcfile=.coveragerc tests.py && coverage combine && coverage report -m"
>
ci_backend.log
docker-compose run
--rm
--entrypoint
=
"npm run test-ci"
mc_frontend
>
ci_frontend.log
docker-compose run
--rm
--entrypoint
=
"./coverage_backend.sh"
mcserver
>
ci_backend.log
./coverage_ci.sh
cat
coverage.log
mc_backend/.coveragerc
View file @
937eb7a9
...
...
@@ -17,5 +17,6 @@ exclude_lines =
# Don't complain if non-runnable code isn't run:
if __name__ == .__main__.:
except ModuleNotFoundError:
fail_under = 100
ignore_errors = True
show_missing = True
mc_backend/coverage_backend.sh
0 → 100755
View file @
937eb7a9
#!/bin/bash
source
../venv/bin/activate
coverage run
--rcfile
=
.coveragerc tests.py
coverage combine
&&
coverage report
-m
mc_backend/mcserver/app/__init__.py
View file @
937eb7a9
...
...
@@ -18,14 +18,6 @@ from flask_sqlalchemy import SQLAlchemy
from
open_alchemy
import
init_yaml
from
mcserver.config
import
Config
# remove stale connections from the connection pool after 1 hour
db
:
SQLAlchemy
=
SQLAlchemy
()
# session_options={"autocommit": True, "pool_recycle": 3600}
migrate
:
Migrate
=
Migrate
(
directory
=
Config
.
MIGRATIONS_DIRECTORY
)
if
not
hasattr
(
open_alchemy
.
models
,
Config
.
DATABASE_TABLE_CORPUS
):
# do this _BEFORE_ you add any APIs to your application
init_yaml
(
Config
.
API_SPEC_MODELS_YAML_FILE_PATH
,
base
=
db
.
Model
,
models_filename
=
os
.
path
.
join
(
Config
.
MC_SERVER_DIRECTORY
,
"models_auto.py"
))
def
apply_event_handlers
(
app
:
FlaskApp
):
"""Applies event handlers to a given Flask application, such as logging after requests or teardown logic."""
...
...
@@ -64,6 +56,11 @@ def create_app(cfg: Type[Config] = Config) -> Flask:
return
app
def
create_database
()
->
SQLAlchemy
:
"""Creates a new connection to a database, which will handle all future database transactions."""
return
SQLAlchemy
()
# session_options={"autocommit": True}
def
full_init
(
app
:
Flask
,
cfg
:
Type
[
Config
]
=
Config
)
->
None
:
""" Fully initializes the application, including logging."""
from
mcserver.app.services
import
DatabaseService
...
...
@@ -145,6 +142,13 @@ def shutdown_session(exception=None):
db
.
session
.
remove
()
db
:
SQLAlchemy
=
create_database
()
migrate
:
Migrate
=
Migrate
(
directory
=
Config
.
MIGRATIONS_DIRECTORY
)
if
not
hasattr
(
open_alchemy
.
models
,
Config
.
DATABASE_TABLE_CORPUS
):
# do this _BEFORE_ you add any APIs to your application
init_yaml
(
Config
.
API_SPEC_MODELS_YAML_FILE_PATH
,
base
=
db
.
Model
,
models_filename
=
os
.
path
.
join
(
Config
.
MC_SERVER_DIRECTORY
,
"models_auto.py"
))
# import the models so we can access them from other parts of the app using imports from "app.models";
# this has to be at the bottom of the file
from
mcserver.app
import
models
...
...
mc_backend/mcserver/config.py
View file @
937eb7a9
...
...
@@ -145,6 +145,8 @@ class Config(object):
SQLALCHEMY_DATABASE_URI
=
os
.
environ
.
get
(
"DATABASE_URL"
)
or
DATABASE_URL_SQLITE
# BEWARE: if True, logs every single database statement executed by this application to STDOUT
SQLALCHEMY_ECHO
=
False
# remove stale connections from the connection pool after 1 hour
SQLALCHEMY_POOL_RECYCLE
=
3600
SQLALCHEMY_TRACK_MODIFICATIONS
=
False
STATIC_EXERCISES_REPOSITORY_URL
=
"https://scm.cms.hu-berlin.de/callidus/machina-callida/-/archive/master/machina-callida-master.zip?path=mc_frontend%2Fsrc%2Fassets%2Fh5p"
STOP_WORDS_LATIN_PATH
=
os
.
path
.
join
(
CACHE_DIRECTORY
,
"stop_words_latin.json"
)
...
...
mc_frontend/src/app/helper.service.ts
View file @
937eb7a9
...
...
@@ -259,7 +259,7 @@ export class HelperService {
configMC
.
backendBaseUrl
=
part1
.
concat
(
configMC
.
backendBaseApiPath
).
concat
(
'
/
'
);
}
if
(
!
configMC
.
frontendBaseUrl
)
{
configMC
.
frontendBaseUrl
=
location
.
href
.
substring
(
0
,
location
.
href
.
lastIndexOf
(
'
/
'
)
+
1
);
configMC
.
frontendBaseUrl
=
location
.
href
.
substring
(
0
,
location
.
href
.
lastIndexOf
(
'
/
'
));
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment