diff --git a/.github/conda/meta.yml b/.github/conda/meta.yml new file mode 100644 index 0000000..47b6e32 --- /dev/null +++ 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 new file mode 100644 index 0000000..a820f37 --- /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: '.github/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: Li-958513a5-2c9d-4e0a-a28b-67087cf56623 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index ab5b2fd..c96c619 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-14 + 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/* diff --git a/.github/workflows/wheel.yml b/.github/workflows/wheel.yml index 2963e62..8a3d351 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 @@ -32,10 +33,56 @@ 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 + - 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/* + 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 +242,24 @@ 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 + CIBW_ENABLE: ${{ matrix.cibw_enable }} - 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 +274,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: 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