Skip to content

Commit

Permalink
refactor CI & use Dart SDK beta (#16)
Browse files Browse the repository at this point in the history
* refactor CI
* upgrade min Dart SDK version beta
* codecov badge
* 0.5.2
  • Loading branch information
sensuikan1973 authored Feb 13, 2021
1 parent 3388865 commit 24c4556
Show file tree
Hide file tree
Showing 10 changed files with 138 additions and 145 deletions.
34 changes: 34 additions & 0 deletions .codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# See: https://docs.codecov.io/docs/codecov-yaml

codecov:
notify:
require_ci_to_pass: yes

coverage:
precision: 2
round: down
range: "40...100"

status:
project:
default:
target: 70%
patch: no # See: https://docs.codecov.io/docs/commit-status#section-patch-status
changes: no

parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no

comment: # See: https://docs.codecov.io/docs/pull-request-comments
layout: "reach, diff, flags, files"
behavior: default
require_changes: false
require_base: true
require_head: true

# ignore: # See: https://docs.codecov.io/docs/ignoring-paths
46 changes: 46 additions & 0 deletions .github/workflows/dart_ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@

name: Dart CI

on:
pull_request:
paths: ['**.dart', 'pubspec.*', 'analysis_options.yaml', '.github/workflows/dart_ci.yaml']
push:
branches: [ main ]
paths: ['**.dart', 'pubspec.*', 'analysis_options.yaml', '.github/workflows/dart_ci.yaml']

jobs:
format:
runs-on: ubuntu-latest
container:
image: google/dart:beta
steps:
- uses: actions/checkout@v2
- name: dart format
run: dart format ./ -l 120 --set-exit-if-changed

analyze:
runs-on: ubuntu-latest
container:
image: google/dart:beta
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: pub get
- name: analyzer
run: dart analyze --fatal-infos --fatal-warnings .

test:
runs-on: ubuntu-latest
container:
image: google/dart:beta
steps:
- uses: actions/checkout@v2
- name: install dependencies
run: pub get
- name: run test
run: pub run test . --coverage=coverage
- name: coverage
run: pub run coverage:format_coverage --lcov --packages=.packages --in coverage --out lcov.info
- uses: codecov/codecov-action@v1
with:
file: lcov.info
21 changes: 0 additions & 21 deletions .github/workflows/dartanalyzer.yaml

This file was deleted.

19 changes: 0 additions & 19 deletions .github/workflows/dartfmt.yaml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/unit_test.yaml

This file was deleted.

3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# 0.5.2
- upgrade dependencies

# 0.5.1
- upgrade dependencies
- mild fix build info output format
Expand Down
8 changes: 3 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,13 +74,11 @@ There are **only 3 rules**. Example is [here](https://github.com/sensuikan1973/e
- [Choirokoitia | Edax](https://choi.lavox.net/edax/start): great edax documents (Japanese)

## Development
![dartfmt](https://github.com/sensuikan1973/edax_runner/workflows/dartfmt/badge.svg?event=push)
![dartanalyzer](https://github.com/sensuikan1973/edax_runner/workflows/dartanalyzer/badge.svg?event=push)
![unit_test](https://github.com/sensuikan1973/edax_runner/workflows/unit_test/badge.svg?event=push)
[![dart-channel](https://img.shields.io/badge/Dart-beta-64B5F6.svg?logo=dart)](https://dart.dev/get-dart#release-channels)
![Dart CI](https://github.com/sensuikan1973/edax_runner/workflows/Dart%20CI/badge.svg)
[![codecov](https://codecov.io/gh/sensuikan1973/edax_runner/branch/main/graph/badge.svg?token=7ZF8NAY1NS)](https://codecov.io/gh/sensuikan1973/edax_runner)
![publish_artifacts_gcc](https://github.com/sensuikan1973/edax_runner/workflows/publish_artifacts_gcc/badge.svg)
![publish_artifacts_icc](https://github.com/sensuikan1973/edax_runner/workflows/publish_artifacts_icc/badge.svg)
![publish_assets_gcc](https://github.com/sensuikan1973/edax_runner/workflows/publish_assets_gcc/badge.svg)
![publish_assets_icc](https://github.com/sensuikan1973/edax_runner/workflows/publish_assets_icc/badge.svg)

### format
```sh
Expand Down
4 changes: 2 additions & 2 deletions lib/converter_text_to_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ String convertTextToCommand(String line, String bookFile) {
if (_edaxVsEdaxRegexp.hasMatch(str)) return playGameEdaxVsEdax(bookFile, str);
if (_edaxVsEdaxWithRandomnessRegexp.hasMatch(str)) {
final match = _edaxVsEdaxWithRandomnessRegexp.firstMatch(str);
return playGameEdaxVsEdax(bookFile, match.group(3), int.parse(match.group(1)));
return playGameEdaxVsEdax(bookFile, match!.group(3) ?? '', int.parse(match.group(1) ?? ''));
}
if (_bookDeviateRegexp.hasMatch(str)) {
final match = _bookDeviateRegexp.firstMatch(str);
return bookDeviate(bookFile, match.group(7), int.parse(match.group(2)), int.parse(match.group(4)));
return bookDeviate(bookFile, match!.group(7) ?? '' , int.parse(match.group(2) ?? ''), int.parse(match.group(4) ?? ''));
}

throw Exception('$str is not supported format');
Expand Down
Loading

0 comments on commit 24c4556

Please sign in to comment.