mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use env variables rather than custom ci scripts
This commit is contained in:
parent
608f47837f
commit
c846e2e65a
5
.github/workflows/coverage.yaml
vendored
5
.github/workflows/coverage.yaml
vendored
@ -1,6 +1,6 @@
|
||||
# Perform CI checks, and calculate code coverage
|
||||
|
||||
name: Code Coverage
|
||||
name: SQLite
|
||||
|
||||
on: ["push", "pull_request"]
|
||||
|
||||
@ -10,10 +10,11 @@ jobs:
|
||||
# These tests are used for code coverage analysis
|
||||
coverage:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
INVENTREE_DB_NAME: './test_db.sqlite'
|
||||
INVENTREE_DB_ENGINE: sqlite3
|
||||
INVENTREE_DB_ENGINE: django.db.backends.sqlite3
|
||||
|
||||
steps:
|
||||
- name: Checkout Code
|
||||
|
9
.github/workflows/mariadb.yaml
vendored
9
.github/workflows/mariadb.yaml
vendored
@ -7,6 +7,15 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
# Database backend configuration
|
||||
INVENTREE_DB_ENGINE: django.db.backends.mysql
|
||||
INVENTREE_DB_USER: root
|
||||
INVENTREE_DB_PASSWORD: password
|
||||
INVENTREE_DB_HOST: '127.0.0.1'
|
||||
INVENTREE_DB_PORT: 3306
|
||||
|
||||
|
||||
services:
|
||||
mariadb:
|
||||
image: mariadb:latest
|
||||
|
8
.github/workflows/mysql.yaml
vendored
8
.github/workflows/mysql.yaml
vendored
@ -9,6 +9,14 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
# Database backend configuration
|
||||
INVENTREE_DB_ENGINE: django.db.backends.mysql
|
||||
INVENTREE_DB_USER: root
|
||||
INVENTREE_DB_PASSWORD: password
|
||||
INVENTREE_DB_HOST: '127.0.0.1'
|
||||
INVENTREE_DB_PORT: 3306
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: mysql:latest
|
||||
|
9
.github/workflows/postgresql.yaml
vendored
9
.github/workflows/postgresql.yaml
vendored
@ -9,6 +9,15 @@ jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
# Database backend configuration
|
||||
INVENTREE_DB_ENGINE: django.db.backends.postgresql
|
||||
INVENTREE_DB_USER: inventree
|
||||
INVENTREE_DB_PASSWORD: password
|
||||
INVENTREE_DB_HOST: '127.0.0.1'
|
||||
INVENTREE_DB_PORT: 5432
|
||||
|
||||
|
||||
services:
|
||||
postgres:
|
||||
image: postgres
|
||||
|
@ -1,19 +0,0 @@
|
||||
"""
|
||||
Configuration file for running tests against a MySQL database.
|
||||
"""
|
||||
|
||||
from InvenTree.settings import *
|
||||
|
||||
# Override the 'test' database
|
||||
if 'test' in sys.argv:
|
||||
print('InvenTree: Running tests - Using MySQL test database')
|
||||
|
||||
DATABASES['default'] = {
|
||||
# Ensure mysql backend is being used
|
||||
'ENGINE': 'django.db.backends.mysql',
|
||||
'NAME': 'inventree',
|
||||
'USER': 'root',
|
||||
'PASSWORD': 'password',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '3306',
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
"""
|
||||
Configuration file for running tests against a MySQL database.
|
||||
"""
|
||||
|
||||
from InvenTree.settings import *
|
||||
|
||||
# Override the 'test' database
|
||||
if 'test' in sys.argv:
|
||||
print('InvenTree: Running tests - Using PostGreSQL test database')
|
||||
|
||||
DATABASES['default'] = {
|
||||
# Ensure postgresql backend is being used
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'NAME': 'inventree_test_db',
|
||||
'USER': 'inventree',
|
||||
'PASSWORD': 'password',
|
||||
'HOST': '127.0.0.1',
|
||||
'PORT': '5432'
|
||||
}
|
@ -318,21 +318,6 @@ MARKDOWNIFY_BLEACH = False
|
||||
|
||||
DATABASES = {}
|
||||
|
||||
"""
|
||||
When running unit tests, enforce usage of sqlite3 database,
|
||||
so that the tests can be run in RAM without any setup requirements
|
||||
"""
|
||||
if 'test' in sys.argv:
|
||||
logger.info('InvenTree: Running tests - Using sqlite3 memory database')
|
||||
DATABASES['default'] = {
|
||||
# Ensure sqlite3 backend is being used
|
||||
'ENGINE': 'django.db.backends.sqlite3',
|
||||
# Doesn't matter what the database is called, it is executed in RAM
|
||||
'NAME': 'ram_test_db.sqlite3',
|
||||
}
|
||||
|
||||
# Database backend selection
|
||||
else:
|
||||
"""
|
||||
Configure the database backend based on the user-specified values.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user