From bab6234e81809ee4b959fb736700194a3f123ba7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=A3=20Bida=20Vacaro?= Date: Mon, 15 Apr 2024 23:50:51 -0300 Subject: [PATCH] clean & update a the worflows --- .github/workflows/python-package.yml | 27 ++-------- .github/workflows/release.yaml | 5 +- Makefile | 74 ---------------------------- 3 files changed, 5 insertions(+), 101 deletions(-) diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml index f1cbaf3..e981445 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-package.yml @@ -20,14 +20,9 @@ jobs: cancel-in-progress: true steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - - name: Prepare conda environment - run: | - sed -i s/python\ 3\.11/python\ ${{ matrix.python_version }}/ conda/dev.yaml - cat conda/dev.yaml - - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: miniconda-version: "latest" mamba-version: "*" @@ -37,27 +32,11 @@ jobs: use-mamba: true miniforge-variant: Mambaforge - - - name: Install dependencies - run: | - curl -sSL https://install.python-poetry.org/ | python - - export PATH="$HOME/.poetry/bin:$PATH" - poetry config virtualenvs.create false - - - name: Install main dependencies - run: | - make conda-install-main ENVCREATE=conda-env - - - name: Lint with flake8 - run: | - make conda-install-dev - make check-codestyle - - name: Run jupyterlab with PySUS run: | make run-jupyter-pysus - name: Test with pytest run: | - make conda-install-geo + poetry install make test-pysus diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index faf9487..373a6ed 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -16,9 +16,9 @@ jobs: shell: bash -l {0} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - - uses: conda-incubator/setup-miniconda@v2 + - uses: conda-incubator/setup-miniconda@v3 with: miniconda-version: "latest" mamba-version: "*" @@ -46,4 +46,3 @@ jobs: run: | poetry config pypi-token.pypi ${PYPI_TOKEN} make release - diff --git a/Makefile b/Makefile index 2239954..19f07fc 100644 --- a/Makefile +++ b/Makefile @@ -36,42 +36,6 @@ SEMANTIC_RELEASE = npx --yes \ -p "semantic-release-replace-plugin" \ semantic-release - -# Create a Conda environment and install dependencies for development. -.PHONY: conda-env -conda-env: - mamba env create -f conda/dev.yaml --force - -# Install main project dependencies using Poetry. -.PHONY: conda-install-main -conda-install-main: ${ENVCREATE} - conda run -n pysus poetry install --only main - -.PHONY: conda-install-dev -conda-install-dev: - conda run -n pysus poetry install --only dev - -.PHONY: conda-install-docs -conda-install-docs: - conda run -n pysus poetry install --only docs - -.PHONY: conda-install-geo -conda-install-geo: - conda run -n pysus pip install --no-use-pep517 shapely==1.8.5.post1 - conda run -n pysus poetry install --only geo - -# Linting -.PHONY: pre-commit-install -pre-commit-install: - poetry run pre-commit install - -.PHONY: check-codestyle -check-codestyle: ## check style with flake8 - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - #* Docker basic .PHONY: run-jupyter-pysus run-jupyter-pysus: ## build and deploy all containers @@ -91,44 +55,6 @@ test-pysus: ## run tests quickly with the default Python cp docs/source/**/*.ipynb pysus/Notebooks poetry run pytest -vv pysus/tests/ -coverage: ## check code coverage quickly with the default Python - coverage run --source pysus/tests/ -m pytest - coverage report -m - coverage html - $(BROWSER) htmlcov/index.html - -# Cleaning -.PHONY: clean -clean: clean-build clean-pyc clean-test ## remove all build, test, coverage and Python artifacts - -.PHONY: clean-build -clean-build: ## remove build artifacts - rm -fr build/ - rm -fr dist/ - rm -fr .eggs/ - find . -name '*.cache' -exec rm -fr {} + - find . -name '*.jupyter' -exec rm -fr {} + - find . -name '*.local' -exec rm -fr {} + - find . -name '*.mozilla' -exec rm -fr {} + - find . -name '*.egg-info' -exec rm -fr {} + - find . -name '*.egg' -exec rm -f {} + - find . -name '*.ipynb_checkpoints' -exec rm -rf {} + - -.PHONY: clean-pyc -clean-pyc: ## remove Python file artifacts - find . -name '*.pyc' -exec rm -f {} + - find . -name '*.pyo' -exec rm -f {} + - find . -name '*~' -exec rm -f {} + - find . -name '__pycache__' -exec rm -fr {} + - -.PHONY: clean-test -clean-test: ## remove test and coverage artifacts - rm -fr .tox/ - rm -f .coverage - rm -fr htmlcov/ - rm -fr .pytest_cache - - # RELEASE # =======