Skip to content

Commit

Permalink
Merge pull request #278 from Bridgeconn/version-3
Browse files Browse the repository at this point in the history
Version 3
  • Loading branch information
joelthe1 authored Nov 21, 2024
2 parents c9f35af + 19fe94d commit fd59749
Show file tree
Hide file tree
Showing 1,225 changed files with 412,251 additions and 233,874 deletions.
49 changes: 49 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
[bumpversion]
current_version = 3.0.0-beta.16
commit = True
tag = False
parse = (?P<major>\d+)\.(?P<minor>\d+)\.(?P<patch>\d+)\-(?P<release>\w+).(?P<num>\d+)
serialize =
{major}.{minor}.{patch}-{release}.{num}
{major}.{minor}.{patch}

[bumpversion:part:release]
values =
alpha
beta

[bumpversion:file:py-usfm-parser/setup.py]
search = version="{current_version}"
replace = version="{new_version}"

[bumpversion:file:py-usfm-parser/pyproject.toml]

[bumpversion:file:py-usfm-parser/src/usfm_grammar/__init__.py]
search = __version__ = "{current_version}"
replace = __version__ = "{new_version}"

[bumpversion:file:py-usfm-parser/requirements.txt]
search = tree-sitter-usfm3=={current_version}
replace = tree-sitter-usfm3=={new_version}

[bumpversion:file:tree-sitter-usfm3/pyproject.toml]
search = version = "{current_version}"
replace = version = "{new_version}"

[bumpversion:file:tree-sitter-usfm3/package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

[bumpversion:file:tree-sitter-usfm3/package-lock.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

[bumpversion:file:node-usfm-parser/package.json]

[bumpversion:file:web-usfm-parser/package.json]
search = "version": "{current_version}"
replace = "version": "{new_version}"

[bumpversion:file:web-usfm-parser/README.md]
search = npm/usfm-grammar-web@{current_version}
replace = npm/usfm-grammar-web@{new_version}
140 changes: 120 additions & 20 deletions .github/workflows/check-on-push.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,136 @@
name: Check-on-push
name: Test-on-push

# Run this workflow every time a new commit pushed to your repository
on:
push:
pull_request:
branches:
- master
- dev
on: [push, pull_request ]
# push:
# pull_request:
# branches:
# - master
# - version-3

jobs:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
Run-linter-and-tests:
Run-Grammar-tests:
# Name the Job
name: Lint n test
name: Run Grammar tests
# Set the type of machine to run on
runs-on: ubuntu-latest

steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup node and npm
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 14
- name: install packages
run: npm install .
# Runs the Linter action
- name: Run Linter
run: npm run lint
# Run testcases
node-version: 20
- name: Run tests
run: npm run test-on-github

run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
./node_modules/.bin/tree-sitter test
Run-Python-tests:
name: Run Python tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10.6'

- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build grammar binary
run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
- name: Install dependencies
run: |
cd tree-sitter-usfm3
pip install .
cd ../py-usfm-parser
sed -i '/tree-sitter-usfm3==.*/d' pyproject.toml
pip install . -r ./dev-requirements.txt
# - name: Install python module
# run: |
# cd py-usfm-parser
# pip install .

- name: Run tests for parsing errors
working-directory: ./py-usfm-parser
run:
# pytest -k "not compare_usx_with_testsuite_samples and not testsuite_usx_with_rnc_grammar and not samples-from-wild and not 57-TIT.partial" -n auto
python -m pytest -k "not compare_usx_with_testsuite_samples and not testsuite_usx_with_rnc_grammar and not generated_usx_with_rnc_grammar and not samples-from-wild" -n auto

Run-Node-tests:
name: Run Node tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: Build grammar
run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
- name: Install dependencies
run: |
cd node-usfm-parser
sed -i '/"tree-sitter-usfm3":.*/d' package.json
npm install .
npm install ../tree-sitter-usfm3
- name: Run tests
run: |
cd node-usfm-parser
node_modules/mocha/bin/mocha.js --timeout=40000 --grep "Include|Exclude|wild|Compare" --invert
Run-Web-tests:
name: Run Web tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: Build grammar
run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
./node_modules/.bin/tree-sitter build --wasm
- name: Install dependencies
run: |
cd web-usfm-parser
npm install .
cp node_modules/web-tree-sitter/tree-sitter.js src/web-tree-sitter/
cp node_modules/web-tree-sitter/tree-sitter.wasm ./
cp ../tree-sitter-usfm3/tree-sitter-usfm3.wasm ./tree-sitter-usfm.wasm
- name: Run tests
run: |
cd web-usfm-parser
node_modules/mocha/bin/mocha.js --timeout=40000 --grep "Include|Exclude|wild|Compare" --invert
51 changes: 51 additions & 0 deletions .github/workflows/lint-on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: check-linting

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on: [push, pull_request ]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains the linting for python module
python-build-n-lint:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: '3.10.6' # Version range or exact version of a Python version to use, using SemVer's version range syntax
architecture: 'x64' # optional x64 or x86. Defaults to x64 if not specified

- name: Create Virtual Environment
run: python -m venv ENV-dev

- name: Use VENV
run: source ENV-dev/bin/activate

- name: install packages
working-directory: ./py-usfm-parser
run: pip install -r dev-requirements.txt

- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: 20

- name: Build grammar binary
working-directory: ./tree-sitter-usfm3
run: |
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
- name: install tree-sitter-usfm3
working-directory: ./tree-sitter-usfm3
run: pip install .

- name: Run linter
working-directory: ./py-usfm-parser
run: pylint --extension-pkg-allow-list=lxml src/usfm_grammar/*.py
97 changes: 75 additions & 22 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,44 +4,97 @@
name: Node.js Package

on:
workflow_dispatch:
release:
types: [published]

jobs:
build:
# Set the job key. The key is displayed as the job name
# when a job name is not provided
Test-grammar:
# Set the type of machine to run on
runs-on: ubuntu-latest

steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- name: Checkout code
uses: actions/checkout@v4
- name: Setup node and npm
uses: actions/setup-node@v4
with:
node-version: 20
- name: Run tests
run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
./node_modules/.bin/tree-sitter test
Publish-grammar:
needs: Test-grammar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 13.12.0
- run: npm ci
- run: npm run test-on-github
node-version: 20.4
registry-url: https://registry.npmjs.org/
- run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
npm publish . --tag beta
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
publish-npm:
needs: build
Publish-node-usfm-grammar:
needs: Test-grammar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 13.12.0
node-version: 20.4
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
- run: |
cd node-usfm-parser
sed -i '/"tree-sitter-usfm3":.*/d' package.json
npm install .
git checkout -- package.json
npm run build
npm publish .
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
# publish-gpr:
# needs: build
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-node@v1
# with:
# node-version: 12
# registry-url: https://npm.pkg.github.com/
# - run: npm ci
# - run: npm publish
# env:
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
Publish-web-usfm-grammar:
needs: Test-grammar
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 20.4
registry-url: https://registry.npmjs.org/
- name: Build Grammar
run: |
cd tree-sitter-usfm3
npm install --save nan
npm install --save-dev tree-sitter-cli
./node_modules/.bin/tree-sitter generate
./node_modules/.bin/tree-sitter build --wasm
cp tree-sitter-usfm3.wasm ../web-usfm-parser/tree-sitter-usfm.wasm
- name: Install dependencies
run: |
cd web-usfm-parser/
npm install .
cp ./node_modules/web-tree-sitter/tree-sitter.js src/web-tree-sitter/
cp ./node_modules/web-tree-sitter/tree-sitter.wasm ./
- name: Build and publish
run: |
cd web-usfm-parser/
npm run build
npm publish .
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
Loading

0 comments on commit fd59749

Please sign in to comment.