Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove poetry and simplify CI #72

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
# This assumes pytest is installed via the install-package step above
command: |
# we don't need any other dependencies
python3 -m pip install matplotlib scipy numpy sympy pytest pytest-mpl git+https://github.com/jcgoran/cosmicfish@feature/pip-install
python3 -m pytest -k 'not interfaces and not __init__.py'
python3 -m pip install -e .[test]
bash scripts/check_coverage.sh

# Invoke jobs via workflows
# See: https://circleci.com/docs/2.0/configuration-reference/#workflows
Expand Down
12 changes: 4 additions & 8 deletions .github/workflows/build-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,24 @@ jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0

# Install dependencies
- name: Set up Python 3.9
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: 3.9

- name: Install Poetry
uses: snok/install-poetry@v1

- name: Install dependencies
run: |
python3 -m pip install pdoc matplotlib numpy scipy wheel setuptools poetry pytest
python3 -m pip install .
python3 -m pip install .[docs,test]

# Build the site
- name: Build the site
run: |
bash generate_docs.sh -t
bash scripts/generate_docs.sh -t

# If we've pushed to master, push the book's HTML to github-pages
- if: ${{ github.ref == 'refs/heads/master' }}
Expand Down
42 changes: 23 additions & 19 deletions .github/workflows/publish-pypi.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
name: Publish tagged version to PyPI

name: Publish to PyPI
on:
push:
workflow_dispatch:
inputs:
version:
description: 'The version of the project to publish'
type: string
required: true

jobs:
pypi-publish:
Expand All @@ -11,27 +15,27 @@ jobs:
name: pypi
url: https://pypi.org/p/fitk
permissions:
contents: read
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
#----------------------------------------------
# poetry setup
#----------------------------------------------
- uses: snok/install-poetry@v1
- name: Set up Python
uses: actions/setup-python@v5
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
python-version: '3.11'

- name: Checkout project
uses: actions/checkout@v4

- name: Build wheel and tarball
run: poetry build --no-interaction
- name: Build package
run: SETUPTOOLS_SCM_PRETEND_VERSION=${{ inputs.version }} python3 -m pip wheel . --wheel-dir dist/ --no-deps

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: wheel
path: dist/*.whl

- name: Publish package distributions to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
- name: Publish package distributions to test PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
167 changes: 56 additions & 111 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,69 +21,47 @@ jobs:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
#----------------------------------------------
# poetry setup
#----------------------------------------------
- uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --extras interfaces --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
#----------------------------------------------
# install and run linters
#----------------------------------------------
- run: sh check_syntax.sh
python-version: '3.9'

- run: |
python -m pip install -e .[docs,test,dev]

- run: bash scripts/check_syntax.sh

test:
name: Tests of general module
needs: linting
strategy:
fail-fast: true
matrix:
os: [ "ubuntu-latest" ]
python-version: [ "3.7", "3.8", "3.9" ]
python-version: [ "3.8", "3.9", "3.12" ]

runs-on: ${{ matrix.os }}
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up python ${{ matrix.python-version }}
id: setup-python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
#----------------------------------------------
# poetry setup
#----------------------------------------------
- uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction

- run: |
python -m pip install -e .[test]

- name: Run tests
run: sh check_coverage.sh
run: bash scripts/check_coverage.sh

- name: Upload coverage
if: ${{ matrix.python-version == '3.9' && matrix.os == 'ubuntu-latest' }}
uses: codecov/codecov-action@v1
Expand All @@ -103,31 +81,20 @@ jobs:
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
#----------------------------------------------
# poetry setup
#----------------------------------------------
- uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Install CLASS
python-version: '3.9'

- name: Install project and CLASS
run: |
poetry install --no-interaction
poetry run pip install Cython
git clone --depth 1 --branch feature/conda https://github.com/JCGoran/class_public && cd class_public && poetry run make classy && cd -
python -m pip install -e .[test]
python -m pip install Cython
git clone --depth 1 --branch feature/conda https://github.com/JCGoran/class_public && cd class_public && make classy && cd -
- name: Run CLASS tests
run: poetry run pytest -v tests/test_classy_interfaces.py
run: python -m pytest -v tests/test_classy_interfaces.py

coffe:
name: Tests for COFFE interfaces
Expand All @@ -136,32 +103,21 @@ jobs:
strategy:
fail-fast: true
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
#----------------------------------------------
# poetry setup
#----------------------------------------------
- uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Install COFFE
run: poetry install --extras coffe --no-interaction
python-version: '3.9'

- name: Install project and COFFE
run: |
python -m pip install -e .[test]
python -m pip install coffe

- name: Run COFFE tests
run: poetry run pytest -v tests/test_coffe_interfaces.py
run: python -m pytest -v tests/test_coffe_interfaces.py

camb:
name: Tests for CAMB interfaces
Expand All @@ -170,29 +126,18 @@ jobs:
strategy:
fail-fast: true
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v2
#----------------------------------------------
# poetry setup
#----------------------------------------------
- uses: snok/install-poetry@v1
with:
version: 1.4.2
virtualenvs-create: true
virtualenvs-in-project: true
- name: cache deps
id: cache-deps
uses: actions/cache@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
path: .venv
key: pydeps-${{ hashFiles('**/poetry.lock') }}
- run: poetry install --no-interaction --no-root
if: steps.cache-deps.outputs.cache-hit != 'true'
- run: poetry install --no-interaction
- name: Install CAMB
run: poetry install --extras camb --no-interaction
python-version: '3.9'

- name: Install project and CAMB
run: |
python -m pip install -e .[test]
python -m pip install camb

- name: Run CAMB tests
run: poetry run pytest -v tests/test_camb_interfaces.py
run: python -m pytest -v tests/test_camb_interfaces.py
Loading
Loading