From 6fc27dddea2d98d1353b31d00509eb57c3a6e510 Mon Sep 17 00:00:00 2001 From: Dominic Davis-Foster Date: Sat, 26 Dec 2020 15:44:58 +0000 Subject: [PATCH] Enable conda tests. --- .github/actions_build_conda.sh | 23 ++++++++++++++ .github/actions_deploy_conda.sh | 24 +++++++++++++++ .github/workflows/conda_ci.yml | 44 +++++++++++++++++++++++++++ .github/workflows/python_ci_linux.yml | 35 +++++++++++++++++++++ README.rst | 27 +++++++++++++++- doc-source/index.rst | 12 ++++++++ repo_helper.yml | 8 ++--- 7 files changed, 168 insertions(+), 5 deletions(-) create mode 100755 .github/actions_build_conda.sh create mode 100755 .github/actions_deploy_conda.sh create mode 100644 .github/workflows/conda_ci.yml diff --git a/.github/actions_build_conda.sh b/.github/actions_build_conda.sh new file mode 100755 index 0000000..1acebbe --- /dev/null +++ b/.github/actions_build_conda.sh @@ -0,0 +1,23 @@ +#!/bin/bash +# This file is managed by 'repo_helper'. Don't edit it directly. + +set -e -x + +python -m repo_helper make-recipe || exit 1 + +# Switch to miniconda +source "/home/runner/miniconda/etc/profile.d/conda.sh" +hash -r +conda activate base +conda config --set always_yes yes --set changeps1 no +conda update -q conda +conda install conda-build +conda install anaconda-client +conda info -a + +conda config --add channels conda-forge || exit 1 +conda config --add channels domdfcoding || exit 1 + +conda build conda -c conda-forge -c domdfcoding --output-folder conda/dist --skip-existing + +exit 0 diff --git a/.github/actions_deploy_conda.sh b/.github/actions_deploy_conda.sh new file mode 100755 index 0000000..7143fa1 --- /dev/null +++ b/.github/actions_deploy_conda.sh @@ -0,0 +1,24 @@ +#!/bin/bash +# This file is managed by 'repo_helper'. Don't edit it directly. + +set -e -x + +# Switch to miniconda +source "/home/runner/miniconda/etc/profile.d/conda.sh" +hash -r +conda activate base +conda config --set always_yes yes --set changeps1 no +conda update -q conda +conda install anaconda-client +conda info -a + +for f in conda/dist/noarch/sphinx-autofixture-*.tar.bz2; do + [ -e "$f" ] || continue + echo "$f" + conda install "$f" || exit 1 + echo "Deploying to Anaconda.org..." + anaconda -t "$ANACONDA_TOKEN" upload "$f" || exit 1 + echo "Successfully deployed to Anaconda.org." +done + +exit 0 diff --git a/.github/workflows/conda_ci.yml b/.github/workflows/conda_ci.yml new file mode 100644 index 0000000..426ab4a --- /dev/null +++ b/.github/workflows/conda_ci.yml @@ -0,0 +1,44 @@ +# This file is managed by 'repo_helper'. Don't edit it directly. +--- +name: Conda Tests + +on: + push: + pull_request: + branches: ["master"] + +jobs: + tests: + name: "Conda" + runs-on: ubuntu-latest + + steps: + - name: Checkout 🛎️ + uses: "actions/checkout@v2" + + - name: Setup Python 🐍 + uses: "actions/setup-python@v2" + with: + python-version: "3.8" + + - name: Install dependencies 🔧 + run: | + python -VV + python -m site + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade repo_helper + # $CONDA is an environment variable pointing to the root of the miniconda directory + $CONDA/bin/conda update -q conda + $CONDA/bin/conda install conda-build + + $CONDA/bin/conda config --add channels conda-forge + $CONDA/bin/conda config --add channels domdfcoding + + - name: "Build and install package" + run: | + # This mess is only necessary because conda won't fix it themselves + # https://github.com/conda/conda/issues/1884 + + python -m repo_helper build --conda --out-dir conda-bld/noarch + $CONDA/bin/conda index ./conda-bld || exit 1 + $CONDA/bin/conda install -c file://$(pwd)/conda-bld sphinx-autofixture -y || exit 1 diff --git a/.github/workflows/python_ci_linux.yml b/.github/workflows/python_ci_linux.yml index a52ca67..5823947 100644 --- a/.github/workflows/python_ci_linux.yml +++ b/.github/workflows/python_ci_linux.yml @@ -129,3 +129,38 @@ jobs: user: __token__ password: ${{ secrets.PYPI_TOKEN }} skip_existing: true + + + + Conda: + needs: deploy + runs-on: "ubuntu-20.04" + if: startsWith(github.ref, 'refs/tags/') || (startsWith(github.event.head_commit.message, 'Bump version') != true) + steps: + - name: Checkout 🛎️ + uses: "actions/checkout@v2" + + - name: Setup Python 🐍 + uses: "actions/setup-python@v2" + with: + python-version: 3.8 + + - name: Install dependencies 🔧 + run: | + python -m pip install --upgrade pip setuptools wheel + python -m pip install --upgrade repo_helper + + wget https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh -O miniconda.sh + bash miniconda.sh -b -p $HOME/miniconda + + - name: Build Conda 📦 + run: | + chmod +x .github/actions_build_conda.sh + bash .github/actions_build_conda.sh + + - name: Deploy Conda 🚀 + run: | + chmod +x .github/actions_deploy_conda.sh + bash .github/actions_deploy_conda.sh + env: + ANACONDA_TOKEN: ${{ secrets.ANACONDA_TOKEN }} diff --git a/README.rst b/README.rst index 512de82..22d3370 100644 --- a/README.rst +++ b/README.rst @@ -21,6 +21,8 @@ sphinx-autofixture - |actions_linux| |actions_windows| |actions_macos| |coveralls| * - PyPI - |pypi-version| |supported-versions| |supported-implementations| |wheel| + * - Anaconda + - |conda-version| |conda-platform| * - Activity - |commits-latest| |commits-since| |maintained| |pypi-downloads| * - QA @@ -84,6 +86,14 @@ sphinx-autofixture :target: https://pypi.org/project/sphinx-autofixture/ :alt: PyPI - Wheel +.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/sphinx-autofixture?logo=anaconda + :target: https://anaconda.org/domdfcoding/sphinx-autofixture + :alt: Conda - Package Version + +.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/sphinx-autofixture?label=conda%7Cplatform + :target: https://anaconda.org/domdfcoding/sphinx-autofixture + :alt: Conda - Platform + .. |license| image:: https://img.shields.io/github/license/sphinx-toolbox/sphinx-autofixture :target: https://github.com/sphinx-toolbox/sphinx-autofixture/blob/master/LICENSE :alt: License @@ -117,7 +127,7 @@ Installation .. start installation -``sphinx-autofixture`` can be installed from PyPI. +``sphinx-autofixture`` can be installed from PyPI or Anaconda. To install with ``pip``: @@ -125,4 +135,19 @@ To install with ``pip``: $ python -m pip install sphinx-autofixture +To install with ``conda``: + + * First add the required channels + + .. code-block:: bash + + $ conda config --add channels http://conda.anaconda.org/conda-forge + $ conda config --add channels http://conda.anaconda.org/domdfcoding + + * Then install + + .. code-block:: bash + + $ conda install sphinx-autofixture + .. end installation diff --git a/doc-source/index.rst b/doc-source/index.rst index d5de115..acd41dd 100644 --- a/doc-source/index.rst +++ b/doc-source/index.rst @@ -20,6 +20,8 @@ sphinx-autofixture - |actions_linux| |actions_windows| |actions_macos| |coveralls| * - PyPI - |pypi-version| |supported-versions| |supported-implementations| |wheel| + * - Anaconda + - |conda-version| |conda-platform| * - Activity - |commits-latest| |commits-since| |maintained| |pypi-downloads| * - QA @@ -84,6 +86,14 @@ sphinx-autofixture :wheel: :alt: PyPI - Wheel +.. |conda-version| image:: https://img.shields.io/conda/v/domdfcoding/sphinx-autofixture?logo=anaconda + :target: https://anaconda.org/domdfcoding/sphinx-autofixture + :alt: Conda - Package Version + +.. |conda-platform| image:: https://img.shields.io/conda/pn/domdfcoding/sphinx-autofixture?label=conda%7Cplatform + :target: https://anaconda.org/domdfcoding/sphinx-autofixture + :alt: Conda - Platform + .. |license| github-shield:: :license: :alt: License @@ -121,6 +131,8 @@ Installation .. installation:: sphinx-autofixture :pypi: :github: + :anaconda: + :conda-channels: conda-forge, domdfcoding .. end installation diff --git a/repo_helper.yml b/repo_helper.yml index 09be439..617d409 100644 --- a/repo_helper.yml +++ b/repo_helper.yml @@ -6,23 +6,23 @@ author: 'Dominic Davis-Foster' email: 'dominic@davis-foster.co.uk' username: "sphinx-toolbox" assignee: "domdfcoding" +primary_conda_channel: 'domdfcoding' version: '0.2.1' license: 'MIT' short_desc: 'Sphinx autodocumenter for pytest fixtures.' -enable_conda: false - python_versions: - 3.6 - 3.7 - 3.8 - 3.9 - sphinx_html_theme: furo - standalone_contrib_guide: true +conda_channels: + - conda-forge + extra_sphinx_extensions: - sphinx_autofixture