Remove checks for the moment
This commit is contained in:
parent
9fcb2a1a39
commit
ad799de420
|
@ -13,6 +13,9 @@ jobs:
|
|||
- uses: actions/checkout@v3
|
||||
- uses: cachix/install-nix-action@v22
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- name: Test
|
||||
run: |
|
||||
nix flake check -L -j auto
|
||||
- name: Setup dependencies
|
||||
run: nix develop --command bash -c "pdm sync"
|
||||
- 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."
|
||||
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() {
|
||||
nix flake check
|
||||
linting
|
||||
test
|
||||
}
|
||||
descriptions["check"]="Run the linter and tests."
|
||||
tasks["check"]=check
|
||||
|
||||
test() {
|
||||
export DJANGO_SETTINGS_MODULE=network_inventory.settings.ram_test
|
||||
pytest -nauto --nomigrations --cov-config="$PROJECT_DIR/.coveragerc" --cov-report=html "$PROJECT_DIR/src"
|
||||
DJANGO_SETTINGS_MODULE=network_inventory.settings.ram_test \
|
||||
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."
|
||||
tasks["test"]=test
|
||||
|
|
82
flake.nix
82
flake.nix
|
@ -44,42 +44,6 @@
|
|||
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 = {
|
||||
container = pkgs.dockerTools.buildImage {
|
||||
name = "network-inventory";
|
||||
|
@ -96,32 +60,32 @@
|
|||
(pkgs.writeShellScriptBin "start-inventory" ''
|
||||
if [ -f .first_run ]; then
|
||||
sleep 2
|
||||
${pkgs.inventoryEnv}/bin/django-admin collectstatic --noinput
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations
|
||||
${pkgs.inventoryEnv}/bin/django-admin migrate
|
||||
django-admin collectstatic --noinput
|
||||
django-admin makemigrations
|
||||
django-admin migrate
|
||||
else
|
||||
${pkgs.inventoryEnv}/bin/django-admin collectstatic --noinput
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations backups
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations computers
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations core
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations customers
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations devices
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations licenses
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations nets
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations softwares
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations users
|
||||
${pkgs.inventoryEnv}/bin/django-admin makemigrations
|
||||
${pkgs.inventoryEnv}/bin/django-admin migrate
|
||||
${pkgs.inventoryEnv}/bin/django-admin loaddata backups
|
||||
${pkgs.inventoryEnv}/bin/django-admin loaddata computers
|
||||
${pkgs.inventoryEnv}/bin/django-admin loaddata core
|
||||
${pkgs.inventoryEnv}/bin/django-admin loaddata devices
|
||||
${pkgs.inventoryEnv}/bin/django-admin loaddata nets
|
||||
${pkgs.inventoryEnv}/bin/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 collectstatic --noinput
|
||||
django-admin makemigrations backups
|
||||
django-admin makemigrations computers
|
||||
django-admin makemigrations core
|
||||
django-admin makemigrations customers
|
||||
django-admin makemigrations devices
|
||||
django-admin makemigrations licenses
|
||||
django-admin makemigrations nets
|
||||
django-admin makemigrations softwares
|
||||
django-admin makemigrations users
|
||||
django-admin makemigrations
|
||||
django-admin migrate
|
||||
django-admin loaddata backups
|
||||
django-admin loaddata computers
|
||||
django-admin loaddata core
|
||||
django-admin loaddata devices
|
||||
django-admin loaddata nets
|
||||
django-admin loaddata softwares
|
||||
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
|
||||
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