diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 576aef7a..06ea9f97 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -25,7 +25,7 @@ jobs: miniforge-version: latest environment-file: conda/dev.yaml channels: conda-forge,nodefaults - activate-environment: pypkg + activate-environment: scicookie auto-update-conda: true conda-solver: libmamba @@ -33,7 +33,9 @@ jobs: run: poetry check - name: Install dependencies - run: poetry install + run: | + poetry config virtualenvs.create false + poetry install - name: Run tests run: makim tests.unittest @@ -81,7 +83,7 @@ jobs: miniforge-version: latest environment-file: conda/dev.yaml channels: conda-forge,nodefaults - activate-environment: pypkg + activate-environment: scicookie auto-update-conda: true conda-solver: libmamba diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eb168ba3..74458759 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -25,7 +25,7 @@ jobs: miniforge-version: latest environment-file: conda/dev.yaml channels: conda-forge,nodefaults - activate-environment: pypkg + activate-environment: scicookie auto-update-conda: true conda-solver: libmamba diff --git a/conda/dev.yaml b/conda/dev.yaml index 5f9143e6..34c81e3a 100644 --- a/conda/dev.yaml +++ b/conda/dev.yaml @@ -3,6 +3,7 @@ channels: - nodefaults - conda-forge dependencies: + - bash - git - python >=3.8.1,<3.12 - poetry >=1.5 diff --git a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py index df3aeade..f99e571e 100644 --- a/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py +++ b/src/scicookie/{{cookiecutter.project_slug}}/{{cookiecutter.package_slug}}/__init__.py @@ -13,7 +13,7 @@ from importlib import metadata as importlib_metadata -def get_version(): +def get_version() -> str: """Return the program version.""" try: return importlib_metadata.version(__name__) diff --git a/tests/smoke/auto-format-tools.sh b/tests/smoke/auto-format-tools.sh index 39430ecf..4f54034a 100755 --- a/tests/smoke/auto-format-tools.sh +++ b/tests/smoke/auto-format-tools.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/smoke/automation.sh b/tests/smoke/automation.sh index a55ddfef..e7af8623 100755 --- a/tests/smoke/automation.sh +++ b/tests/smoke/automation.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/smoke/base.sh b/tests/smoke/base.sh index 85e5cdf1..049b8bfd 100755 --- a/tests/smoke/base.sh +++ b/tests/smoke/base.sh @@ -4,17 +4,13 @@ set -ex PATH_ORI=${PATH} PWD_ORI=$(pwd) -CONDA_PATH=$(cd "$(dirname ${CONDA_PYTHON_EXE})" && cd .. && pwd) -PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" && cd ../src/scicookie && pwd )" >/dev/null 2>&1 && cd ../.. && pwd )" +PROJECT_PATH="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && cd ../.. && pwd )" -if [ "${CONDA_PATH}" == ""]; then - echo "INVALID 'CONDA_PATH' environment variable." +if [ "$(which conda)" == "" ]; then + echo "EE 'conda' not found." exit 1 fi -export PATH="${CONDA_PATH}/condabin:${CONDA_PATH}/bin:$PATH" -echo "[II] included conda to the PATH" - ENV_NAME=osl-python-package OUTPUT_DIR="/tmp/osl" @@ -28,18 +24,14 @@ cookieninja --no-input \ cd "${OUTPUT_DIR}/${ENV_NAME}" -mamba env create --file conda/dev.yaml --force - -CONDA_PREFIX="${CONDA_PATH}/envs/${ENV_NAME}" +set +x +eval "$(conda shell.bash hook)" +mamba env create --file conda/dev.yaml --name "${ENV_NAME}" --force +conda activate "${ENV_NAME}" +set -x -export PATH=$(echo $PATH| sed -E "s/[^:]+\/mambaforge\/[^:]+//g") -export PATH=$(echo $PATH| sed -E "s/[^:]+\/conda\/[^:]+//g") -export PATH=$(echo $PATH| sed -E "s/[^:]+\/miniconda\/[^:]+//g") -export PATH=$(echo $PATH| sed -E "s/[^:]+\/miniconda3\/[^:]+//g") -export PATH=$(echo $PATH| sed -E "s/[^:]+\/micromamba\/[^:]+//g") -export PATH=$(echo $PATH| sed -E "s/[^:]+\/anaconda3\/[^:]+//g") -export PATH="${CONDA_PREFIX}:${CONDA_PREFIX}/bin:$PATH" -echo "[II] included env conda to the PATH" +# remove any path to scicookie environment +export PATH=$(echo $PATH| sed -E "s/[^:]+\/scicookie\/[^:]+//g") if command -v poetry &> /dev/null; then poetry install diff --git a/tests/smoke/build-systems.sh b/tests/smoke/build-systems.sh index 9206404c..6b386cd0 100755 --- a/tests/smoke/build-systems.sh +++ b/tests/smoke/build-systems.sh @@ -1,8 +1,8 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" -. ${SMOKE_DIR}/base.sh "build_system=poetry" . ${SMOKE_DIR}/base.sh "build_system=flit" . ${SMOKE_DIR}/base.sh "build_system=mesonpy" . ${SMOKE_DIR}/base.sh "build_system=setuptools" @@ -11,3 +11,4 @@ SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" . ${SMOKE_DIR}/base.sh "build_system=maturin" . ${SMOKE_DIR}/base.sh "build_system=scikit-build-core" . ${SMOKE_DIR}/base.sh "build_system=pybind11" +. ${SMOKE_DIR}/base.sh "build_system=poetry" diff --git a/tests/smoke/containers.sh b/tests/smoke/containers.sh index 0ad38700..7f22f76d 100755 --- a/tests/smoke/containers.sh +++ b/tests/smoke/containers.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/smoke/docs.sh b/tests/smoke/docs.sh index 49af4671..9b61abe6 100755 --- a/tests/smoke/docs.sh +++ b/tests/smoke/docs.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/smoke/files.sh b/tests/smoke/files.sh index 0ed132dc..ef39bf2a 100755 --- a/tests/smoke/files.sh +++ b/tests/smoke/files.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/smoke/linters.sh b/tests/smoke/linters.sh index 9c609664..19633d65 100755 --- a/tests/smoke/linters.sh +++ b/tests/smoke/linters.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" diff --git a/tests/smoke/tests.sh b/tests/smoke/tests.sh index b6410b83..3e12cad9 100755 --- a/tests/smoke/tests.sh +++ b/tests/smoke/tests.sh @@ -1,3 +1,6 @@ +#!/usr/bin/env bash +set -e + SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )" . ${SMOKE_DIR}/base.sh "use_pytest=yes" diff --git a/tests/smoke/virtual-envs.sh b/tests/smoke/virtual-envs.sh index 3ed137db..8d8b6967 100755 --- a/tests/smoke/virtual-envs.sh +++ b/tests/smoke/virtual-envs.sh @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e SMOKE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"