diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml deleted file mode 100644 index e4ee0bb..0000000 --- a/.github/workflows/build.yml +++ /dev/null @@ -1,76 +0,0 @@ -name: Builds -on: - release: - types: [published] - workflow_dispatch: {} - -jobs: - build: - name: Building distribution - strategy: - matrix: - include: - - os: ubuntu-latest - python: '3.8' - numpy: '1.16' - source: false - - os: ubuntu-latest - python: '3.9' - numpy: '1.19' - source: false - - os: ubuntu-latest - python: '3.10' - numpy: '1.21' - source: true - - os: macos-latest - python: '3.8' - numpy: '1.16' - source: false - - os: macos-latest - python: '3.9' - numpy: '1.19' - source: false - - os: macos-latest - python: '3.10' - numpy: '1.21' - source: false - - os: windows-latest - python: '3.8' - numpy: '1.16' - source: false - - os: windows-latest - python: '3.9' - numpy: '1.19' - source: false - - os: windows-latest - python: '3.10' - numpy: '1.21' - source: false - - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -l {0} - - steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: fastpdb-dev - auto-update-conda: true - python-version: ${{ matrix.python }} - - name: Installing dependencies - run: conda install -c conda-forge numpy=$NUMPY_VERSION maturin - env: - NUMPY_VERSION: ${{ matrix.numpy }} - - if: ${{ !matrix.source }} - name: Building distribution - run: maturin build --release --no-sdist -i python -o dist - - if: ${{ matrix.source }} - name: Building distribution - run: maturin build --release -i python -o dist - - uses: actions/upload-artifact@v2 - with: - name: fastpdb distribution - path: dist//* - if-no-files-found: error diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 6c42a30..0000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,60 +0,0 @@ -name: Tests - -on: [push, pull_request] - -jobs: - test-simple: - name: Testing - strategy: - matrix: - include: - - os: ubuntu-latest - python: '3.8' - numpy: '1.16' - - os: ubuntu-latest - python: '3.9' - numpy: '1.19' - - os: ubuntu-latest - python: '3.10' - numpy: '1.21' - - os: macos-latest - python: '3.8' - numpy: '1.16' - - os: macos-latest - python: '3.9' - numpy: '1.19' - - os: macos-latest - python: '3.10' - numpy: '1.21' - - os: windows-latest - python: '3.8' - numpy: '1.16' - - os: windows-latest - python: '3.9' - numpy: '1.19' - - os: windows-latest - python: '3.10' - numpy: '1.21' - - runs-on: ${{ matrix.os }} - defaults: - run: - shell: bash -l {0} - - steps: - - uses: actions/checkout@v2 - - uses: conda-incubator/setup-miniconda@v2 - with: - activate-environment: fastpdb-test - auto-update-conda: true - python-version: ${{ matrix.python }} - - name: Installing dependencies - run: conda install -c conda-forge numpy=$NUMPY_VERSION "biotite>=0.33" maturin pytest - env: - NUMPY_VERSION: ${{ matrix.numpy }} - - name: Building distribution - run: maturin build --release -i python -o dist - - name: Installing distribution - run: pip install .//dist//*.whl - - name: Testing code - run: pytest --assert=plain diff --git a/.github/workflows/test_and_deploy.yml b/.github/workflows/test_and_deploy.yml new file mode 100644 index 0000000..0643323 --- /dev/null +++ b/.github/workflows/test_and_deploy.yml @@ -0,0 +1,92 @@ +--- +name: "CI & CD" + +on: + workflow_dispatch: + pull_request: + release: + types: + - published + + +jobs: + wheels: + name: "Build & test wheel" + strategy: + matrix: + os: [ubuntu-latest, windows-latest, macos-latest] + py-version: ["3.9", "3.10", "3.11"] + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.py-version }} + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + override: true + - name: Install dependencies + run: pip install "maturin>=0.14,<0.15" "oldest-supported-numpy" pytest + - name: Build wheel + run: maturin build --release -i python -o dist + - name: Install wheel + run: pip install .//dist//*.whl + - name: Test wheel + run: pytest --assert=plain + - uses: actions/upload-artifact@v3 + with: + path: .//dist//*.whl + + + sdist: + name: Build & test source distribution + runs-on: ubuntu-latest + defaults: + run: + shell: bash + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-python@v3 + with: + python-version: "3.11" + - name: Install dependencies + run: pip install "maturin>=0.14,<0.15" pytest + - name: Build source distribution + run: maturin sdist -o dist + - name: Install source distribution + run: pip install .//dist//*.tar.gz + - name: Test source distribution + run: pytest --assert=plain + - uses: actions/upload-artifact@v3 + with: + path: dist//*.tar.gz + + + upload: + name: Upload to GitHub Releases & PyPI + permissions: + contents: write + needs: [wheels, sdist] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v3 + with: + name: artifact + path: dist + - name: List distributions to be uploaded + run: ls dist + - name: Upload to GitHub Releases + uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 + if: github.event_name == 'release' && github.event.action == 'published' + with: + files: dist//* + - name: Upload to PyPI + uses: pypa/gh-action-pypi-publish@c7f29f7adef1a245bd91520e94867e5c6eedddcc + if: github.event_name == 'release' && github.event.action == 'published' + with: + password: ${{ secrets.PYPI_TOKEN }} diff --git a/Cargo.toml b/Cargo.toml index 4e45c60..f6af6f0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,11 +1,8 @@ [package] name = "fastpdb" -version = "1.0.1" +version = "1.1.0" edition = "2018" -[package.metadata.maturin] -python-source = "python-src" - [dependencies] numpy = "0.14" ndarray = "0.15" diff --git a/pyproject.toml b/pyproject.toml index afd5831..a8eff25 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "fastpdb" -version = "1.0.1" +version = "1.1.0" description = "A high performance drop-in replacement for Biotite's PDBFile." readme = "README.rst" requires-python = ">=3.7" @@ -31,7 +31,13 @@ dependencies = [ homepage = "https://github.com/biotite-dev/fastpdb" repository = "https://github.com/biotite-dev/fastpdb" +[tool.maturin] +exclude = ["*.svg", "tests/"] +python-source = "python-src" [build-system] -requires = ["maturin>=0.14,<0.15"] +requires = [ + "maturin>=0.14,<0.15", + "oldest-supported-numpy" +] build-backend = "maturin" diff --git a/python-src/fastpdb/__init__.py b/python-src/fastpdb/__init__.py index 5b9508d..f3ee29b 100644 --- a/python-src/fastpdb/__init__.py +++ b/python-src/fastpdb/__init__.py @@ -1,7 +1,7 @@ __name__ = "fastpdb" __author__ = "Patrick Kunzmann" __all__ = ["PDBFile"] -__version__ = "1.0.1" +__version__ = "1.1.0" import os import numpy as np