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

MNT: Drop travis for GHA #92

Merged
merged 8 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .github/workflows/flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Check Code Style - FLAKE8

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Install Dependencies
run: |
# These packages are installed in the base environment but may be older
# versions. Explicitly upgrade them because they often create
# installation problems if out of date.
python -m pip install --upgrade pip setuptools numpy

pip install flake8
- name: Run flake8
run: |
flake8
ambarb marked this conversation as resolved.
Show resolved Hide resolved
39 changes: 39 additions & 0 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# This workflow will upload a Python Package using flit when a release is created
# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries
# This workflows will upload a Python Package when a release is created.
# For more information see:
# - https://docs.pypi.org/trusted-publishers/adding-a-publisher/
# - https://github.com/pypa/gh-action-pypi-publish

name: Upload Python Package

on:
release:
types: [created]

jobs:
deploy:

runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'

- name: Build package
run: |
set -vxeuo pipefail
python -m pip install --upgrade pip
pip install wheel setuptools
python setup.py sdist bdist_wheel

- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: ./dist/
46 changes: 46 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Unit Tests

on: [push, pull_request, workflow_dispatch]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]

fail-fast: false
steps:

- uses: actions/checkout@v4

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

- name: Install
shell: bash -l {0}
run: |
set -vxeuo pipefail
pip install --upgrade pip setuptools wheel numpy
pip install -r requirements-dev.txt
pip install -r requirements-extras.txt
pip install -e .
pip list

- name: Test with pytest
shell: bash -l {0}
run: |
set -vxeuo pipefail
coverage run --source=csxtools run_tests.py
coverage xml

- name: Upload coverage to Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
flags: unittests

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ docs/_build/

#pycharm
.idea/*
.vscode

#Dolphin browser files
.directory/
Expand Down
51 changes: 0 additions & 51 deletions .travis.yml

This file was deleted.

101 changes: 69 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,45 +1,82 @@
from __future__ import (absolute_import, division, print_function)
import setuptools
from distutils.core import setup, Extension
from __future__ import absolute_import, division, print_function

import sys
from distutils.core import Extension, setup
from os import path

import numpy as np
import setuptools

import versioneer

with open('requirements.txt') as f:
min_version = (3, 8)
if sys.version_info < min_version:
error = """
bluesky-adaptive does not support Python {0}.{1}.
Python {2}.{3} and above is required. Check your Python version like so:

python3 --version

This may be due to an out-of-date pip. Make sure you have pip >= 9.0.1.
Upgrade pip like so:

pip install --upgrade pip
""".format(
*(sys.version_info[:2] + min_version)
)
sys.exit(error)

here = path.abspath(path.dirname(__file__))

with open(path.join(here, "README.md"), encoding="utf-8") as readme_file:
readme = readme_file.read()
maffettone marked this conversation as resolved.
Show resolved Hide resolved


with open("requirements.txt") as f:
requirements = f.read().split()

with open('requirements-extras.txt') as f:
extras_require = {'complete': f.read().split()}

fastccd = Extension('fastccd',
sources=['src/fastccdmodule.c',
'src/fastccd.c'],
extra_compile_args=['-fopenmp'],
extra_link_args=['-lgomp'])

image = Extension('image',
sources=['src/imagemodule.c',
'src/image.c'],
extra_compile_args=['-fopenmp'],
extra_link_args=['-lgomp'])

phocount = Extension('phocount',
sources=['src/phocountmodule.c',
'src/phocount.c'],
extra_compile_args=['-fopenmp'],
extra_link_args=['-lgomp'])
with open("requirements-extras.txt") as f:
extras_require = {"complete": f.read().split()}

fastccd = Extension(
"fastccd",
sources=["src/fastccdmodule.c", "src/fastccd.c"],
extra_compile_args=["-fopenmp"],
extra_link_args=["-lgomp"],
)

image = Extension(
"image", sources=["src/imagemodule.c", "src/image.c"], extra_compile_args=["-fopenmp"], extra_link_args=["-lgomp"]
)

phocount = Extension(
"phocount",
sources=["src/phocountmodule.c", "src/phocount.c"],
extra_compile_args=["-fopenmp"],
extra_link_args=["-lgomp"],
)
setup(
name='csxtools',
name="csxtools",
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
author='Brookhaven National Laboratory',
packages=setuptools.find_packages(exclude=['src', 'tests']),
ext_package='csxtools.ext',
author="Brookhaven National Laboratory",
description="Python library for tools to be used at the Coherent Soft X-ray scattering (CSX) beamline at NSLS-II.",
packages=setuptools.find_packages(exclude=["src", "tests"]),
python_requires=">={}".format(".".join(str(n) for n in min_version)),
long_description=readme,
long_description_content_type='text/markdown',
maffettone marked this conversation as resolved.
Show resolved Hide resolved
ext_package="csxtools.ext",
include_dirs=[np.get_include()],
ext_modules=[fastccd, image, phocount],
tests_require=['pytest'],
tests_require=["pytest"],
install_requires=requirements,
extras_require=extras_require,
url='http://github.com/NSLS-II_CSX/csxtools',
keywords='Xray Analysis',
license='BSD'
url="https://github.com/NSLS-II-CSX/csxtools",
keywords="Xray Analysis",
license="BSD",
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Natural Language :: English",
"Programming Language :: Python :: 3",
],
)
Loading