From 92f67fba9a7f5135159d6c3a3c65f10dc46f39be Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sat, 8 Apr 2023 23:19:38 -0500 Subject: [PATCH 1/3] CI: Use unique envs for each binding & tweak shell options --- .github/workflows/ci.yml | 2 +- .github/workflows/test.sh | 8 ++------ 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a9da129c..5cef2da4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -121,7 +121,7 @@ jobs: if: always() && (! (matrix.skip-pyside6)) run: ./.github/workflows/test.sh pyside6 - name: Upload coverage data to coveralls.io - shell: bash + shell: bash -e {0} env: COVERALLS_FLAG_NAME: ${{ matrix.os }} Python ${{ matrix.python-version }} conda=${{ matrix.use-conda }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.sh b/.github/workflows/test.sh index 977e7644..05a59ffe 100755 --- a/.github/workflows/test.sh +++ b/.github/workflows/test.sh @@ -1,11 +1,7 @@ #!/bin/bash -ex -# Activate conda properly eval "$(conda shell.bash hook)" -# Remove any existing env -conda remove -q -n test-env --all || true - # Create and activate conda environment for this test BINDING=$(echo "$1" | tr '[:lower:]' '[:upper:]') QT_VERSION_VAR=${BINDING}_QT_VERSION @@ -16,8 +12,8 @@ if [ "${!QT_VERSION_VAR:0:3}" = "5.9" ]; then PYTEST_VERSION=">=6,!=7.0.0,!=7.0.1,<7.2.0" fi -conda create -q -n test-env python=${PYTHON_VERSION} pytest${PYTEST_VERSION:-">=6,!=7.0.0,!=7.0.1"} "pytest-cov>=3.0.0" pytest-qt${PYTESTQT_VERSION:-} -conda activate test-env +conda create -q -n test-env-${BINDING} python=${PYTHON_VERSION} pytest${PYTEST_VERSION:-">=6,!=7.0.0,!=7.0.1"} "pytest-cov>=3.0.0" pytest-qt${PYTESTQT_VERSION:-} +conda activate test-env-${BINDING} if [ "$USE_CONDA" = "Yes" ]; then From d575bd26af7c10eb58130cdd7a8721c7d00de492 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sun, 9 Apr 2023 00:41:34 -0500 Subject: [PATCH 2/3] CI: Replace Conda with Mamba for faster & more stable/accurate solves --- .github/workflows/ci.yml | 6 ++++-- .github/workflows/test.sh | 12 ++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cef2da4..10d20c53 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -103,11 +103,13 @@ jobs: auto-update-conda: true channels: conda-forge channel-priority: strict + miniforge-variant: Mambaforge + use-mamba: true - name: Print Conda info shell: bash -l {0} run: | - conda info - conda list + mamba info + mamba list - name: Test PyQt5 if: (! matrix.skip-pyqt5) run: ./.github/workflows/test.sh pyqt5 diff --git a/.github/workflows/test.sh b/.github/workflows/test.sh index 05a59ffe..ef88e560 100755 --- a/.github/workflows/test.sh +++ b/.github/workflows/test.sh @@ -2,7 +2,7 @@ eval "$(conda shell.bash hook)" -# Create and activate conda environment for this test +# Create and activate mamba environment for this test BINDING=$(echo "$1" | tr '[:lower:]' '[:upper:]') QT_VERSION_VAR=${BINDING}_QT_VERSION @@ -12,17 +12,17 @@ if [ "${!QT_VERSION_VAR:0:3}" = "5.9" ]; then PYTEST_VERSION=">=6,!=7.0.0,!=7.0.1,<7.2.0" fi -conda create -q -n test-env-${BINDING} python=${PYTHON_VERSION} pytest${PYTEST_VERSION:-">=6,!=7.0.0,!=7.0.1"} "pytest-cov>=3.0.0" pytest-qt${PYTESTQT_VERSION:-} +mamba create -y -n test-env-${BINDING} python=${PYTHON_VERSION} pytest${PYTEST_VERSION:-">=6,!=7.0.0,!=7.0.1"} "pytest-cov>=3.0.0" pytest-qt${PYTESTQT_VERSION:-} conda activate test-env-${BINDING} if [ "$USE_CONDA" = "Yes" ]; then if [ "${1}" = "pyqt5" ]; then - conda install -q qt=${PYQT5_QT_VERSION} pyqt=${PYQT5_VERSION} + mamba install -y qt=${PYQT5_QT_VERSION} pyqt=${PYQT5_VERSION} elif [ "${1}" = "pyside2" ]; then - conda install -q qt=${PYSIDE2_QT_VERSION} pyside2=${PYSIDE2_VERSION} + mamba install -y qt=${PYSIDE2_QT_VERSION} pyside2=${PYSIDE2_VERSION} elif [ "${1}" = "pyside6" ]; then - conda install -q qt6-main=${PYSIDE6_QT_VERSION} pyside6=${PYSIDE6_VERSION} + mamba install -y qt6-main=${PYSIDE6_QT_VERSION} pyside6=${PYSIDE6_VERSION} else exit 1 fi @@ -56,7 +56,7 @@ python -bb -X dev -W error -m build echo dist/*.whl | xargs -I % python -bb -X dev -W error -W "ignore::DeprecationWarning:pip._internal.locations._distutils" -W "ignore::DeprecationWarning:distutils.command.install" -m pip install --upgrade % # Print environment information -conda list +mamba list # Run tests mkdir -p temp_test_dir From 243f418a2f1b13deba674abcb003f1d967b1ea20 Mon Sep 17 00:00:00 2001 From: "C.A.M. Gerlach" Date: Sun, 9 Apr 2023 01:26:26 -0500 Subject: [PATCH 3/3] CI: Create env & install Qt deps in one pass for further speedups --- .github/workflows/test.sh | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test.sh b/.github/workflows/test.sh index ef88e560..5ccfbc10 100755 --- a/.github/workflows/test.sh +++ b/.github/workflows/test.sh @@ -12,22 +12,26 @@ if [ "${!QT_VERSION_VAR:0:3}" = "5.9" ]; then PYTEST_VERSION=">=6,!=7.0.0,!=7.0.1,<7.2.0" fi -mamba create -y -n test-env-${BINDING} python=${PYTHON_VERSION} pytest${PYTEST_VERSION:-">=6,!=7.0.0,!=7.0.1"} "pytest-cov>=3.0.0" pytest-qt${PYTESTQT_VERSION:-} -conda activate test-env-${BINDING} if [ "$USE_CONDA" = "Yes" ]; then if [ "${1}" = "pyqt5" ]; then - mamba install -y qt=${PYQT5_QT_VERSION} pyqt=${PYQT5_VERSION} + QT_SPECS="qt=${PYQT5_QT_VERSION} pyqt=${PYQT5_VERSION}" elif [ "${1}" = "pyside2" ]; then - mamba install -y qt=${PYSIDE2_QT_VERSION} pyside2=${PYSIDE2_VERSION} + QT_SPECS="qt=${PYSIDE2_QT_VERSION} pyside2=${PYSIDE2_VERSION}" elif [ "${1}" = "pyside6" ]; then - mamba install -y qt6-main=${PYSIDE6_QT_VERSION} pyside6=${PYSIDE6_VERSION} + QT_SPECS="qt6-main=${PYSIDE6_QT_VERSION} pyside6=${PYSIDE6_VERSION}" else exit 1 fi -else +fi + +mamba create -y -n test-env-${BINDING} python=${PYTHON_VERSION} pytest${PYTEST_VERSION:->=6,!=7.0.0,!=7.0.1} pytest-cov>=3.0.0 pytest-qt${PYTESTQT_VERSION:-} ${QT_SPECS:-} + +conda activate test-env-${BINDING} + +if [ "$USE_CONDA" = "No" ]; then if [ "${1}" = "pyqt5" ]; then pip install pyqt5==${PYQT5_VERSION}.* PyQtWebEngine==${PYQT5_VERSION}.* QScintilla==${QSCINTILLA_VERSION}.*