Skip to content

Commit

Permalink
Merge pull request #48 from pluflou/conda-fix
Browse files Browse the repository at this point in the history
update pyproject.toml and workflows
  • Loading branch information
pluflou authored Sep 16, 2024
2 parents 927aa4f + 44c0f4d commit e2a5a1e
Show file tree
Hide file tree
Showing 6 changed files with 119 additions and 103 deletions.
33 changes: 16 additions & 17 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ jobs:

steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Twine
run: sudo pip install twine
- name: Install Twine and Build
run: sudo pip install twine build

- name: Create the distribution
run: |
git fetch --prune --unshallow --tags
sudo python setup.py sdist bdist_wheel
sudo python3 -m build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand All @@ -39,10 +39,10 @@ jobs:
shell: bash -l {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: "3.9"

Expand All @@ -53,30 +53,29 @@ jobs:
activate-environment: ""
miniconda-version: "latest"

- name: Install the Mamba Dependencies
run: |
- name: Install the Conda Dependencies
run: |
conda config --set always_yes yes --set auto_update_conda false
conda update conda
conda install mamba -n base -c conda-forge
conda install -n base conda-libmamba-solver
mamba install python=3.9 "conda-build=3.21" colorama pip ruamel ruamel.yaml rich mamba jsonschema -c conda-forge
conda install python=3.9 conda-build colorama pip ruamel ruamel.yaml rich jsonschema -c conda-forge
git fetch --prune --unshallow --tags
pip install -e .
# run install twice due to client-size to ensure all files downloaded
# echo yes before login to prevent anaconda bug breaking automation
# git tags MUST be fetched otherwise output will be blank
# bash variables cannot be used in github actions, must use actions specific syntax and methods
- name: Build the Anaconda Package
id: mambabuild
id: condabuild
run: |
mamba install anaconda-client
conda install anaconda-client
conda config --set anaconda_upload no --set solver libmamba
echo yes | anaconda login --username ${{ secrets.ANACONDA_CLOUD_USERNAME }} --password ${{ secrets.ANACONDA_CLOUD_PASSWORD }}
git fetch --prune --unshallow --tags
VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) conda build . -c conda-forge -c stanfordcvxgrp --numpy 1.16.4
echo '::set-output name=gitversion::$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)'
VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) conda build . -c anaconda -c conda-forge -c stanfordcvxgrp
echo "gitversion=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)" >> $GITHUB_OUTPUT
- name: Upload the Anaconda Package
id: condaload
run: |
anaconda upload -u stanfordcvxgrp /usr/share/miniconda3/conda-bld/noarch/qss-${{ steps.mambabuild.outputs.gitversion }}-*.tar.bz2
anaconda upload -u stanfordcvxgrp /usr/share/miniconda3/conda-bld/noarch/qss-${{ steps.condabuild.outputs.gitversion }}-*.tar.bz2
75 changes: 39 additions & 36 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,87 @@
name: Main Test

on:
pull_request:
push:
branches:
- master
tags:
- '*'
push:
pull_request:
branches: [main]
types: [opened, edited, reopened]
jobs:
run-tests:
runs-on: ubuntu-latest
environment: test
strategy:
fail-fast: false
matrix:
python-version: [ "3.10", "3.11", "3.12" ]
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: '3.9'
python-version: ${{ matrix.python-version }}

- name: Install Dependencies
run: |
sudo python -m pip install -r requirements.txt
python -m pip install pytest
python -m pip install -e .
- name: Install Python Dependencies
run: |
curl -LsSf https://astral.sh/uv/install.sh | sh
uv pip install --system --break-system-packages -r requirements.txt
uv pip install --system --break-system-packages pytest pytest-cov pytest-github-report pytest-github-actions-annotate-failures
# Current unit test is not consistent. Occasionally fails despite usually passing. Needs to be fixed.
- name: Run Unit Tests
run: |
python -m pytest --import-mode=append tests/
env:
pytest_github_report: true
pytest_verbosity: 2
run: pytest -v --cov=src --cov-report=xml --cov-report=term-missing --color=yes tests/

test-build-pypi:
needs: run-tests
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Twine
run: sudo pip install twine
- name: Install Twine and Build
run: sudo pip install twine build

- name: Create the distribution
run: |
git fetch --prune --unshallow --tags
sudo python setup.py sdist bdist_wheel
sudo python3 -m build
test-build-conda:
needs: run-tests
runs-on: ubuntu-latest
# sets default shell to remove need for source to run the conda shell
defaults:
run:
shell: bash -l {0}
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v5
with:
python-version: "3.9"

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
uses: conda-incubator/setup-miniconda@v3
with:
auto-activate-base: true
activate-environment: ""
miniconda-version: "latest"

- name: Install the Mamba Dependencies
run: |
- name: Install the Conda Dependencies
run: |
conda config --set always_yes yes --set auto_update_conda false
conda update conda
conda install mamba -n base -c conda-forge
conda install -n base conda-libmamba-solver
mamba install python=3.9 "conda-build=3.21" colorama pip ruamel ruamel.yaml rich mamba jsonschema -c conda-forge
conda install python=3.9 conda-build colorama pip ruamel ruamel.yaml rich jsonschema -c conda-forge
git fetch --prune --unshallow --tags
pip install -e .
Expand All @@ -87,10 +90,10 @@ jobs:
# git tags MUST be fetched otherwise output will be blank
# bash variables cannot be used in github actions, must use actions specific syntax and methods
- name: Build the Anaconda Package
id: mambabuild
id: condabuild
run: |
mamba install anaconda-client
conda install anaconda-client
conda clean --all
conda config --set anaconda_upload no --set solver libmamba
git fetch --prune --unshallow --tags
VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-) conda build . -c conda-forge -c stanfordcvxgrp --numpy 1.16.4
echo '::set-output name=gitversion::$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)'
VERSION_FROM_GIT_TAG=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)test conda build . -c conda-forge -c stanfordcvxgrp
echo "gitversion=$(git tag --list "v*[0-9]" --sort=version:refname | tail -1 | cut -c 2-)" >> $GITHUB_OUTPUT
28 changes: 16 additions & 12 deletions conda_recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ package:
version: {{ environ.get('VERSION_FROM_GIT_TAG') }}

source:
git_url: https://github.com/cvxgrp/qss
path: .. # checked out repo instead of main repo branch

build:
noarch: python
Expand All @@ -16,31 +16,35 @@ requirements:
host:
- pip
- python >=3.6
- scipy
- numpy >=1.16
- qdldl-python
- cvxpy
- matplotlib

run:
- pip
- python
- scipy
- numpy >=1.16
- scipy==1.13.1
- numpy
- qdldl-python
- cvxpy
- matplotlib

test:
imports:
- qss
commands:
- pip check
requires:
- pip

about:
home: https://github.com/cvxgrp/qss
license: BSD
license_family: BSD
license_file:
summary: QSS Quadratic-Seperable Solver
license: Apache
license_family: Apache
license_file: LICENSE
summary: QSS Quadratic-Separable Solver
doc_url:
dev_url:

extra:
recipe-maintainers:
- lukevolpatti
- Thistleman
- pluflou
49 changes: 47 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
[build-system]
requires = ["setuptools>=61.0.0", "wheel"]
build-backend = "setuptools.build_meta"
requires = ["setuptools>=64.0", "setuptools-scm[toml]"]
build-backend = "setuptools.build_meta"

[project]
name = "qss"
description = "QSS: Quadratic-Separable Solver"
readme = "README.md"
license.file = "LICENSE"
authors = [
{ name = "Luke Volpatti", email = "[email protected]" },
]
maintainers = [
{ name = "Sara Miskovich", email = "[email protected]" },
]
requires-python = ">=3.6"

dependencies = [
"scipy==1.13.1",
"numpy",
"cvxpy",
"qdldl",
"matplotlib"
]

classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Intended Audience :: Science/Research",
"Topic :: Scientific/Engineering",
]
dynamic = ["version"]
[tool.setuptools_scm]

[tool.setuptools.packages.find]
include = ["qss*"]

[project.urls]
Homepage = "https://github.com/cvxgrp/qss"
"Bug Tracker" = "https://github.com/cvxgrp/qss/issues"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
numpy
scipy
scipy==1.13.1
qdldl
cvxpy
matplotlib
35 changes: 0 additions & 35 deletions setup.py

This file was deleted.

0 comments on commit e2a5a1e

Please sign in to comment.