From acd169b6f888f709780fc17a209c9f0deff5957a Mon Sep 17 00:00:00 2001 From: Liu Gaoyong Date: Wed, 10 Dec 2025 14:43:43 +0800 Subject: [PATCH 1/5] Add GitHub Actions workflow for conda publishing --- .github/workflows/conda.yml | 42 +++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 .github/workflows/conda.yml diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml new file mode 100644 index 0000000..bcba7d9 --- /dev/null +++ b/.github/workflows/conda.yml @@ -0,0 +1,42 @@ +name: Publish to conda-forge + +on: + release: + types: [published] + push: + tags: + - "v*" # Alternative: only build for tags. + +jobs: + publish: + runs-on: ubuntu-latest + steps: + + - name: Checkout + uses: actions/checkout@v4.1.0 + + - name: Publish to Anaconda + uses: crabisoft/publish-conda@v1.0.0 + with: + # Specifies a sub directory within the repository containing your meta.yml or conda_build_config files. + # Defaults to 'conda' + # Optional + sub-directory: 'conda' + # Space separated string of conda channels to use during the build. + # Defaults to 'conda-forge' + # Optional + build-channels: 'conda-forge' + # Conda channel where the package will be uploaded. + # Defaults to 'conda-forge' + # Optional + upload-channel: 'conda-forge' + # Space separated string of platforms to build. + # Defaults to "win-64 osx-64 linux-64" + platforms: 'win-64 osx-64 osx-arm64 linux-64' + # true for stable release, else false to indicate a beta version. + # Defaults to true + # Optional + stable : true + # Anaconda access token with read and write API permissions. + # Required + token: ${{ secrets.ANACONDA_TOKEN }} From 5a3a0bc3673af795363d87971580f1f7c6570431 Mon Sep 17 00:00:00 2001 From: LiuGaoyong Date: Wed, 10 Dec 2025 15:05:42 +0800 Subject: [PATCH 2/5] update pytest gh action --- .github/workflows/pytest.yml | 52 ++++++++++++++++++++++++------------ 1 file changed, 35 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ab5b2fd..58ade7b 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -4,7 +4,7 @@ on: pull_request: jobs: - build_wheels: + build_wheels_win: name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }} runs-on: ${{ matrix.os }} strategy: @@ -14,23 +14,11 @@ jobs: - os: windows-latest python: 312 platform_id: win_amd64 - - os: ubuntu-latest - python: 312 - platform_id: manylinux_x86_64 - - os: macos-latest - python: 312 - macos_target: 14 - platform_id: macosx_arm64 - - os: macos-13 - python: 312 - macos_target: 13 - platform_id: macosx_x86_64 steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v5 - name: Provide gfortran (Windows) uses: msys2/setup-msys2@v2 - if: runner.os == 'Windows' id: msys2 with: update: true @@ -40,11 +28,9 @@ jobs: mingw-w64-x86_64-openblas mingw-w64-x86_64-gcc-fortran - uses: actions/setup-python@v5 - if: runner.os == 'Windows' with: python-version: '3.13' - run: pipx run --python 3.13 cibuildwheel==3.1.1 - if: runner.os == 'Windows' shell: msys2 {0} env: CIBW_ARCHS: all @@ -61,7 +47,6 @@ jobs: uv pip install wheelhouse/*.whl cd .venv Scripts/python.exe -m pytest ../tests -vv -s - if: runner.os == 'Windows' shell: msys2 {0} env: PYTHONIOENCODING: utf-8 @@ -72,8 +57,41 @@ jobs: CIBW_BUILD_VERBOSITY: 1 UV_INDEX: https://pypi.org/simple UV_DEFAULT_INDEX: https://pypi.org/simple + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + - run: ls -l wheelhouse/* + shell: bash + + build_wheels_nonwin: + name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: macos-latest + python: 312 + macos_target: 14 + platform_id: macosx_arm64 + - os: macos-13 + python: 312 + macos_target: 13 + platform_id: macosx_x86_64 + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Provide gfortran + uses: fortran-lang/setup-fortran@v1 + with: + compiler: gcc + version: latest + - uses: pypa/cibuildwheel@v3.1.1 + env: + CIBW_ARCHS: all + CIBW_BUILD_VERBOSITY: 1 + UV_INDEX: https://pypi.org/simple + UV_DEFAULT_INDEX: https://pypi.org/simple + CIBW_BEFORE_ALL_MACOS: "brew install openblas" CIBW_BEFORE_ALL_LINUX: "yum install -y openblas-devel" - CIBW_BEFORE_ALL_MACOS: "brew install openblas gfortran" CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos_target }}.0 - run: ls -l wheelhouse/* From 13e167f8dd67978805c759193af8798f3d1712b6 Mon Sep 17 00:00:00 2001 From: LiuGaoyong Date: Wed, 10 Dec 2025 15:38:50 +0800 Subject: [PATCH 3/5] update --- .github/conda/meta.yml | 0 .github/workflows/conda.yml | 4 +- .github/workflows/wheel.yml | 109 +++++++++++++++++++++--------------- 3 files changed, 67 insertions(+), 46 deletions(-) create mode 100644 .github/conda/meta.yml diff --git a/.github/conda/meta.yml b/.github/conda/meta.yml new file mode 100644 index 0000000..e69de29 diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index bcba7d9..ed8e586 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -21,11 +21,11 @@ jobs: # Specifies a sub directory within the repository containing your meta.yml or conda_build_config files. # Defaults to 'conda' # Optional - sub-directory: 'conda' + sub-directory: '.github/conda' # Space separated string of conda channels to use during the build. # Defaults to 'conda-forge' # Optional - build-channels: 'conda-forge' + build-channels: 'conda-forge' # Conda channel where the package will be uploaded. # Defaults to 'conda-forge' # Optional diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 2963e62..118f229 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -9,8 +9,9 @@ on: pull_request: jobs: - build_wheels: - name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }}${{ matrix.manylinux_image }} + + build_wheels_win: + name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }} runs-on: ${{ matrix.os }} strategy: fail-fast: false @@ -36,6 +37,60 @@ jobs: python: 313t platform_id: win_amd64 cibw_enable: cpython-freethreading + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/setup-uv@v5 + - name: Provide gfortran (Windows) + uses: msys2/setup-msys2@v2 + id: msys2 + with: + update: true + cache: true + path-type: inherit + install: >- + mingw-w64-x86_64-openblas + mingw-w64-x86_64-gcc-fortran + - uses: actions/setup-python@v5 + with: + python-version: '3.13' + - run: pipx run --python 3.13 cibuildwheel==3.1.1 + shell: msys2 {0} + env: + CIBW_ARCHS: all + CIBW_BUILD_VERBOSITY: 1 + CIBW_TEST_COMMAND_WINDOWS: "" + UV_INDEX: https://pypi.org/simple + UV_DEFAULT_INDEX: https://pypi.org/simple + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + - run: | + mv wheelhouse dist + pipx run --python 3.13 delvewheel==1.10 repair dist/*.whl -vv + ls -l wheelhouse/* + uv sync + uv pip install wheelhouse/*.whl + cd .venv + Scripts/python.exe -m pytest ../tests -vv -s + shell: msys2 {0} + env: + PYTHONIOENCODING: utf-8 + - uses: pypa/cibuildwheel@v3.1.1 + if: runner.os != 'Windows' + env: + CIBW_ARCHS: all + CIBW_BUILD_VERBOSITY: 1 + UV_INDEX: https://pypi.org/simple + UV_DEFAULT_INDEX: https://pypi.org/simple + CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + - run: ls -l wheelhouse/* + shell: bash + + build_wheels_nonwin: + name: Build wheels for cp${{ matrix.python }}-${{ matrix.platform_id }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: # linux-64 for manylinux2014 - os: ubuntu-latest python: 39 @@ -195,57 +250,23 @@ jobs: steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v5 - - name: Provide gfortran (Windows) - uses: msys2/setup-msys2@v2 - if: runner.os == 'Windows' - id: msys2 + - name: Provide gfortran + uses: fortran-lang/setup-fortran@v1 with: - update: true - cache: true - path-type: inherit - install: >- - mingw-w64-x86_64-openblas - mingw-w64-x86_64-gcc-fortran - - uses: actions/setup-python@v5 - if: runner.os == 'Windows' - with: - python-version: "3.13" - - run: pipx run --python 3.13 cibuildwheel==3.1.1 - if: runner.os == 'Windows' - shell: msys2 {0} - env: - CIBW_ARCHS: all - CIBW_BUILD_VERBOSITY: 1 - CIBW_TEST_COMMAND_WINDOWS: "" - CIBW_ENABLE: ${{ matrix.cibw_enable }} - CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} - UV_DEFAULT_INDEX: https://pypi.org/simple - UV_INDEX: https://pypi.org/simple - - run: | - mv wheelhouse dist - pipx run --python 3.13 delvewheel==1.10 repair dist/*.whl -vv - if: runner.os == 'Windows' - shell: msys2 {0} + compiler: gcc + version: latest - uses: pypa/cibuildwheel@v3.1.1 - if: runner.os != 'Windows' env: CIBW_ARCHS: all CIBW_BUILD_VERBOSITY: 1 - CIBW_ENABLE: ${{ matrix.cibw_enable }} + UV_INDEX: https://pypi.org/simple + UV_DEFAULT_INDEX: https://pypi.org/simple + CIBW_BEFORE_ALL_MACOS: "brew install openblas" CIBW_BEFORE_ALL_LINUX: "yum install -y openblas-devel" - CIBW_BEFORE_ALL_MACOS: "brew install openblas gfortran" - CIBW_ENVIRONMENT_MACOS: CC=gcc-13 CXX=g++-13 FC=gfortran-13 CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} - CIBW_MANYLINUX_X86_64_IMAGE: ${{ matrix.manylinux_image }} MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos_target }}.0 - UV_DEFAULT_INDEX: https://pypi.org/simple - UV_INDEX: https://pypi.org/simple - run: ls -l wheelhouse/* shell: bash - - uses: actions/upload-artifact@v4 - with: - name: cibw-wheels-cp${{ matrix.python }}-${{ matrix.platform_id }}${{ matrix.manylinux_image }}-${{ strategy.job-index }} - path: ./wheelhouse/*.whl build_sdist: name: Build source distribution @@ -260,7 +281,7 @@ jobs: path: dist/*.tar.gz upload_pypi: - needs: [build_wheels, build_sdist] + needs: [build_wheels_win, build_wheels_nonwin, build_sdist] runs-on: ubuntu-latest if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags/v') permissions: From 2a0f03e54528cdb230f5da1e9abc6250ca544469 Mon Sep 17 00:00:00 2001 From: LiuGaoyong Date: Wed, 10 Dec 2025 15:59:04 +0800 Subject: [PATCH 4/5] update --- .github/conda/meta.yml | 47 ++++++++++++++++++++++++++++++++++++ .github/workflows/conda.yml | 2 +- .github/workflows/pytest.yml | 2 +- .github/workflows/wheel.yml | 2 ++ 4 files changed, 51 insertions(+), 2 deletions(-) diff --git a/.github/conda/meta.yml b/.github/conda/meta.yml index e69de29..47b6e32 100644 --- a/.github/conda/meta.yml +++ b/.github/conda/meta.yml @@ -0,0 +1,47 @@ +schema_version: 1 + +context: + name: pygfn0 + version: 0.0.3 + +package: + name: ${{ name|lower }} + version: ${{ version }} + +source: + url: https://files.pythonhosted.org/packages/98/bb/85b74f75339e6e60e4a60cf0b4a7c2b7bbb48ebd54ebc87242eb3264ab26/pygfn0-0.0.3.tar.gz + sha256: 2cff08bd42754251088c9b3cd6682669fd3e11a150e3f83f6691a490a50c1af0 + +build: + number: 0 + noarch: python + script: ${{ PYTHON }} -m pip install . -vv --no-deps --no-build-isolation + +requirements: + host: + - python >=3.9 + - scikit-build-core >=0.11 + - charset_normalizer + - f2py-cmake + - numpy + - pip + run: + - python >=3.9 + - ase + - numpy + - typing_extensions + +tests: + - python: + imports: + - pygfn0 + pip_check: true + +about: + summary: A Python Library for GFN-FF. + license: GPL-3.0-only + license_file: LICENSE + +extra: + recipe-maintainers: + - LiuGaoyong diff --git a/.github/workflows/conda.yml b/.github/workflows/conda.yml index ed8e586..a820f37 100644 --- a/.github/workflows/conda.yml +++ b/.github/workflows/conda.yml @@ -39,4 +39,4 @@ jobs: stable : true # Anaconda access token with read and write API permissions. # Required - token: ${{ secrets.ANACONDA_TOKEN }} + token: Li-958513a5-2c9d-4e0a-a28b-67087cf56623 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 58ade7b..c96c619 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -68,7 +68,7 @@ jobs: fail-fast: false matrix: include: - - os: macos-latest + - os: macos-14 python: 312 macos_target: 14 platform_id: macosx_arm64 diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 118f229..28dfa32 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -81,6 +81,7 @@ jobs: UV_INDEX: https://pypi.org/simple UV_DEFAULT_INDEX: https://pypi.org/simple CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} + CIBW_ENABLE: ${{ matrix.cibw_enable }} - run: ls -l wheelhouse/* shell: bash @@ -265,6 +266,7 @@ jobs: CIBW_BEFORE_ALL_LINUX: "yum install -y openblas-devel" CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} MACOSX_DEPLOYMENT_TARGET: ${{ matrix.macos_target }}.0 + CIBW_ENABLE: ${{ matrix.cibw_enable }} - run: ls -l wheelhouse/* shell: bash From a5ba410481d0f7a6798c9b52d8f804e691542fd1 Mon Sep 17 00:00:00 2001 From: LiuGaoyong Date: Wed, 10 Dec 2025 16:10:08 +0800 Subject: [PATCH 5/5] update --- .github/workflows/wheel.yml | 9 --------- .python-version | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 28dfa32..8a3d351 100644 --- a/.github/workflows/wheel.yml +++ b/.github/workflows/wheel.yml @@ -33,10 +33,6 @@ jobs: - os: windows-latest python: 313 platform_id: win_amd64 - - os: windows-latest - python: 313t - platform_id: win_amd64 - cibw_enable: cpython-freethreading steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v5 @@ -66,10 +62,6 @@ jobs: mv wheelhouse dist pipx run --python 3.13 delvewheel==1.10 repair dist/*.whl -vv ls -l wheelhouse/* - uv sync - uv pip install wheelhouse/*.whl - cd .venv - Scripts/python.exe -m pytest ../tests -vv -s shell: msys2 {0} env: PYTHONIOENCODING: utf-8 @@ -81,7 +73,6 @@ jobs: UV_INDEX: https://pypi.org/simple UV_DEFAULT_INDEX: https://pypi.org/simple CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }} - CIBW_ENABLE: ${{ matrix.cibw_enable }} - run: ls -l wheelhouse/* shell: bash diff --git a/.python-version b/.python-version index 3b49f91..e4fba21 100644 --- a/.python-version +++ b/.python-version @@ -1 +1 @@ -cpython@3.12 +3.12