Remove checks for the moment
This commit is contained in:
parent
9fcb2a1a39
commit
ad799de420
|
@ -13,6 +13,9 @@ jobs:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
- uses: cachix/install-nix-action@v22
|
- uses: cachix/install-nix-action@v22
|
||||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||||
- name: Test
|
- name: Setup dependencies
|
||||||
run: |
|
run: nix develop --command bash -c "pdm sync"
|
||||||
nix flake check -L -j auto
|
- name: Linting
|
||||||
|
run: nix develop --command bash -c "pdm run dev linting"
|
||||||
|
- name: Tests
|
||||||
|
run: nix develop --command bash -c "pdm run pytest --ds=network_inventory.settings.ram_test -nauto --nomigrations --cov=./src ./src"
|
||||||
|
|
17
dev.sh
17
dev.sh
|
@ -116,15 +116,26 @@ debug() {
|
||||||
descriptions["debug"]="Run the tests and drop into the debugger on failure."
|
descriptions["debug"]="Run the tests and drop into the debugger on failure."
|
||||||
tasks["debug"]=debug
|
tasks["debug"]=debug
|
||||||
|
|
||||||
|
linting() {
|
||||||
|
pylint --rc-file pyproject.toml -j 0 -E ./src/
|
||||||
|
mypy ./src/
|
||||||
|
}
|
||||||
|
descriptions["linting"]="Run the linters agains the source code. Tests are excluded."
|
||||||
|
tasks["linting"]=linting
|
||||||
|
|
||||||
check() {
|
check() {
|
||||||
nix flake check
|
linting
|
||||||
|
test
|
||||||
}
|
}
|
||||||
descriptions["check"]="Run the linter and tests."
|
descriptions["check"]="Run the linter and tests."
|
||||||
tasks["check"]=check
|
tasks["check"]=check
|
||||||
|
|
||||||
test() {
|
test() {
|
||||||
export DJANGO_SETTINGS_MODULE=network_inventory.settings.ram_test
|
DJANGO_SETTINGS_MODULE=network_inventory.settings.ram_test \
|
||||||
pytest -nauto --nomigrations --cov-config="$PROJECT_DIR/.coveragerc" --cov-report=html "$PROJECT_DIR/src"
|
pytest -nauto \
|
||||||
|
--nomigrations \
|
||||||
|
--cov-config="$PROJECT_DIR/.coveragerc" \
|
||||||
|
--cov-report=html "$PROJECT_DIR/src"
|
||||||
}
|
}
|
||||||
descriptions["test"]="Run the tests in the RAM DB and write a coverage report."
|
descriptions["test"]="Run the tests in the RAM DB and write a coverage report."
|
||||||
tasks["test"]=test
|
tasks["test"]=test
|
||||||
|
|
82
flake.nix
82
flake.nix
|
@ -44,42 +44,6 @@
|
||||||
export DJANGO_SETTINGS_MODULE=network_inventory.settings.local
|
export DJANGO_SETTINGS_MODULE=network_inventory.settings.local
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
checks = {
|
|
||||||
lint = pkgs.stdenv.mkDerivation {
|
|
||||||
dontPatch = true;
|
|
||||||
dontConfigure = true;
|
|
||||||
dontBuild = true;
|
|
||||||
dontInstall = true;
|
|
||||||
doCheck = true;
|
|
||||||
name = "lint";
|
|
||||||
src = ./.;
|
|
||||||
checkInputs = [ pkgs.pdm ];
|
|
||||||
checkPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
pylint --rc-file pyproject.toml -j 0 -E src/
|
|
||||||
cd src/ && mypy --config-file=../pyproject.toml .
|
|
||||||
'';
|
|
||||||
DJANGO_SETTINGS_MODULE = "network_inventory.settings.ram_test";
|
|
||||||
};
|
|
||||||
tests = pkgs.stdenv.mkDerivation {
|
|
||||||
dontPatch = true;
|
|
||||||
dontConfigure = true;
|
|
||||||
dontBuild = true;
|
|
||||||
dontInstall = true;
|
|
||||||
doCheck = true;
|
|
||||||
name = "test";
|
|
||||||
src = ./.;
|
|
||||||
checkInputs = [ pkgs.pdm pkgs.postgresql_15 pkgs.overmind ];
|
|
||||||
checkPhase = ''
|
|
||||||
mkdir -p $out
|
|
||||||
pytest --ds=network_inventory.settings.ram_test \
|
|
||||||
-nauto \
|
|
||||||
--nomigrations \
|
|
||||||
--cov=./src \
|
|
||||||
./src
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
};
|
|
||||||
packages = {
|
packages = {
|
||||||
container = pkgs.dockerTools.buildImage {
|
container = pkgs.dockerTools.buildImage {
|
||||||
name = "network-inventory";
|
name = "network-inventory";
|
||||||
|
@ -96,32 +60,32 @@
|
||||||
(pkgs.writeShellScriptBin "start-inventory" ''
|
(pkgs.writeShellScriptBin "start-inventory" ''
|
||||||
if [ -f .first_run ]; then
|
if [ -f .first_run ]; then
|
||||||
sleep 2
|
sleep 2
|
||||||
${pkgs.inventoryEnv}/bin/django-admin collectstatic --noinput
|
django-admin collectstatic --noinput
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations
|
django-admin makemigrations
|
||||||
${pkgs.inventoryEnv}/bin/django-admin migrate
|
django-admin migrate
|
||||||
else
|
else
|
||||||
${pkgs.inventoryEnv}/bin/django-admin collectstatic --noinput
|
django-admin collectstatic --noinput
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations backups
|
django-admin makemigrations backups
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations computers
|
django-admin makemigrations computers
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations core
|
django-admin makemigrations core
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations customers
|
django-admin makemigrations customers
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations devices
|
django-admin makemigrations devices
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations licenses
|
django-admin makemigrations licenses
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations nets
|
django-admin makemigrations nets
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations softwares
|
django-admin makemigrations softwares
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations users
|
django-admin makemigrations users
|
||||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations
|
django-admin makemigrations
|
||||||
${pkgs.inventoryEnv}/bin/django-admin migrate
|
django-admin migrate
|
||||||
${pkgs.inventoryEnv}/bin/django-admin loaddata backups
|
django-admin loaddata backups
|
||||||
${pkgs.inventoryEnv}/bin/django-admin loaddata computers
|
django-admin loaddata computers
|
||||||
${pkgs.inventoryEnv}/bin/django-admin loaddata core
|
django-admin loaddata core
|
||||||
${pkgs.inventoryEnv}/bin/django-admin loaddata devices
|
django-admin loaddata devices
|
||||||
${pkgs.inventoryEnv}/bin/django-admin loaddata nets
|
django-admin loaddata nets
|
||||||
${pkgs.inventoryEnv}/bin/django-admin loaddata softwares
|
django-admin loaddata softwares
|
||||||
${pkgs.inventoryEnv}/bin/django-admin shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')"
|
django-admin shell -c "from django.contrib.auth import get_user_model; User = get_user_model(); User.objects.create_superuser('admin', 'admin@example.com', 'password')"
|
||||||
touch .first_run
|
touch .first_run
|
||||||
fi
|
fi
|
||||||
${pkgs.inventoryEnv}/bin/gunicorn network_inventory.wsgi:application --reload --bind 0.0.0.0:8000 --workers 3
|
gunicorn network_inventory.wsgi:application --reload --bind 0.0.0.0:8000 --workers 3
|
||||||
'')
|
'')
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue