Skip to content

Commit

Permalink
update CI to use poetry
Browse files Browse the repository at this point in the history
  • Loading branch information
landmanbester committed Nov 11, 2024
1 parent f9d6dc0 commit 13ec4d3
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 79 deletions.
83 changes: 70 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,93 @@
name: pfb-imaging Workflow
name: pfb-imaging CI Workflow

on:
push:
tags:
- 'v*'
pull_request:

env:
POETRY_VERSION: 1.5

jobs:
test:
runs-on: ubuntu-latest
runs-on: ${{ matrix.os }}
continue-on-error: true
if: "!contains(github.event.head_commit.message, '[skip ci]')"

env:
NUMBA_CACHE_DIR: /tmp/numba-cache

strategy:
matrix:
python-version: ["3.10", "3.11"]
os: [ubuntu-20.04, ubuntu-22.04]
python-version: ["3.9", "3.10", "3.11"]

steps:
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version}}

- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Check poetry install
run: poetry --version

- name: Checkout source
uses: actions/checkout@v3
with:
fetch-depth: 1
fetch-depth: 0

- name: Restore repo times
uses: chetan/git-restore-mtime-action@v2

- name: Upgrade pip and setuptools
run: python -m pip install -U pip setuptools

# - name: Pin setuptools
# run: python -m pip install setuptools==65.5
- name: Create Key and Numba Cache Directory
id: numba-key
run: |
mkdir -p ${{ env.NUMBA_CACHE_DIR }}
echo "timestamp=$(/bin/date -u '+%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
- name: Cache Numba Kernels
uses: actions/cache@v3
with:
key: numba-cache-${{ matrix.python-version }}-${{ steps.numba-key.outputs.timestamp }}
restore-keys: numba-cache-${{ matrix.python-version }}-
path: ${{ env.NUMBA_CACHE_DIR }}

- name: List the measures directory
run: curl ftp://ftp.astron.nl/outgoing/Measures/ > measures_dir.txt

- name: Load cached CASA Measures Data
id: load-cached-casa-measures
uses: actions/cache@v3
with:
key: casa-measures-${{ hashFiles('measures_dir.txt')}}
path: |
~/measures
~/.casarc
- name: Download and install CASA Measures Data
if: steps.load-cached-casa-measures.outputs.cache-hit != 'true'
run: |
mkdir -p ~/measures
curl ftp://ftp.astron.nl/outgoing/Measures/WSRT_Measures.ztar | tar xvzf - -C ~/measures
echo "measures.directory: ~/measures" > ~/.casarc
- name: Install pfb-imaging
run: python -m pip install .[testing]
run: poetry install

- name: Run pfb-imaging
run: poetry run pfb --help

- name: Run tests
run: pytest -s -vvv tests/
run: poetry rin pytest -v tests/

deploy:
needs: [test]
Expand All @@ -48,27 +100,32 @@ jobs:
with:
python-version: "3.10"

- name: Install latest setuptools, wheel, pip
run: python3 -m pip install -U pip setuptools wheel
- name: Install poetry
uses: abatilo/actions-poetry@v2
with:
poetry-version: ${{ env.POETRY_VERSION }}

- name: Check poetry install
run: poetry --version

- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Build distributions
run: python setup.py sdist bdist_wheel
run: poetry build

- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@1.8.6
with:
user: __token__
password: ${{ secrets.PYPI_TEST_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
continue-on-error: false

- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
uses: pypa/gh-action-pypi-publish@1.8.6
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[tool.poetry]
name = "pfb-imaging"
version = "0.0.4"
description = "Radio interferometric imaging suite based on a preconditioned forward-backward approach"
authors = ["Landman Bester <[email protected]>"]
license = "MIT"
readme = "README.rst"
classifiers = [
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
"License :: OSI Approved :: MIT License",
"Operating System :: POSIX :: Linux",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Astronomy"
]
packages = [{include = "pfb"}]

[tool.poetry.dependencies]
python = ">=3.10, <3.12"
pytest = ">=8.0.0"
scikit-image = ">=0.24.0"
PyWavelets = ">=1.7.0"
katbeam = ">=0.1"
numexpr = ">=2.10.1"
pyscilog = ">=0.1.2"
Click = ">=8.1"
ducc0 = ">=0.34.0"
sympy = ">=1.13"
stimela = { git = "https://github.com/caracal-pipeline/stimela.git", branch = "clickify_missing_as_none" }
streamjoy = ">=0.0.8"
codex-africanus = {extras = ["dask", "scipy", "astropy", "python-casacore"], version = ">=0.3.7, <=0.3.7"}
dask-ms = {extras = ["s3", "xarray", "zarr"], version = ">=0.2.20, <=0.2.20"}
tbb = ">=2021.13.1"
jax = {extras = ["cpu"], version = ">=0.4.31"}
lz4 = ">=4.3.3"
bokeh = ">=3.1.0"
regions = ">=0.9"
psutil = ">=5.9.8"

[tool.poetry.scripts]
pfb = "pfb.workers.main:cli"

[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

## add section for dev component which installs builder and Dockerfiles
66 changes: 0 additions & 66 deletions setup.py

This file was deleted.

0 comments on commit 13ec4d3

Please sign in to comment.