mirror of
https://github.com/minetest/contentdb.git
synced 2024-12-22 14:02:24 +01:00
Add Gitlab CI support
This commit is contained in:
parent
d503908a65
commit
fd6ba459f9
4
.gitignore
vendored
4
.gitignore
vendored
@ -1,5 +1,5 @@
|
||||
config.cfg
|
||||
*.env
|
||||
/config.cfg
|
||||
/*.env
|
||||
*.sqlite
|
||||
.vscode
|
||||
custom.css
|
||||
|
22
.gitlab-ci.yml
Normal file
22
.gitlab-ci.yml
Normal file
@ -0,0 +1,22 @@
|
||||
image: docker/compose
|
||||
services:
|
||||
- docker:dind
|
||||
cache:
|
||||
key: "$CI_COMMIT_REF_SLUG"
|
||||
paths:
|
||||
- /var/lib/docker
|
||||
|
||||
# build:
|
||||
# stage: build
|
||||
# script:
|
||||
# - cp utils/gitlabci/* .
|
||||
# - docker-compose build
|
||||
|
||||
UI_Test:
|
||||
stage: test
|
||||
script:
|
||||
- cp utils/gitlabci/* .
|
||||
- docker-compose up -d
|
||||
- ./utils/run_migrations.sh
|
||||
- ./utils/tests.sh
|
||||
- docker-compose down
|
1
.pylintrc
Normal file
1
.pylintrc
Normal file
@ -0,0 +1 @@
|
||||
ignored-classes=SQLObject,Registrant,scoped_session
|
@ -16,6 +16,7 @@ def recreate_db():
|
||||
populate(db.session)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
def client():
|
||||
app.config["TESTING"] = True
|
||||
|
@ -23,3 +23,4 @@ redis~=3.3
|
||||
psycopg2~=2.7
|
||||
|
||||
pytest ~= 5.3
|
||||
pytest-cov ~= 2.8
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Open SSH to app instance
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Create a database migration, and copy it back to the host.
|
||||
|
||||
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate"
|
||||
docker exec -u root -it contentdb_app_1 sh -c "cp /home/cdb/migrations/versions/* /source/migrations/versions/"
|
||||
docker exec contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db migrate"
|
||||
docker exec -u root contentdb_app_1 sh -c "cp /home/cdb/migrations/versions/* /source/migrations/versions/"
|
||||
|
||||
USER=$(whoami)
|
||||
sudo chown -R $USER:$USER migrations/versions
|
||||
|
@ -1,4 +1,4 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Open SQL console for the database
|
||||
|
||||
|
31
utils/gitlabci/config.cfg
Normal file
31
utils/gitlabci/config.cfg
Normal file
@ -0,0 +1,31 @@
|
||||
USER_APP_NAME="Content DB"
|
||||
SERVER_NAME="localhost:5123"
|
||||
BASE_URL="http://" + SERVER_NAME
|
||||
|
||||
SECRET_KEY="changeme"
|
||||
WTF_CSRF_SECRET_KEY="changeme"
|
||||
|
||||
SQLALCHEMY_DATABASE_URI = "postgres://contentdb:password@db:5432/contentdb"
|
||||
|
||||
GITHUB_CLIENT_ID = ""
|
||||
GITHUB_CLIENT_SECRET = ""
|
||||
|
||||
REDIS_URL='redis://redis:6379'
|
||||
CELERY_BROKER_URL='redis://redis:6379'
|
||||
CELERY_RESULT_BACKEND='redis://redis:6379'
|
||||
|
||||
USER_ENABLE_USERNAME = True
|
||||
USER_ENABLE_REGISTER = False
|
||||
USER_ENABLE_CHANGE_USERNAME = False
|
||||
USER_ENABLE_EMAIL = False
|
||||
|
||||
MAIL_UTILS_ERROR_SEND_TO = [""]
|
||||
|
||||
UPLOAD_DIR="/var/cdb/uploads/"
|
||||
THUMBNAIL_DIR="/var/cdb/thumbnails/"
|
||||
|
||||
TEMPLATES_AUTO_RELOAD = True
|
||||
|
||||
LANGUAGES = {
|
||||
'en': 'English',
|
||||
}
|
4
utils/gitlabci/config.env
Normal file
4
utils/gitlabci/config.env
Normal file
@ -0,0 +1,4 @@
|
||||
POSTGRES_USER=contentdb
|
||||
POSTGRES_PASSWORD=password
|
||||
POSTGRES_DB=contentdb
|
||||
FLASK_DEBUG=1
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Hot/live reload - only works in debug mode
|
||||
|
||||
docker exec -it contentdb_app_1 sh -c "cp -r /source/* ."
|
||||
docker exec contentdb_app_1 sh -c "cp -r /source/* ."
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
# Run all pending migrations
|
||||
|
||||
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db upgrade"
|
||||
docker exec contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py flask db upgrade"
|
||||
|
@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
#!/bin/sh
|
||||
|
||||
docker exec -it contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py python -m pytest app/tests/ --disable-warnings"
|
||||
docker exec contentdb_app_1 sh -c "FLASK_CONFIG=../config.cfg FLASK_APP=app/__init__.py python -m pytest app/tests/ --cov=app --disable-warnings"
|
||||
|
Loading…
Reference in New Issue
Block a user