Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: improve makefile #1091

Merged
merged 3 commits into from
Aug 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 24 additions & 15 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,37 @@
# specific language governing permissions and limitations
# under the License.

install-poetry:
pip install poetry==1.8.3

install-dependencies:
poetry install -E pyarrow -E hive -E s3fs -E glue -E adlfs -E duckdb -E ray -E sql-postgres -E gcsfs -E sql-sqlite -E daft
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m\033[0m\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-20s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST)

install-poetry: ## Install poetry if the user has not done that yet.
@if ! command -v poetry &> /dev/null; then \
echo "Poetry could not be found. Installing..."; \
pip install --user poetry==1.8.3; \
else \
echo "Poetry is already installed."; \
fi

install-dependencies: ## Install dependencies including dev and all extras
poetry install --all-extras

install: | install-poetry install-dependencies

check-license:
check-license: ## Check license headers
./dev/check-license

lint:
lint: ## lint
poetry run pre-commit run --all-files

test:
test: ## Run all unit tests, can add arguments with PYTEST_ARGS="-vv"
poetry run pytest tests/ -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}

test-s3:
test-s3: # Run tests marked with s3, can add arguments with PYTEST_ARGS="-vv"
sh ./dev/run-minio.sh
poetry run pytest tests/ -m s3 ${PYTEST_ARGS}

test-integration:
test-integration: ## Run all integration tests, can add arguments with PYTEST_ARGS="-vv"
docker compose -f dev/docker-compose-integration.yml kill
docker compose -f dev/docker-compose-integration.yml rm -f
docker compose -f dev/docker-compose-integration.yml up -d
Expand All @@ -50,18 +59,18 @@ test-integration-rebuild:
docker compose -f dev/docker-compose-integration.yml rm -f
docker compose -f dev/docker-compose-integration.yml build --no-cache

test-adlfs:
test-adlfs: ## Run tests marked with adlfs, can add arguments with PYTEST_ARGS="-vv"
sh ./dev/run-azurite.sh
poetry run pytest tests/ -m adlfs ${PYTEST_ARGS}

test-gcs:
test-gcs: ## Run tests marked with gcs, can add arguments with PYTEST_ARGS="-vv"
sh ./dev/run-gcs-server.sh
poetry run pytest tests/ -m gcs ${PYTEST_ARGS}

test-coverage-unit:
test-coverage-unit: # Run test with coverage for unit tests, can add arguments with PYTEST_ARGS="-vv"
poetry run coverage run --source=pyiceberg/ --data-file=.coverage.unit -m pytest tests/ -v -m "(unmarked or parametrize) and not integration" ${PYTEST_ARGS}

test-coverage-integration:
test-coverage-integration: # Run test with coverage for integration tests, can add arguments with PYTEST_ARGS="-vv"
docker compose -f dev/docker-compose-integration.yml kill
docker compose -f dev/docker-compose-integration.yml rm -f
docker compose -f dev/docker-compose-integration.yml up -d
Expand All @@ -72,14 +81,14 @@ test-coverage-integration:
docker compose -f dev/docker-compose-integration.yml exec -T spark-iceberg ipython ./provision.py
poetry run coverage run --source=pyiceberg/ --data-file=.coverage.integration -m pytest tests/ -v -m integration ${PYTEST_ARGS}

test-coverage: | test-coverage-unit test-coverage-integration
test-coverage: | test-coverage-unit test-coverage-integration ## Run all tests with coverage including unit and integration tests
poetry run coverage combine .coverage.unit .coverage.integration
poetry run coverage report -m --fail-under=90
poetry run coverage html
poetry run coverage xml


clean:
clean: ## Clean up the project Python working environment
@echo "Cleaning up Cython and Python cached files"
@rm -rf build dist *.egg-info
@find . -name "*.so" -exec echo Deleting {} \; -delete
Expand Down