Skip to content

Commit

Permalink
ci: migrate to GH actions (#171)
Browse files Browse the repository at this point in the history
Co-authored-by: Harjot Singh <harjot@harkul.com>
  • Loading branch information
saihaj and Harjot1Singh committed Oct 26, 2020
1 parent 6302051 commit e4d3bd5
Show file tree
Hide file tree
Showing 6 changed files with 180 additions and 65 deletions.
39 changes: 0 additions & 39 deletions .circleci/config.yml

This file was deleted.

74 changes: 74 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Runs CI tasks on pull requests and pushes

name: Continuous Integration

on:
pull_request:
branches:
- dev
- main
push:
branches-ignore:
- main

jobs:
lint:
name: Lint
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Cache Node.js modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install npm dependencies
run: npm ci

- name: Run linter
run: npm run lint

tests:
name: Tests
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x

- name: Cache Node.js modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install npm dependencies
run: npm ci

- name: Run Tests
run: npm run test

- name: Coveralls
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
51 changes: 51 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Continuous Deployment

on:
push:
branches:
- main

jobs:
build-publish:
name: Build and Publish to NPM
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v2

- name: Use Node.js 12.x
uses: actions/setup-node@v1
with:
node-version: 12.x
registry-url: "https://registry.npmjs.org"

- name: Cache Node.js modules
uses: actions/cache@v1
with:
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
${{ runner.OS }}-
- name: Install npm dependencies
run: npm ci

- name: Build module
run: npm run build

- name: Release module on NPM
run: |
# Configure git
git config --global push.default current
git config --global user.email "team@shabados.com"
git config --global user.name "ShabadOS Bot"
# Run Release script
chmod +x release.sh
echo "Releasing on Github"
npm run release
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_BOT_TOKEN }}
39 changes: 27 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ Calculates the number of syllables according to Sanskrit prosody, Pingala, Matra

**Example**
```js
countSyllables( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )// expected output: 14
countSyllables( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )
// expected output: 14
```
### firstLetters(line) ⇒ <code>String</code>
Generates the first letters for a unicode Gurmukhi,Hindi transliteration, or English transliteration string.Includes any end-word vishraams, and line-end characters.
Generates the first letters for a unicode Gurmukhi,
Hindi transliteration, or English transliteration string.
Includes any end-word vishraams, and line-end characters.

**Returns**: <code>String</code> - The first letters of each word in the provided Gurmukhi line.

Expand Down Expand Up @@ -119,10 +122,12 @@ Checks if first char in string is part of the Gurmukhi Unicode block.

**Example**
```js
isGurmukhi('ਗੁਰਮੁਖੀ') // => trueisGurmukhi('gurmuKI') // => false
isGurmukhi('ਗੁਰਮੁਖੀ') // => true
isGurmukhi('gurmuKI') // => false
```
### stripAccents(text) ⇒ <code>String</code>
Removes accents from ASCII/Unicode Gumrukhi letters with their base letter.Useful for generalising search queries.
Removes accents from ASCII/Unicode Gumrukhi letters with their base letter.
Useful for generalising search queries.

**Returns**: <code>String</code> - A simplified version of the provided Gurmukhi string.

Expand All @@ -132,10 +137,14 @@ Removes accents from ASCII/Unicode Gumrukhi letters with their base letter. Usef

**Example**
```js
stripAccents('ਜ਼ਫ਼ੈਸ਼ਸਓ') // => ਜਫੈਸਸੳstripAccents('Z^Svb') // => gKsvb
stripAccents('ਜ਼ਫ਼ੈਸ਼ਸਓ') // => ਜਫੈਸਸੳ
stripAccents('Z^Svb') // => gKsvb
```
### stripEndings(text) ⇒ <code>String</code>
Strips line endings from any Gurmukhi or translation string.Accepts both Unicode and ASCII input.Useful for generating accurate first letters or modifying non-Gurbani for better display.*Not* designed for headings or Sirlekhs.
Strips line endings from any Gurmukhi or translation string.
Accepts both Unicode and ASCII input.
Useful for generating accurate first letters or modifying non-Gurbani for better display.
*Not* designed for headings or Sirlekhs.

**Returns**: <code>String</code> - A ending-less version of the text.

Expand Down Expand Up @@ -198,10 +207,12 @@ Converts Gurmukhi unicode text to ASCII, used GurmukhiAkhar font.

**Example**
```js
toAscii('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => hmw swieil luqi& hk prvrS ]toAscii('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => su bYiT iekMqR ]578]
toAscii('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => hmw swieil luqi& hk prvrS ]
toAscii('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => su bYiT iekMqR ]578]
```
### toEnglish(line) ⇒ <code>String</code>
Transliterates a line from Unicode Gurmukhi to english.Currently supports the `,`, `;`, `.` vishraam characters.
Transliterates a line from Unicode Gurmukhi to english.
Currently supports the `,`, `;`, `.` vishraam characters.

**Returns**: <code>String</code> - The English transliteration of the provided Gurmukhi line.

Expand All @@ -228,7 +239,8 @@ Transliterates Unicode Gurmukhi text to Hindi (Devanagari script).

**Example**
```js
toHindi('ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥') // => कुल जन मधे मिल्यो सारग पान रे ॥toHindi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => सु बैठ इकंत्र ॥५७८॥
toHindi('ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥') // => कुल जन मधे मिल्यो सारग पान रे ॥
toHindi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => सु बैठ इकंत्र ॥५७८॥
```
### toShahmukhi(text) ⇒ <code>String</code>
Transliterates Unicode Gurmukhi text to the Shahmukhi script.
Expand All @@ -241,7 +253,8 @@ Transliterates Unicode Gurmukhi text to the Shahmukhi script.

**Example**
```js
toShahmukhi('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => هما ساِال لُتف هک پرورش ۔۔toShahmukhi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => سُ بَےٹھ ِاکںتر ۔۔۵۷۸۔۔
toShahmukhi('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => هما ساِال لُتف هک پرورش ۔۔
toShahmukhi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => سُ بَےٹھ ِاکںتر ۔۔۵۷۸۔۔
```
### toSyllabicSymbols(text) ⇒ <code>String</code>
Represents text in syllables according to Sanskrit prosody, Pingala, Matra/Meter/Morae
Expand All @@ -254,7 +267,8 @@ Represents text in syllables according to Sanskrit prosody, Pingala, Matra/Meter

**Example**
```js
toSyllabicSymbols( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )// expected output: '12 22 11 11 21'
toSyllabicSymbols( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )
// expected output: '12 22 11 11 21'
```
### toUnicode(text) ⇒ <code>String</code>
Converts ASCII text used in the GurmukhiAkhar font to Unicode.
Expand All @@ -267,7 +281,8 @@ Converts ASCII text used in the GurmukhiAkhar font to Unicode.

**Example**
```js
toUnicode('kul jn mDy imil´o swrg pwn ry ]') // => ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥toUnicode('su bYiT iekMqR ]578]') // => ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥
toUnicode('kul jn mDy imil´o swrg pwn ry ]') // => ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥
toUnicode('su bYiT iekMqR ]578]') // => ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥
```

## Community
Expand Down
39 changes: 27 additions & 12 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,13 @@ Calculates the number of syllables according to Sanskrit prosody, Pingala, Matra

**Example**
```js
countSyllables( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )// expected output: 14
countSyllables( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )
// expected output: 14
```
### firstLetters(line) ⇒ <code>String</code>
Generates the first letters for a unicode Gurmukhi,Hindi transliteration, or English transliteration string.Includes any end-word vishraams, and line-end characters.
Generates the first letters for a unicode Gurmukhi,
Hindi transliteration, or English transliteration string.
Includes any end-word vishraams, and line-end characters.

**Returns**: <code>String</code> - The first letters of each word in the provided Gurmukhi line.

Expand Down Expand Up @@ -119,10 +122,12 @@ Checks if first char in string is part of the Gurmukhi Unicode block.

**Example**
```js
isGurmukhi('ਗੁਰਮੁਖੀ') // => trueisGurmukhi('gurmuKI') // => false
isGurmukhi('ਗੁਰਮੁਖੀ') // => true
isGurmukhi('gurmuKI') // => false
```
### stripAccents(text) ⇒ <code>String</code>
Removes accents from ASCII/Unicode Gumrukhi letters with their base letter.Useful for generalising search queries.
Removes accents from ASCII/Unicode Gumrukhi letters with their base letter.
Useful for generalising search queries.

**Returns**: <code>String</code> - A simplified version of the provided Gurmukhi string.

Expand All @@ -132,10 +137,14 @@ Removes accents from ASCII/Unicode Gumrukhi letters with their base letter. Usef

**Example**
```js
stripAccents('ਜ਼ਫ਼ੈਸ਼ਸਓ') // => ਜਫੈਸਸੳstripAccents('Z^Svb') // => gKsvb
stripAccents('ਜ਼ਫ਼ੈਸ਼ਸਓ') // => ਜਫੈਸਸੳ
stripAccents('Z^Svb') // => gKsvb
```
### stripEndings(text) ⇒ <code>String</code>
Strips line endings from any Gurmukhi or translation string.Accepts both Unicode and ASCII input.Useful for generating accurate first letters or modifying non-Gurbani for better display.*Not* designed for headings or Sirlekhs.
Strips line endings from any Gurmukhi or translation string.
Accepts both Unicode and ASCII input.
Useful for generating accurate first letters or modifying non-Gurbani for better display.
*Not* designed for headings or Sirlekhs.

**Returns**: <code>String</code> - A ending-less version of the text.

Expand Down Expand Up @@ -198,10 +207,12 @@ Converts Gurmukhi unicode text to ASCII, used GurmukhiAkhar font.

**Example**
```js
toAscii('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => hmw swieil luqi& hk prvrS ]toAscii('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => su bYiT iekMqR ]578]
toAscii('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => hmw swieil luqi& hk prvrS ]
toAscii('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => su bYiT iekMqR ]578]
```
### toEnglish(line) ⇒ <code>String</code>
Transliterates a line from Unicode Gurmukhi to english.Currently supports the `,`, `;`, `.` vishraam characters.
Transliterates a line from Unicode Gurmukhi to english.
Currently supports the `,`, `;`, `.` vishraam characters.

**Returns**: <code>String</code> - The English transliteration of the provided Gurmukhi line.

Expand All @@ -228,7 +239,8 @@ Transliterates Unicode Gurmukhi text to Hindi (Devanagari script).

**Example**
```js
toHindi('ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥') // => कुल जन मधे मिल्यो सारग पान रे ॥toHindi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => सु बैठ इकंत्र ॥५७८॥
toHindi('ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥') // => कुल जन मधे मिल्यो सारग पान रे ॥
toHindi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => सु बैठ इकंत्र ॥५७८॥
```
### toShahmukhi(text) ⇒ <code>String</code>
Transliterates Unicode Gurmukhi text to the Shahmukhi script.
Expand All @@ -241,7 +253,8 @@ Transliterates Unicode Gurmukhi text to the Shahmukhi script.

**Example**
```js
toShahmukhi('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => هما ساِال لُتف هک پرورش ۔۔toShahmukhi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => سُ بَےٹھ ِاکںتر ۔۔۵۷۸۔۔
toShahmukhi('ਹਮਾ ਸਾਇਲਿ ਲੁਤਫ਼ਿ ਹਕ ਪਰਵਰਸ਼ ॥') // => هما ساِال لُتف هک پرورش ۔۔
toShahmukhi('ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥') // => سُ بَےٹھ ِاکںتر ۔۔۵۷۸۔۔
```
### toSyllabicSymbols(text) ⇒ <code>String</code>
Represents text in syllables according to Sanskrit prosody, Pingala, Matra/Meter/Morae
Expand All @@ -254,7 +267,8 @@ Represents text in syllables according to Sanskrit prosody, Pingala, Matra/Meter

**Example**
```js
toSyllabicSymbols( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )// expected output: '12 22 11 11 21'
toSyllabicSymbols( 'ਪ੍ਰਭੂ ਪ੍ਰੇਮੀ ਪੜ੍ਹ ਚੜ੍ਹ ਦ੍ਵੈਤ' )
// expected output: '12 22 11 11 21'
```
### toUnicode(text) ⇒ <code>String</code>
Converts ASCII text used in the GurmukhiAkhar font to Unicode.
Expand All @@ -267,7 +281,8 @@ Converts ASCII text used in the GurmukhiAkhar font to Unicode.

**Example**
```js
toUnicode('kul jn mDy imil´o swrg pwn ry ]') // => ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥toUnicode('su bYiT iekMqR ]578]') // => ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥
toUnicode('kul jn mDy imil´o swrg pwn ry ]') // => ਕੁਲ ਜਨ ਮਧੇ ਮਿਲੵੋਿ ਸਾਰਗ ਪਾਨ ਰੇ ॥
toUnicode('su bYiT iekMqR ]578]') // => ਸੁ ਬੈਠਿ ਇਕੰਤ੍ਰ ॥੫੭੮॥
```

## Community
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
}
},
"scripts": {
"test": "jest",
"publish-coverage": "jest --coverage && cat ./coverage/lcov.info | coveralls",
"test": "jest --coverage",
"release": "./release.sh",
"build": "webpack --mode production",
"build-docs": "jsdoc2md --template README.hbs lib/**/*.js > README.md && markdown-toc -i README.md && cp README.md docs/",
Expand Down

0 comments on commit e4d3bd5

Please sign in to comment.