From 5794a91ab6026ce8da7b4f06644d7840d13a0c51 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Mon, 30 Sep 2024 16:30:04 -0400 Subject: [PATCH 01/13] Add pypi release YAML file --- .github/workflows/pypi_release.yaml | 114 ++++++++++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 .github/workflows/pypi_release.yaml diff --git a/.github/workflows/pypi_release.yaml b/.github/workflows/pypi_release.yaml new file mode 100644 index 00000000..d63fefe9 --- /dev/null +++ b/.github/workflows/pypi_release.yaml @@ -0,0 +1,114 @@ +# This workflow is adapted from: +# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +# Changes made: +# - Removed emoticons +# - Updated some actions to more recent versions +# - Customized for the qc-gbasis repository + +name: release +on: + push: + tags: + # Trigger on version tags (e.g., v1.0.0) + - "v[0-9].[0-9].[0-9]*" + - "[0-9].[0-9].[0-9]*" + # Trigger on pre-release tags (e.g., v1.0.0-alpha.1) + - "v[0-9].[0-9].[0-9]*-*" + - "[0-9].[0-9].[0-9]*-*" + +env: + # The name of the package to be published to PyPI and TestPyPI. + PYPI_NAME: qc-gbasis + +jobs: + build: + name: Build distribution + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.11" + - name: Install pypa/build + run: >- + python -m pip install build + - name: Build package + run: >- + python -m build + - name: Store the distribution packages + uses: actions/upload-artifact@v4 + with: + name: python-package-distributions + path: dist/ + + # place holder for pypi release + + github-release: + name: Sign the Python distribution with Sigstore and upload them to GitHub Release + needs: + - publish-to-pypi + runs-on: ubuntu-latest + + permissions: + contents: write + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Sign the dists with Sigstore + uses: sigstore/gh-action-sigstore-python@v3.0.0 + with: + inputs: >- + ./dist/*.tar.gz + ./dist/*.whl + - name: Create GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release create + '${{ github.ref_name }}' + --repo '${{ github.repository }}' + --notes "" + - name: Upload artifact signatures to GitHub Release + env: + GITHUB_TOKEN: ${{ github.token }} + run: >- + gh release upload + '${{ github.ref_name }}' dist/** + --repo '${{ github.repository }}' + + publish-to-testpypi: + name: Publish Python distribution to TestPyPI + if: ${{ github.ref == 'refs/heads/main' && github.repository_owner == 'theochem' }} + needs: + - build + runs-on: ubuntu-latest + + environment: + name: testpypi + url: https://test.pypi.org/project/${{ env.PYPI_NAME }} + + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + - name: Publish distribution to TestPyPI + uses: pypa/gh-action-pypi-publish@release/v1 + with: + repository-url: https://test.pypi.org/legacy/ + env: + TWINE_USERNAME: "__token__" + TWINE_PASSWORD: ${{ secrets.TEST_PYPI_TOKEN }} From fc20755a8579ad0365e5adb6de3ad16252491009 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Mon, 30 Sep 2024 16:31:18 -0400 Subject: [PATCH 02/13] Use `iodata` from PyPI release --- pyproject.toml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 949a3170..a61e0a93 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,6 +37,7 @@ dependencies = [ "scipy>=1.11.1", "importlib_resources", "sympy", + "qc-iodata>=1.0.0a5", ] dynamic = ["version"] @@ -64,9 +65,9 @@ doc = [ "docutils==0.16", # Needed to show bullet points in sphinx_rtd_theme "nbsphinx-link" ] -iodata = [ - "qc-iodata@git+https://github.com/theochem/iodata.git@main" -] +# iodata = [ +# "qc-iodata@git+https://github.com/theochem/iodata.git@main" +# ] pyscf = [ "pyscf>=1.6.1" ] From 8d236cb9ed026f91340447c1920a7b38ddd42276 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Mon, 30 Sep 2024 16:32:42 -0400 Subject: [PATCH 03/13] Update the installation of `iodata` in tox.ini --- tox.ini | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tox.ini b/tox.ini index de7486d4..77262d85 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,8 @@ deps = {[testenv]deps} Cython # dependency of iodata commands = - pip install git+https://github.com/theochem/iodata.git@master + # pip install git+https://github.com/theochem/iodata.git@main + pip install qc-iodata coverage run --rcfile=tox.ini -m pytest tests/test_wrappers.py ignore_errors = true From ad9cca15a0a0411a32fc8d1ce36b8a7942057673 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Mon, 30 Sep 2024 16:42:31 -0400 Subject: [PATCH 04/13] Add MacOS testing runner --- .github/workflows/pytest.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index bfe74575..d1820364 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - os: ["ubuntu-latest", "windows-latest"] + os: ["ubuntu-latest", "windows-latest", "macos-latest"] py: ["3.9", "3.10", "3.11", "3.12"] steps: @@ -37,7 +37,8 @@ jobs: - name: Install development version run: | # Need editable mode in order to include the test files - pip install -e .[dev,iodata] + # pip install -e .[dev,iodata] + pip install -e .[dev,pyscf] - name: Install Libcint library if: ${{ matrix.os != 'windows-latest' }} From d7580e6a7b75420d34a1fef7667f1619b09ffa52 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Mon, 30 Sep 2024 16:55:35 -0400 Subject: [PATCH 05/13] Update configurations of website building and pytest --- .github/workflows/main.yml | 10 ++++++---- .github/workflows/pytest.yaml | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0bc23f5a..fa4bbc9f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -5,18 +5,20 @@ on: push: branches: - master + - main - website pull_request: types: [opened, synchronize, reopened, closed] branches: - main + - master # If your git repository has the Jupyter Book within some-subfolder next to # unrelated files, you can make this run only if a file within that specific # folder has been modified. # - #paths: - #- book/ + # paths: + # - book/ # This job installs dependencies, builds the book, and pushes it to `gh-pages` jobs: @@ -32,7 +34,7 @@ jobs: # Install dependencies - name: Set up Python 3.11 - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: 3.11 @@ -66,7 +68,7 @@ jobs: # only push to gh-pages if the master branch has been updated - name: GitHub Pages Action # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/_build/html diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index d1820364..8d8febfd 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -18,7 +18,7 @@ jobs: strategy: matrix: - os: ["ubuntu-latest", "windows-latest", "macos-latest"] + os: ["ubuntu-latest", "windows-latest"] py: ["3.9", "3.10", "3.11", "3.12"] steps: @@ -40,7 +40,7 @@ jobs: # pip install -e .[dev,iodata] pip install -e .[dev,pyscf] - - name: Install Libcint library + - name: Install Libcint library in Ubuntu if: ${{ matrix.os != 'windows-latest' }} run: | echo "${{ matrix.os }}" From 047ff8231f38b8d7cc88b9af90fdf809835dec64 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Mon, 30 Sep 2024 16:57:12 -0400 Subject: [PATCH 06/13] Rename yaml file for building website --- .github/workflows/{main.yml => build_website.yaml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{main.yml => build_website.yaml} (100%) diff --git a/.github/workflows/main.yml b/.github/workflows/build_website.yaml similarity index 100% rename from .github/workflows/main.yml rename to .github/workflows/build_website.yaml From 56be5cbddfea42bb25cbbc887b51fc5ae0921387 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 12:38:11 -0400 Subject: [PATCH 07/13] Use `iodata` as an optional dependency --- pyproject.toml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a61e0a93..7dd30f79 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,6 @@ dependencies = [ "scipy>=1.11.1", "importlib_resources", "sympy", - "qc-iodata>=1.0.0a5", ] dynamic = ["version"] @@ -68,6 +67,9 @@ doc = [ # iodata = [ # "qc-iodata@git+https://github.com/theochem/iodata.git@main" # ] +iodata = [ + "qc-iodata>=1.0.0a5" +] pyscf = [ "pyscf>=1.6.1" ] From bea5a88ddcbb94ef3ad266008b3e52fc81ede174 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 12:39:33 -0400 Subject: [PATCH 08/13] Set `iodata` an optional dependency --- .github/workflows/pytest.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pytest.yaml b/.github/workflows/pytest.yaml index 8d8febfd..1888a085 100644 --- a/.github/workflows/pytest.yaml +++ b/.github/workflows/pytest.yaml @@ -37,8 +37,7 @@ jobs: - name: Install development version run: | # Need editable mode in order to include the test files - # pip install -e .[dev,iodata] - pip install -e .[dev,pyscf] + pip install -e .[dev,iodata] - name: Install Libcint library in Ubuntu if: ${{ matrix.os != 'windows-latest' }} From d66f1b4482be9114007f62c9f91b134abb5e2473 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 12:51:22 -0400 Subject: [PATCH 09/13] Use actions-gh-pages v4.0.0 --- .github/workflows/build_website.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build_website.yaml b/.github/workflows/build_website.yaml index fa4bbc9f..616afa50 100644 --- a/.github/workflows/build_website.yaml +++ b/.github/workflows/build_website.yaml @@ -67,8 +67,8 @@ jobs: # inspired by https://github.com/orgs/community/discussions/26724 # only push to gh-pages if the master branch has been updated - name: GitHub Pages Action - # if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} - uses: peaceiris/actions-gh-pages@v4 + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + uses: peaceiris/actions-gh-pages@v4.0.0 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./website/_build/html From 1f00c4f03886e7ade8a7665827c35484410ee5af Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 12:57:21 -0400 Subject: [PATCH 10/13] Update the PyPI release YAML file --- .github/workflows/pypi_release.yaml | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/.github/workflows/pypi_release.yaml b/.github/workflows/pypi_release.yaml index d63fefe9..859524c2 100644 --- a/.github/workflows/pypi_release.yaml +++ b/.github/workflows/pypi_release.yaml @@ -45,7 +45,27 @@ jobs: name: python-package-distributions path: dist/ - # place holder for pypi release + publish-to-pypi: + name: Publish Python distribution to PyPI + # only publish to PyPI on tag pushes + if: startsWith(github.ref, 'refs/tags/') + needs: + - build + runs-on: ubuntu-latest + environment: + name: pypi + url: https://pypi.org/project/${{ env.PYPI_NAME }} + permissions: + id-token: write + + steps: + - name: Download all the dists + uses: actions/download-artifact@v4 + with: + name: python-package-distributions + path: dist/ + # - name: Publish distribution to PyPI + # uses: pypa/gh-action-pypi-publish@release/v1 github-release: name: Sign the Python distribution with Sigstore and upload them to GitHub Release From 3814b20c387cc83ec6a5a9fcec1242fce5d05028 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 13:02:41 -0400 Subject: [PATCH 11/13] Update the GitHub Action workflow name --- .github/workflows/pypi_release.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pypi_release.yaml b/.github/workflows/pypi_release.yaml index 859524c2..c4b48920 100644 --- a/.github/workflows/pypi_release.yaml +++ b/.github/workflows/pypi_release.yaml @@ -5,7 +5,7 @@ # - Updated some actions to more recent versions # - Customized for the qc-gbasis repository -name: release +name: PyPI Release on: push: tags: From a4a59c327e033e2a4d0e84d4961b6f489a90b952 Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 15:42:30 -0400 Subject: [PATCH 12/13] Support actual PyPI release --- .github/workflows/pypi_release.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pypi_release.yaml b/.github/workflows/pypi_release.yaml index c4b48920..534d5bb5 100644 --- a/.github/workflows/pypi_release.yaml +++ b/.github/workflows/pypi_release.yaml @@ -64,8 +64,8 @@ jobs: with: name: python-package-distributions path: dist/ - # - name: Publish distribution to PyPI - # uses: pypa/gh-action-pypi-publish@release/v1 + - name: Publish distribution to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 github-release: name: Sign the Python distribution with Sigstore and upload them to GitHub Release From fa42ed77197d993c656edcce6aa8f7b62ac41c7c Mon Sep 17 00:00:00 2001 From: Fanwang Meng Date: Tue, 1 Oct 2024 16:02:42 -0400 Subject: [PATCH 13/13] Update the badges in README.md --- README.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index f09978c0..61e68529 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,12 @@ # GBasis -[![pytest](https://github.com/theochem/gbasis/actions/workflows/pytest.yaml/badge.svg)](https://github.com/theochem/gbasis/actions/workflows/pytest.yaml) +[![This project supports Python 3.9+](https://img.shields.io/badge/Python-3.9+-blue.svg)](https://python.org/downloads) +[![pytest](https://github.com/theochem/gbasis/actions/workflows/pytest.yaml/badge.svg?branch=master)](https://github.com/theochem/gbasis/actions/workflows/pytest.yaml) +[![codecov](https://codecov.io/gh/theochem/gbasis/graph/badge.svg?token=QPUfAWj7vf)](https://codecov.io/gh/theochem/gbasis) [![PyPI](https://img.shields.io/pypi/v/qc-gbasis.svg)](https://pypi.python.org/pypi/qc-gbasis/) ![Version](https://img.shields.io/pypi/pyversions/qc-gbasis.svg) ![License](https://img.shields.io/github/license/theochem/gbasis) - - +[![documentation](https://github.com/theochem/gbasis/actions/workflows/build_website.yaml/badge.svg?branch=master)](https://github.com/theochem/gbasis/actions/workflows/build_website.yaml) ## About