manga-dlp/justfile

150 lines
3.6 KiB
Makefile
Raw Normal View History

2022-06-25 14:29:09 +02:00
#!/usr/bin/env just --justfile
default: show_receipts
set shell := ["bash", "-uc"]
set dotenv-load := true
#set export
# aliases
alias s := show_receipts
2022-06-26 15:10:36 +02:00
alias i := show_system_info
2022-06-25 14:29:09 +02:00
alias p := prepare_workspace
2022-06-26 19:00:47 +02:00
alias l := lint
2022-06-26 15:10:36 +02:00
alias t := tests
alias f := tests_full
2022-06-25 14:29:09 +02:00
# variables
export asdf_version := "v0.10.2"
# default recipe to display help information
show_receipts:
@just --list
show_system_info:
2022-06-26 15:10:36 +02:00
@echo "=================================="
2022-06-25 14:29:09 +02:00
@echo "os : {{os()}}"
@echo "arch: {{arch()}}"
@echo "home: ${HOME}"
2022-06-26 15:10:36 +02:00
@echo "project dir: {{justfile_directory()}}"
@echo "=================================="
2022-06-25 14:29:09 +02:00
check_asdf:
@if ! asdf --version; then \
just install_asdf \
;else \
echo "asdf already installed" \
;fi
just install_asdf_bins
install_asdf:
@echo "installing asdf"
@echo "asdf version: ${asdf_version}"
@git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch "${asdf_version}"
@echo "adding asdf to .bashrc"
@if ! grep -q ".asdf/asdf.sh" "${HOME}/.bashrc"; then \
echo -e '\n# source asdf' >> "${HOME}/.bashrc" \
;echo 'source "${HOME}/.asdf/asdf.sh"' >> "${HOME}/.bashrc" \
;echo -e 'source "${HOME}/.asdf/completions/asdf.bash"\n' >> "${HOME}/.bashrc" \
;fi
@echo "to load asdf either restart your shell or do: 'source \${HOME}/.bashrc'"
setup_asdf:
@echo "installing asdf bins"
# add plugins
@if ! asdf plugin add python; then :; fi
@if ! asdf plugin add shfmt; then :; fi
@if ! asdf plugin add shellcheck; then :; fi
@if ! asdf plugin add just https://github.com/franklad/asdf-just; then :; fi
@if ! asdf plugin add direnv; then :; fi
# install bins
@if ! asdf install; then :; fi
# setup direnv
@if ! asdf direnv setup --shell bash --version latest; then :; fi
create_venv:
@echo "creating venv"
@python3 -m pip install --upgrade pip setuptools wheel
@python3 -m venv venv
2022-08-15 14:44:31 +02:00
install_deps:
@echo "installing dependencies"
@pip3 install -r requirements.txt
install_deps_dev:
2022-08-15 14:44:31 +02:00
@echo "installing dependencies"
@pip3 install -r contrib/requirements_dev.txt
create_reqs:
@echo "creating requirements"
@pipreqs --savepath requirements.txt --mode gt --force mangadlp/
2022-06-26 15:10:36 +02:00
test_shfmt:
@find . -type f \( -name "**.sh" -and -not -path "./.**" -and -not -path "./venv**" \) -exec shfmt -d -i 4 -bn -ci -sr "{}" \+;
2022-06-26 15:10:36 +02:00
test_black:
@python3 -m black --check --diff mangadlp/
2022-06-26 15:10:36 +02:00
test_pyright:
@python3 -m pyright mangadlp/
2022-06-26 15:10:36 +02:00
test_ruff:
@python3 -m ruff --diff mangadlp/
2022-06-26 15:10:36 +02:00
test_ci_conf:
@woodpecker-cli lint .woodpecker/
2022-07-15 14:04:22 +02:00
test_pytest:
@python3 -m tox -e basic
2022-07-21 20:39:56 +02:00
test_coverage:
@python3 -m tox -e coverage
2022-07-21 20:55:35 +02:00
2022-06-26 15:10:36 +02:00
test_tox:
@python3 -m tox
2022-06-26 15:23:32 +02:00
test_build:
@python3 -m hatch build --clean
2022-06-26 15:23:32 +02:00
test_docker_build:
@docker build . -f docker/Dockerfile.amd64 -t manga-dlp:test
2022-06-25 14:29:09 +02:00
# install dependecies and set everything up
prepare_workspace:
just show_system_info
just check_asdf
just setup_asdf
just create_venv
2022-06-25 14:29:09 +02:00
2022-06-26 19:00:47 +02:00
lint:
just show_system_info
-just test_ci_conf
just test_shfmt
just test_black
just test_pyright
just test_ruff
2022-06-26 19:00:47 +02:00
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
2022-06-26 15:10:36 +02:00
tests:
just show_system_info
2022-06-26 15:23:32 +02:00
-just test_ci_conf
2022-06-26 15:10:36 +02:00
just test_shfmt
just test_black
just test_pyright
just test_ruff
2022-06-26 15:10:36 +02:00
just test_pytest
2022-06-26 15:54:02 +02:00
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"
2022-06-26 15:10:36 +02:00
2022-06-26 15:23:32 +02:00
tests_full:
2022-06-26 15:10:36 +02:00
just show_system_info
2022-06-26 15:23:32 +02:00
-just test_ci_conf
2022-06-26 15:10:36 +02:00
just test_shfmt
just test_black
just test_pyright
just test_ruff
2022-06-26 15:23:32 +02:00
just test_build
2022-06-26 15:10:36 +02:00
just test_tox
just test_coverage
2022-06-26 15:23:32 +02:00
just test_docker_build
2022-06-26 15:54:02 +02:00
@echo -e "\n\033[0;32m=== ALL DONE ===\033[0m\n"