From 2aae0f148ada7381906895f56d979319994c5b50 Mon Sep 17 00:00:00 2001 From: Joshua Hoskins Date: Tue, 10 Sep 2024 10:01:19 -0400 Subject: [PATCH] Update to toolviper. --- .github/workflows/python-testing-linux.yml | 43 +++++++++++++++++ .github/workflows/python-testing-macos.yml | 41 ++++++++++++++++ .github/workflows/pythonpublish.yml | 55 ++++++++++++++++++++++ pyproject.toml | 7 --- 4 files changed, 139 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/python-testing-linux.yml create mode 100644 .github/workflows/python-testing-macos.yml create mode 100644 .github/workflows/pythonpublish.yml diff --git a/.github/workflows/python-testing-linux.yml b/.github/workflows/python-testing-linux.yml new file mode 100644 index 0000000..1efbcad --- /dev/null +++ b/.github/workflows/python-testing-linux.yml @@ -0,0 +1,43 @@ +# This workflow will install Python dependencies, run tests and lint with a single version of Python +# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions + +name: Linux + +on: + push: + paths-ignore: + - '**.md' + - '**.rst' + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + python-version: ["3.9","3.10","3.11","3.12", "3.13"] + steps: + - uses: actions/checkout@v4 + + - name: Set up Python 3 + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + + - name: Install dependencies with pip + run: | + python -m pip install --upgrade pip + pip install . + - name: Test with pytest + run: | + pytest -v tests/ --html=test-results.html --self-contained-html --cov=viper --no-cov-on-fail --cov-report=html --doctest-modules + + - name: Upload pytest test results and coverage reports + uses: actions/upload-artifact@v4 + with: + name: pytest-results-${{ matrix.python-version }} + path: | + ./test-results.html + ./htmlcov + # Use always() to always run this step to publish test results when there are test failures + if: ${{ always() }} diff --git a/.github/workflows/python-testing-macos.yml b/.github/workflows/python-testing-macos.yml new file mode 100644 index 0000000..1d2b6e8 --- /dev/null +++ b/.github/workflows/python-testing-macos.yml @@ -0,0 +1,41 @@ +name: MacOS + +on: + push: + branches: + - main + paths-ignore: + - '**.md' + - '**.rst' + +jobs: + build: + name: macos (${{ matrix.python-version }}, ${{ matrix.os }}) + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash -l {0} + strategy: + fail-fast: false + matrix: + os: ["macos-latest"] + python-version: ["3.9", "3.10","3.11","3.12", "3.13"] + steps: + - name: Setup Conda + uses: conda-incubator/setup-miniconda@v3 + with: + auto-activate-base: false + activate-environment: xradiotest + auto-update-conda: true + python-version: ${{ matrix.python-version }} + channels: conda-forge + + - uses: actions/checkout@v4 + + - name: Install dependencies with pip + run: | + python -m pip install --upgrade pip + python -m pip install . + + - name: Test with pytest + run: pytest diff --git a/.github/workflows/pythonpublish.yml b/.github/workflows/pythonpublish.yml new file mode 100644 index 0000000..3359628 --- /dev/null +++ b/.github/workflows/pythonpublish.yml @@ -0,0 +1,55 @@ +# This workflows will upload a Python Package for tagged commits +# For more information see: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ + +name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI + +on: + release: + types: [created] + +jobs: + build: + name: Build distribution 📦 + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install pypa/build + run: >- + python3 -m + pip install + build + --user + - name: Build a source distribution + run: python3 -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + publish-to-pypi: + name: >- + Publish Python 🐍 distribution 📦 to PyPI + if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes + needs: + - build + runs-on: ubuntu-latest + environment: + name: release + url: https://pypi.org/project/toolviper + permissions: + id-token: write # IMPORTANT: mandatory for trusted publishing + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution 📦 to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/pyproject.toml b/pyproject.toml index b87627b..059434d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,31 +11,24 @@ readme = "README.md" requires-python = ">= 3.9, < 3.13" dependencies = [ - 'astropy', 'cerberus', 'dask', 'dask_jobqueue', 'distributed', - 'matplotlib', 'numba>=0.57.0', 'numpy', 'psutil', 'ipywidgets', - 'prettytable', 'pytest', 'pytest-cov', 'pytest-html', 'rich', - 'scipy', 'tqdm', - 'xarray', 'zarr', 'bokeh', 'jupyterlab', 'pyarrow', 'graphviz', - 'rich', - 'python_casacore>=3.6.1; sys_platform != "darwin" ' ]