Update release date in CITATION.cff #204
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Build wheels for many platforms, use cibuildwheel | |
| # see: https://github.com/pypa/cibuildwheel | |
| name: Build wheels | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - "nlpo3-python/**" | |
| - ".github/workflows/build-python-wheels.yml" | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - "nlpo3-python/**" | |
| - ".github/workflows/build-python-wheels.yml" | |
| release: | |
| types: [published] | |
| workflow_dispatch: {} # manual run | |
| jobs: | |
| echo_github_env: | |
| name: Echo env variables | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: | | |
| echo "github.event.action : ${{ github.event.action }}" | |
| echo "github.event_name : ${{ github.event_name }}" | |
| echo "github.ref : ${{ github.ref }}" | |
| echo "github.ref_type : ${{ github.ref_type }}" | |
| echo "github.event.ref : ${{ github.event.ref }}" | |
| # Check whether to build the wheels and the source tarball | |
| check_build_trigger: | |
| name: Check build trigger | |
| runs-on: ubuntu-latest | |
| # Not for forks | |
| if: github.repository == 'pythainlp/nlpo3' | |
| outputs: | |
| build: ${{ steps.check_build_trigger.outputs.build }} | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| with: | |
| ref: ${{ github.event.pull_request.head.sha || github.sha }} | |
| - id: check_build_trigger | |
| name: Check build trigger | |
| run: bash build_tools/github/check_build_trigger.sh | |
| # To trigger the build steps, add "[cd build]" to commit message | |
| build_wheels: | |
| name: Build ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| needs: check_build_trigger | |
| if: needs.check_build_trigger.outputs.build | |
| strategy: | |
| fail-fast: false # If false, all jobs continue even if one fails | |
| matrix: | |
| os: [macos-latest, ubuntu-latest, windows-latest] | |
| python-version: ["3.14"] # Check with PyO3's maximum supported version | |
| # cibuildwheel will manage multiple Python versions internally | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| cache: "pip" | |
| - name: Install Python dependencies | |
| run: python -m pip install --upgrade pip | |
| - name: Setup Rust toolchain | |
| if: startsWith(matrix.os, 'ubuntu-') == false | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| # For Linux, Rust will be installed inside a cibuildwheel container later | |
| - name: Setup rustup target | |
| if: startsWith(matrix.os, 'macos-') | |
| run: rustup target add x86_64-apple-darwin | |
| # For cross-compile x86 on GitHub arm64 runner | |
| - name: Build Python wheels | |
| uses: pypa/cibuildwheel@v3.3.1 | |
| with: | |
| package-dir: nlpo3-python | |
| output-dir: wheelhouse | |
| env: | |
| # See CIBW_BUILD, CIBW_SKIP, CIBW_ARCHS and other build selectors at: | |
| # https://cibuildwheel.readthedocs.io/en/stable/options/#build-skip | |
| CIBW_ENABLE: "graalpy pypy" # Enable GraalPy and PyPy builds | |
| CIBW_BUILD: "cp* gp* pp*" # Build for CPython, GraalPy and PyPy | |
| CIBW_BUILD_VERBOSITY: 1 | |
| CIBW_SKIP: "*-musllinux_i686 gp*-win_*" | |
| CIBW_ARCHS_MACOS: "x86_64 arm64" | |
| CIBW_ENVIRONMENT_MACOS: | | |
| MACOSX_DEPLOYMENT_TARGET=10.12 | |
| PATH="$HOME/.cargo/bin:$PATH" | |
| CC=/usr/bin/clang | |
| CXX=/usr/bin/clang++ | |
| CIBW_ARCHS_LINUX: "x86_64 i686" | |
| CIBW_ENVIRONMENT_LINUX: PATH="$HOME/.cargo/bin:$PATH" | |
| CIBW_BEFORE_BUILD_LINUX: | | |
| pip install --upgrade setuptools-rust | |
| curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y | |
| # It is needed to install Rust for Linux, | |
| # because cibuildwheel on Linux runs inside a container | |
| # and the container does not have Rust. | |
| CIBW_ARCHS_WINDOWS: "AMD64 x86" | |
| - name: List wheel files | |
| run: | | |
| echo "Files to upload (binary wheels):" | |
| find ./wheelhouse -maxdepth 1 -type f -name '*.whl' -print | sort || true | |
| echo "Count: $(find ./wheelhouse -maxdepth 1 -type f -name '*.whl' -print | wc -l || true)" | |
| shell: bash | |
| - name: Store artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| path: ./wheelhouse/*.whl | |
| name: ${{ github.job }}-wheelhouse-${{ matrix.os }}-${{ github.run_id }} | |
| if-no-files-found: warn | |
| overwrite: true | |
| retention-days: 1 | |
| build_sdist: | |
| name: Build source distribution | |
| runs-on: ubuntu-latest | |
| needs: check_build_trigger | |
| if: needs.check_build_trigger.outputs.build | |
| steps: | |
| - name: Checkout source code | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: "3.14" # Ideally matches with the python-version in build_wheels | |
| cache: "pip" | |
| - name: Build source distribution | |
| run: | | |
| cd nlpo3-python | |
| bash ../build_tools/github/build_source.sh | |
| - name: List sdist files | |
| run: | | |
| echo "Files to upload (sdist):" | |
| find nlpo3-python/dist -maxdepth 1 -type f -name '*.tar.gz' -print | sort || true | |
| echo "Count: $(find nlpo3-python/dist -maxdepth 1 -type f -name '*.tar.gz' -print | wc -l || true)" | |
| shell: bash | |
| - name: Store artifacts | |
| uses: actions/upload-artifact@v6 | |
| with: | |
| path: nlpo3-python/dist/*.tar.gz | |
| name: sdist | |
| overwrite: true | |
| retention-days: 1 | |
| publish_pypi: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [build_wheels, build_sdist] | |
| # Publish when a GitHub Release is created: | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| # Alternatively, upload to PyPI on every tag starting with 'v': | |
| #if: github.event_name == 'push' && startsWith(github.event.ref, 'v') | |
| steps: | |
| - name: Retrieve all artifacts | |
| uses: actions/download-artifact@v6 | |
| with: | |
| path: dist | |
| merge-multiple: true | |
| - name: Publish package | |
| uses: pypa/gh-action-pypi-publish@v1.13.0 | |
| with: | |
| skip-existing: true | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |