Add bnf-pytest.yml and bnf-jest.yml workflows with dedicated publish environments - #80
Conversation
…nf environments Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR creates dedicated GitHub Actions workflows for the bnf/ subdirectory package, enabling independent testing and publishing for the apyds-bnf (Python) and atsds-bnf (JavaScript) packages that provide BNF parsing functionality.
Key changes:
- Adds Python testing and PyPI publishing workflow for the pure Python BNF package
- Adds JavaScript testing and npm publishing workflow for the BNF TypeScript/JavaScript package
- Configures dedicated publishing environments (
pypi-bnfandnpm-bnf) to separate BNF package releases from root package releases
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
.github/workflows/bnf-pytest.yml |
Python CI/CD workflow for BNF package testing (pytest) and PyPI publishing with cross-platform wheel building |
.github/workflows/bnf-jest.yml |
JavaScript CI/CD workflow for BNF package testing (jest) and npm publishing, with emsdk setup removed as it's not needed for this package |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| wheels: | ||
| runs-on: ${{ matrix.os }} | ||
| needs: bnf-pytest | ||
|
|
||
| if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')" | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [windows-latest, ubuntu-latest, macos-latest] | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: recovery tag information | ||
| run: git fetch --tags --force | ||
|
|
||
| - uses: actions/setup-python@v6 | ||
| with: | ||
| python-version: ${{ env.PYTHON_LATEST_VERSION }} | ||
| cache: 'pip' | ||
|
|
||
| - name: install cibuildwheel | ||
| run: pip install cibuildwheel | ||
|
|
||
| - name: build wheels | ||
| working-directory: bnf | ||
| run: python -m cibuildwheel | ||
|
|
||
| - uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: wheels-${{ matrix.os }} | ||
| path: bnf/wheelhouse/*.whl |
There was a problem hiding this comment.
The apyds-bnf package is a pure Python package (using setuptools.build_meta backend with no C extensions), but this workflow uses cibuildwheel to create platform-specific wheels across Windows, Ubuntu, and macOS. This is unnecessary and wasteful of CI resources.
For pure Python packages, you should build a universal wheel using standard build tools instead. Consider replacing the wheels job with a simpler approach:
build:
runs-on: ubuntu-latest
needs: bnf-pytest
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')"
steps:
- uses: actions/checkout@v6
- name: recovery tag information
run: git fetch --tags --force
- uses: actions/setup-python@v6
with:
python-version: ${{ env.PYTHON_LATEST_VERSION }}
- name: build
working-directory: bnf
run: |
pip install build
python -m build
- uses: actions/upload-artifact@v5
with:
name: dist
path: bnf/dist/*Then update the upload job to use name: dist instead of pattern: wheels-*.
There was a problem hiding this comment.
Replaced the wheels job with a simpler build job using python -m build for the pure Python package. Also added ANTLR4 setup as required. (bc8622c)
| pattern: wheels-* | ||
| path: dist | ||
| merge-multiple: true |
There was a problem hiding this comment.
The upload job expects artifacts with pattern wheels-*, but since this should be changed to build a universal wheel instead of platform-specific wheels (see previous comment), this artifact download configuration needs to be updated.
If the wheels job is replaced with a simple build job that produces a single artifact named dist, update this to:
- uses: actions/download-artifact@v6
with:
name: dist
path: dist| pattern: wheels-* | |
| path: dist | |
| merge-multiple: true | |
| name: dist | |
| path: dist |
There was a problem hiding this comment.
Updated to download single dist artifact instead of wheels-* pattern. (bc8622c)
hzhangxyz
left a comment
There was a problem hiding this comment.
- 你需要安装antlr4在系统中, 才能进行python或js的build. 你可以使用 StoneMoe/setup-antlr4@v4 这个 action完成
- apyds_bnf这个不需要cibuildwheel, 因为是纯python的, 直接python -m build 就可以了
Co-authored-by: hzhangxyz <11623447+hzhangxyz@users.noreply.github.com>
Added |
a670ed4 to
fdf56e1
Compare
Creates dedicated CI/CD workflows for the
bnf/package, mirroring the root-levelpytest.ymlandjest.ymlstructure but scoped to the BNF subdirectory.Key changes:
.github/workflows/bnf-pytest.yml: Python testing (3.10-3.14) and PyPI publishingworking-directory: bnfStoneMoe/setup-antlr4@v4to install ANTLR4 for parser generationpython -m build(universal wheel, no cross-platform builds needed)apyds-bnfto PyPI usingpypi-bnfenvironment.github/workflows/bnf-jest.yml: JavaScript testing (Node 20/22/24) and npm publishingworking-directory: bnfStoneMoe/setup-antlr4@v4to install ANTLR4 for parser generationcache-dependency-path: bnf/package-lock.jsonfor npm cachingatsds-bnfto npm usingnpm-bnfenvironmentBoth workflows include standard test jobs triggered on PR/push, plus conditional publish jobs on tag pushes.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.