Skip to content

Commit

Permalink
clean & update a the worflows
Browse files Browse the repository at this point in the history
  • Loading branch information
luabida committed Apr 16, 2024
1 parent 2b1c9f0 commit c698bc0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 101 deletions.
26 changes: 2 additions & 24 deletions .github/workflows/python-package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "*"
Expand All @@ -37,27 +32,10 @@ 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
make test-pysus
5 changes: 2 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: "*"
Expand Down Expand Up @@ -46,4 +46,3 @@ jobs:
run: |
poetry config pypi-token.pypi ${PYPI_TOKEN}
make release
74 changes: 0 additions & 74 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
# =======

Expand Down

0 comments on commit c698bc0

Please sign in to comment.