Add more tests for tone and vowel analysis #1425
Workflow file for this run
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
| # SPDX-FileCopyrightText: 2016-2026 PyThaiNLP Project | |
| # SPDX-FileType: SOURCE | |
| # SPDX-License-Identifier: CC0-1.0 | |
| name: Build and publish to PyPI | |
| on: | |
| push: # Use together with "[cd build]" commit message | |
| branches: | |
| - dev | |
| pull_request: # Use together with "[cd build]" commit message | |
| branches: | |
| - dev | |
| release: | |
| types: [published] # "Publish release" button | |
| workflow_dispatch: # Manual trigger to test wheel build | |
| # Avoid duplicate runs for the same source branch and repository. | |
| # For pull_request events, uses the source repo name from | |
| # github.event.pull_request.head.repo.full_name; otherwise uses github.repository. | |
| # For push events, uses the branch name from github.ref_name. | |
| # For pull_request events, uses the source branch name from github.head_ref. | |
| # This ensures events for the same repo and branch share the same group, | |
| # and avoids cross-fork collisions when branch names are reused. | |
| # Also applies to release (uses tag name) and workflow_dispatch (uses branch/tag name). | |
| concurrency: | |
| group: >- | |
| ${{ github.workflow }}-${{ | |
| github.event.pull_request.head.repo.full_name || github.repository | |
| }}-${{ github.head_ref || github.ref_name }} | |
| cancel-in-progress: true | |
| 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/pythainlp' | |
| 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 }} | |
| - 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: | |
| name: Build and check distributions | |
| needs: [check_build_trigger] | |
| if: needs.check_build_trigger.outputs.build | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| python-version: ["3.12"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Set up Python ${{ matrix.python-version }} | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python-version }} | |
| - name: Install dependencies | |
| run: | | |
| pip install --upgrade build pip twine | |
| - name: Build source distribution and wheels | |
| run: python -m build | |
| - name: Check distributions | |
| run: twine check dist/* | |
| - name: Store distributions | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: dist | |
| publish_pypi: | |
| name: Publish to PyPI | |
| runs-on: ubuntu-latest | |
| needs: [build] | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| steps: | |
| - name: Retrieve distributions | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: artifact | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| if: github.event_name == 'release' && github.event.action == 'published' | |
| with: | |
| skip-existing: true | |
| user: __token__ | |
| password: ${{ secrets.PYPI_API_TOKEN }} |