Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
Jay authored and Jay committed Nov 11, 2024
1 parent 6399d72 commit 15a1a7f
Showing 1 changed file with 22 additions and 31 deletions.
53 changes: 22 additions & 31 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,46 +1,37 @@
# Install required Python packages
install:
pip install --upgrade pip &&\
pip install -r requirements.txt
pip install --upgrade pip &&\
pip install -r requirements.txt

# Run tests with pytest, show verbose output, and check code coverage
test:
python -m pytest -vv --cov=mylib test_*.py
python -m pytest -vv --cov=mylib test_*.py

# Format code with Black
format:
black *.py
format:
black *.py

# Lint code using ruff (uncomment pylint for alternative linting)
lint:
# Uncomment below to test with pylint
# pylint --disable=R,C --ignore-patterns=test_.*?py *.py mylib/*.py
# ruff linting is 10-100X faster than pylint
ruff check *.py mylib/*.py
# Uncomment below to test with pylint
# pylint --disable=R,C --ignore-patterns=test_.*?py *.py mylib/*.py
# ruff linting is 10-100X faster than pylint
ruff check *.py mylib/*.py

# Lint Dockerfile using hadolint
container-lint:
docker run --rm -i hadolint/hadolint < Dockerfile
docker run --rm -i hadolint/hadolint < Dockerfile

# Refactor code by running format and lint sequentially
refactor: format lint

# Placeholder for deploy commands
deploy:
# Deploy commands go here

# Run install, lint, test, format, and deploy in sequence
# Deploy commands go here

all: install lint test format deploy

# Add, commit, and push generated files to GitHub (useful in CI/CD)
generate_and_push:
# Add, commit, and push the generated files to GitHub
@if [ -n "$$(git status --porcelain)" ]; then \
git config --local user.email "action@github.com"; \
git config --local user.name "GitHub Action"; \
git add .; \
git commit -m "Add output log"; \
git push; \
else \
echo "No changes to commit. Skipping commit and push."; \
fi
# Add, commit, and push the generated files to GitHub
@if [ -n "$$(git status --porcelain)" ]; then \
git config --local user.email "action@github.com"; \
git config --local user.name "GitHub Action"; \
git add .; \
git commit -m "Add output log"; \
git push; \
else \
echo "No changes to commit. Skipping commit and push."; \
fi

0 comments on commit 15a1a7f

Please sign in to comment.