Skip to content

Commit cc591d1

Browse files
Copilothzhangxyz
andcommitted
Add bnf-pytest.yml and bnf-jest.yml workflows with pypi-bnf and npm-bnf environments
Co-authored-by: hzhangxyz <[email protected]>
1 parent f518964 commit cc591d1

File tree

2 files changed

+172
-0
lines changed

2 files changed

+172
-0
lines changed

.github/workflows/bnf-jest.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: bnf-jest
2+
permissions:
3+
contents: read
4+
5+
on:
6+
- pull_request
7+
- push
8+
9+
env:
10+
NODE_LATEST_VERSION: '24'
11+
12+
jobs:
13+
bnf-jest:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
node-version: ['20', '22', '24']
20+
21+
steps:
22+
- uses: actions/checkout@v6
23+
24+
- uses: actions/setup-node@v6
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
cache-dependency-path: bnf/package-lock.json
29+
30+
- name: dependencies
31+
working-directory: bnf
32+
run: npm ci
33+
34+
- name: jest
35+
working-directory: bnf
36+
run: npm run all
37+
38+
npm:
39+
runs-on: ubuntu-latest
40+
needs: bnf-jest
41+
42+
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')"
43+
44+
environment:
45+
name: npm-bnf
46+
url: https://www.npmjs.com/package/atsds-bnf
47+
permissions:
48+
id-token: write
49+
50+
steps:
51+
- uses: actions/checkout@v6
52+
53+
- name: recovery tag information
54+
run: git fetch --tags --force
55+
56+
- uses: actions/setup-node@v6
57+
with:
58+
node-version: ${{ env.NODE_LATEST_VERSION }}
59+
cache: 'npm'
60+
cache-dependency-path: bnf/package-lock.json
61+
62+
- name: version
63+
working-directory: bnf
64+
run: npm version from-git --no-git-tag-version
65+
66+
- name: extract tag
67+
run: |
68+
GIT_TAG=${GITHUB_REF#refs/tags/}
69+
TAG=$(echo $GIT_TAG | sed -E 's/^v//' | sed -E 's/[0-9\.-]//g' | sed -E 's/^$/latest/g')
70+
echo TAG=$TAG >> $GITHUB_ENV
71+
72+
- name: dependencies
73+
working-directory: bnf
74+
run: npm ci
75+
76+
- name: build
77+
working-directory: bnf
78+
run: npm run build
79+
80+
- name: publish
81+
working-directory: bnf
82+
run: npm publish --tag $TAG

.github/workflows/bnf-pytest.yml

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
name: bnf-pytest
2+
permissions:
3+
contents: read
4+
5+
on:
6+
- pull_request
7+
- push
8+
9+
env:
10+
PYTHON_LATEST_VERSION: '3.14'
11+
12+
jobs:
13+
bnf-pytest:
14+
runs-on: ubuntu-latest
15+
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']
20+
21+
steps:
22+
- uses: actions/checkout@v6
23+
24+
- uses: astral-sh/setup-uv@v7
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
enable-cache: true
28+
29+
- name: dependencies
30+
working-directory: bnf
31+
run: uv sync --locked --extra dev
32+
33+
- name: pytest
34+
working-directory: bnf
35+
run: uv run pytest
36+
37+
wheels:
38+
runs-on: ${{ matrix.os }}
39+
needs: bnf-pytest
40+
41+
if: "github.event_name == 'push' && startsWith(github.ref, 'refs/tags')"
42+
43+
strategy:
44+
fail-fast: false
45+
matrix:
46+
os: [windows-latest, ubuntu-latest, macos-latest]
47+
48+
steps:
49+
- uses: actions/checkout@v6
50+
51+
- name: recovery tag information
52+
run: git fetch --tags --force
53+
54+
- uses: actions/setup-python@v6
55+
with:
56+
python-version: ${{ env.PYTHON_LATEST_VERSION }}
57+
cache: 'pip'
58+
59+
- name: install cibuildwheel
60+
run: pip install cibuildwheel
61+
62+
- name: build wheels
63+
working-directory: bnf
64+
run: python -m cibuildwheel
65+
66+
- uses: actions/upload-artifact@v5
67+
with:
68+
name: wheels-${{ matrix.os }}
69+
path: bnf/wheelhouse/*.whl
70+
71+
upload:
72+
runs-on: ubuntu-latest
73+
needs: wheels
74+
75+
environment:
76+
name: pypi-bnf
77+
url: https://pypi.org/project/apyds-bnf
78+
permissions:
79+
id-token: write
80+
81+
steps:
82+
- uses: actions/download-artifact@v6
83+
with:
84+
pattern: wheels-*
85+
path: dist
86+
merge-multiple: true
87+
88+
- uses: pypa/gh-action-pypi-publish@release/v1
89+
with:
90+
packages-dir: dist

0 commit comments

Comments
 (0)