Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: add codecov config, publish on release #5

Merged
merged 1 commit into from
Jul 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 3 additions & 23 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,39 +1,21 @@
name: ci
on:
workflow_dispatch:
pull_request:
branches:
- master

jobs:
kana_kit:
runs-on: ubuntu-latest
container:
image: "google/dart:2.8.4"
image: google/dart:2.8.4
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Install dependencies
run: pub get

- name: Dry run publish
id: dry_run_publish
uses: k-paxian/dart-package-publisher@master
with:
dryRunOnly: true
skipTests: true
credentialJson: ${{ secrets.CREDENTIAL_JSON }}

- name: Compare versions
run: |
if [ "${{steps.dry_run_publish.outputs.localVersion}}" = "${{steps.dry_run_publish.outputs.remoteVersion}}" ]; then
echo "Local package version number ${{steps.dry_run_publish.outputs.localVersion}} and remote pub version number ${{steps.dry_run_publish.outputs.remoteVersion}} are the same."
echo "Update the local version number."
exit 1
else
exit 0
fi


- name: Format
run: dartfmt --dry-run --set-exit-if-changed .

Expand All @@ -53,5 +35,3 @@ jobs:
path: ./coverage/lcov.info
exclude: "**/*.g.dart lib/src/models/romanization/**"
min_coverage: 99

name: Publish plugin
15 changes: 12 additions & 3 deletions .github/workflows/publish_to_pub.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: publish_to_pub
on:
push:
branches:
- master
release:
types: [published]

jobs:
publish:
Expand All @@ -12,7 +11,17 @@ jobs:
uses: actions/checkout@v2

- name: Publish to pub
id: publish
uses: k-paxian/dart-package-publisher@master
with:
skipTests: true
credentialJson: ${{ secrets.CREDENTIAL_JSON }}

- name: Verify published
run: |
if [ "${{steps.publish.outputs.success}}" = "false" ]; then
echo "Publishing failed."
exit 1
else
exit 0
fi
13 changes: 10 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
## [1.0.2] - 2020-07-22
## 1.0.3

- Add codecov.yml.
- Change `publish_to_pub` workflow to run on GitHub release publishing.
- Improve README format with fancy badge.
- Improve CHANGELOG format for fancy new pub.dev.

## 1.0.2

- Small CI/CD pipeline fix.

## [1.0.1] - 2020-07-22
## 1.0.1

- Initial pub release.
- Improved README.
- Added pub publishing CD workflow.

## [1.0.0] - 2020-07-22
## [1.0.0

- Initial release 🎉
48 changes: 39 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,37 @@
# KanaKit (カナ・キット)

A Dart library for for detecting and transliterating Hiragana, Katakana, and Romaji.
<div align="center">
<h1>KanaKit (かな・キット)</h1>
<h4>A Dart library for for detecting and transliterating Hiragana, Katakana, and Romaji.</h4>
</div>

<div align="center">
<a href="https://pub.dev/packages/kana_kit"
><img alt="Pub Version" src="https://img.shields.io/pub/v/kana_kit"
/></a>
<a href="https://codecov.io/gh/jeroen-meijer/kana_kit"
><img
alt="Codecov"
src="https://img.shields.io/codecov/c/github/jeroen-meijer/kana_kit"
/></a>
<a href="https://github.com/jeroen-meijer/kana_kit/commits/"
><img
alt="GitHub last commit"
src="https://img.shields.io/github/last-commit/jeroen-meijer/kana_kit"
/></a>
<a href="https://github.com/jeroen-meijer/kana_kit/issues">
<img
alt="GitHub issues"
src="https://img.shields.io/github/issues/jeroen-meijer/kana_kit"
/>
</a>
<a href="https://pub.dev/documentation/kana_kit/latest/">
<img
alt="Documentation"
src="https://img.shields.io/badge/read-the%20docs-blue"
/>
</a>
</div>

---

This library is mostly a direct port of [WaniKani's WanaKana JavaScript library](https://github.com/WaniKani/WanaKana).

Expand All @@ -16,7 +47,7 @@ It contains all available methods for detecting and converting Japanese text.
// If no config is provided, KanaKitConfig.defaultConfig is used.
const kanaKit = KanaKit();

// String checks
// Checks
kanaKit.isJapanese('泣き虫。!~2¥zenkaku') // true

kanaKit.isKana('あーア') // true
Expand All @@ -30,7 +61,7 @@ kanaKit.isKanji('勢い') // false

kanaKit.isRomaji('Tōkyō and Ōsaka') // true

// String converters
// Converters
kanaKit.toKana('ONAJI buttsuuji') // 'オナジ ぶっつうじ'
kanaKit.toKana('座禅‘zazen’スタイル') // '座禅「ざぜん」スタイル'
kanaKit.toKana('batsuge-mu') // 'ばつげーむ'
Expand All @@ -41,10 +72,9 @@ kanaKit.toKatakana('toukyou, おおさか') // 'トウキョウ、 オオサ
kanaKit.toRomaji('ひらがな カタカナ') // 'hiragana katakana'

// Use upcaseKatakana to capitalize characters that were converted from Katakana.s
final kanaKitWithUpcaseKatakana = kanaKit(
upcaseKatakana: true,
);
kanaKitWithUpcaseKatakana.toRomaji('ひらがな カタカナ') // 'hiragana KATAKANA'
kanaKit
.copyWithConfig(upcaseKatakana: true)
.toRomaji('ひらがな カタカナ') // 'hiragana KATAKANA'
```

### LICENSE
Expand Down
10 changes: 10 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
codecov:
require_ci_to_pass: true

coverage:
precision: 3
range: "99...100"

ignore:
- "**/*.g.dart"
- "lib/src/models/romanization/**"
6 changes: 3 additions & 3 deletions pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: kana_kit
description: >
A Dart library for handling and converting Japanese
characters such as hiragana, katakana and kanji.
version: 1.0.2
A Dart library for for detecting and transliterating
Hiragana, Katakana, and Romaji.
version: 1.0.3
homepage: https://pub.dev/packages/kana_kit
repository: https://github.com/jeroen-meijer/kana_kit

Expand Down
4 changes: 2 additions & 2 deletions scripts/pre_commit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ lcov --remove ./coverage/lcov.info -o ./coverage/filtered.info\
'lib/src/models/romanization/**'
genhtml -o coverage ./coverage/filtered.info
open ./coverage/index.html
echo "Running dartdoc..."
dartdoc
echo "Running dry run publish..."
pub publish --dry-run

echo ""
echo "Done."
Expand Down