Skip to content

Commit

Permalink
Merge pull request ccsb-scripps#340 from rwxayheee/test_workflow
Browse files Browse the repository at this point in the history
Upgrade actions/download-artifact to v4; Explicitly Check PEP 440 Compliance; Fix Workflows, Makefiles, and Boost Usage
  • Loading branch information
diogomart authored Sep 7, 2024
2 parents 912b51b + 4c20237 commit ee44699
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 30 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/compile-binaries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ on:

jobs:
compile_binaries:
name: Build wheels on ${{ matrix.os }}
name: Compile binaries on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
Expand All @@ -33,6 +33,9 @@ jobs:
- os: ubuntu-latest
arch: aarch64
- os: macos-latest
arch: x86_64
- os: macos-latest
arch: aarch64
- os: windows-latest

steps:
Expand Down Expand Up @@ -61,8 +64,6 @@ jobs:
run: |
cd /vina/build/linux/release
make
mv vina vina-${{ matrix.arch }}
mv vina_split vina_split-${{ matrix.arch }}
- name: Compile Vina for macOS
if: matrix.os == 'macos-latest'
run: |
Expand All @@ -80,13 +81,8 @@ jobs:
.\compile.bat
shell: powershell
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: binaries
name: binaries-${{ matrix.os }}${{ matrix.arch }}
path: |
./**/release/vina
./**/release/vina-${{ matrix.arch }}
./**/release/vina_split
./**/release/vina_split-${{ matrix.arch }}
./**/release/vina.exe
./**/release/vina_split.exe
./**/release/vina*
20 changes: 13 additions & 7 deletions .github/workflows/pypi-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
include:
- os: ubuntu-latest
arch: x86_64

steps:
- name: Checkout
Expand Down Expand Up @@ -61,13 +63,17 @@ jobs:
env:
CIBW_SKIP: pp*
CIBW_ARCHS: auto64
CIBW_ARCHS_LINUX: auto64 aarch64
CIBW_ARCHS_LINUX: ${{ matrix.arch }}
CIBW_BEFORE_BUILD: |
pip install --upgrade pip setuptools
CIBW_BEFORE_ALL_MACOS: |
brew install boost swig
CIBW_MANYLINUX_X86_64_IMAGE: manylinux2014
CIBW_BEFORE_ALL_LINUX: |
sed -i s/mirror.centos.org/vault.centos.org/g /etc/yum.repos.d/*.repo
sed -i s/^#.*baseurl=http/baseurl=http/g /etc/yum.repos.d/*.repo
sed -i s/^mirrorlist=http/#mirrorlist=http/g /etc/yum.repos.d/*.repo
yum clean all && yum -y update
yum install -y wget python-devel pcre-devel
# Install SWIG
wget https://downloads.sourceforge.net/swig/swig-4.0.2.tar.gz
Expand All @@ -87,9 +93,9 @@ jobs:
rm -rf boost_1_*
rm -rf swig-4*
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dist
name: wheels
path: ./wheelhouse/*.whl

build_sdist:
Expand Down Expand Up @@ -117,9 +123,9 @@ jobs:
cd ./build/python
python setup.py sdist
- name: Upload artifacts for inspection
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: dist
name: sdist
path: ./build/python/dist/*.tar.gz

upload_pypi:
Expand All @@ -139,7 +145,7 @@ jobs:
run: |
python -m pip install --upgrade pip setuptools twine
- name: Download artifacts
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: dist
path: ./dist
Expand Down
2 changes: 1 addition & 1 deletion build/linux/release/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BASE=/usr/local
BASE=/usr
BOOST_VERSION=
BOOST_INCLUDE = $(BASE)/include
C_PLATFORM=-static -pthread
Expand Down
2 changes: 1 addition & 1 deletion build/mac/release/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
BASE=/usr/local
BASE=$(shell brew --prefix)
BOOST_VERSION=
BOOST_INCLUDE = $(BASE)/include
C_PLATFORM=-pthread
Expand Down
2 changes: 1 addition & 1 deletion build/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[build-system]
requires = ["setuptools>=50.3", "wheel"]
requires = ["setuptools>=50.3", "wheel", "packaging"]
build-backend = "setuptools.build_meta"
19 changes: 16 additions & 3 deletions build/python/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from distutils.util import convert_path
from distutils.sysconfig import customize_compiler
from distutils.ccompiler import show_compilers

from packaging.version import Version, InvalidVersion

# Path to the directory that contains this setup.py file.
base_dir = os.path.abspath(os.path.dirname(__file__))
Expand Down Expand Up @@ -53,13 +53,25 @@ def find_version():
3. __init__.py (as failback)
"""

def is_compliant(version_str):
try:
# Attempt to parse the version string using packaging's Version class
Version(version_str)
return True
except InvalidVersion:
# If parsing fails, the version is not PEP 440 compliant
print(f"{version_str} is not PEP 440 compliant")
return False

version_file = os.path.join(base_dir, 'vina', 'version.py')
if os.path.isfile(version_file):
with open(version_file) as f:
version = f.read().strip()

print('Version found: %s (from version.py)' % version)
return version
if is_compliant(version):
return version

try:
git_output = subprocess.check_output(['git', 'describe', '--abbrev=7', '--dirty=@mod', '--always', '--tags'])
Expand All @@ -70,7 +82,8 @@ def find_version():
version = git_output.replace('-', '.dev', 1).replace('@', '-', 1).replace('-', '+', 1).replace('-','')

print('Version found %s (from git describe)' % version)
return version
if is_compliant(version):
return version
except:
pass

Expand Down
4 changes: 1 addition & 3 deletions src/lib/vina.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@
#include <boost/log/trivial.hpp>
#include <boost/log/expressions.hpp>
#include <boost/program_options.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/convenience.hpp> // filesystem::basename
#include <boost/filesystem.hpp>
#include <boost/thread/thread.hpp> // hardware_concurrency // FIXME rm ?
#include <boost/algorithm/string.hpp>
//#include <openbabel/mol.h>
Expand Down
4 changes: 1 addition & 3 deletions src/split/split.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
#include <fstream> // getline?
#include <cmath> // for ceila
#include <boost/program_options.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/filesystem/exception.hpp>
#include <boost/filesystem/convenience.hpp> // filesystem::basename
#include <boost/filesystem.hpp>

#include "file.h"
#include "parse_error.h"
Expand Down

0 comments on commit ee44699

Please sign in to comment.