Skip to content

Commit 47b0c38

Browse files
Merge pull request #357 from YuukiToriyama/release/v0.1.7
release/v0.1.7をmainブランチにマージ
2 parents fb4a3ed + bc1fb07 commit 47b0c38

26 files changed

+685
-373
lines changed

.github/workflows/code-check.yaml

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Code quality check
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
build:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: Swatinem/rust-cache@v2
12+
with:
13+
cache-all-crates: true
14+
shared-key: 'code-quality'
15+
cache-provider: 'github'
16+
- name: Setup clippy
17+
run: rustup component add clippy
18+
- name: Code review with clippy
19+
uses: giraffate/clippy-action@v1
20+
with:
21+
reporter: 'github-pr-review'
22+
filter_mode: 'nofilter'
23+
github_token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/run-test.yaml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Unit test & Integration test
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches: [ 'main' ]
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
run-tests:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: Swatinem/rust-cache@v2
17+
with:
18+
cache-all-crates: true
19+
shared-key: 'test-on-pr'
20+
key: 'main'
21+
save-if: ${{ github.ref == 'refs/heads/main' }} # mainブランチにコミットが追加された時のみキャッシュを保存する
22+
- name: Test core
23+
working-directory: core
24+
run: |
25+
cargo test
26+
cargo test --features=blocking
27+
- name: Integration test
28+
working-directory: tests
29+
run: cargo test
30+
31+
run-tests-wasm:
32+
runs-on: ubuntu-latest
33+
steps:
34+
- uses: actions/checkout@v4
35+
- uses: Swatinem/rust-cache@v2
36+
with:
37+
cache-all-crates: true
38+
shared-key: 'wasm-pack'
39+
key: 'main'
40+
save-if: ${{ github.ref == 'refs/heads/main' }} # mainブランチにコミットが追加された時のみキャッシュを保存する
41+
cache-provider: 'github'
42+
- name: Install wasm-pack
43+
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
44+
- name: Run wasm-pack test for core(japanese-address-parser)
45+
working-directory: core
46+
run: wasm-pack test --firefox --headless
47+
- name: Build check for wasm crate
48+
working-directory: wasm
49+
run: wasm-pack build --target web --scope toriyama

.github/workflows/wasm-pack-test.yaml

Lines changed: 0 additions & 27 deletions
This file was deleted.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ members = [
88
resolver = "2"
99

1010
[workspace.package]
11-
version = "0.1.5"
11+
version = "0.1.7"
1212
edition = "2021"
1313
description = "A Rust Library to parse japanese addresses."
1414
repository = "https://github.com/YuukiToriyama/japanese-address-parser"
@@ -18,6 +18,8 @@ keywords = ["parser", "geo", "wasm"]
1818
categories = ["parser-implementations", "wasm"]
1919

2020
[workspace.dependencies]
21+
serde = { version = "1.0.192", features = ["derive"] }
22+
tokio = { version = "1.38.0", features = ["rt", "macros"] }
2123
wasm-bindgen = "0.2.92"
2224
wasm-bindgen-futures = "0.4.42"
2325
wasm-bindgen-test = "0.3.42"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
[![Docs](https://docs.rs/japanese-address-parser/badge.svg)](https://docs.rs/japanese-address-parser)
44
[![Crates.io (latest)](https://img.shields.io/crates/v/japanese-address-parser)](https://crates.io/crates/japanese-address-parser)
55
![Rust Version](https://img.shields.io/badge/rust%20version-%3E%3D1.73.0-orange)
6-
[![Unit test & Code check](https://github.com/YuukiToriyama/japanese-address-parser/actions/workflows/code-check.yaml/badge.svg)](https://github.com/YuukiToriyama/japanese-address-parser/actions/workflows/code-check.yaml)
6+
[![Unit test & Integration test](https://github.com/YuukiToriyama/japanese-address-parser/actions/workflows/run-test.yaml/badge.svg?branch=main)](https://github.com/YuukiToriyama/japanese-address-parser/actions/workflows/run-test.yaml)
77

88
A Rust Library to parse japanese addresses.
99

core/Cargo.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,20 @@ crate-type = ["rlib", "cdylib"]
1616

1717
[features]
1818
default = []
19-
blocking = []
19+
blocking = ["reqwest/blocking"]
2020

2121
[dependencies]
2222
itertools = "0.13.0"
2323
js-sys = "0.3.67"
2424
nom = "7.1.3"
2525
rapidfuzz = "0.5.0"
2626
regex = "1.10.2"
27-
reqwest = { version = "0.12.3", default-features = false, features = ["json", "rustls-tls", "blocking"] }
28-
serde = { version = "1.0.192", features = ["derive"] }
27+
serde.workspace = true
28+
reqwest = { version = "0.12.5", default-features = false, features = ["json", "rustls-tls"] }
2929

3030
[dev-dependencies]
31-
tokio = { version = "1.38.0", features = ["rt", "macros"] }
31+
tokio.workspace = true
3232
wasm-bindgen-test = { workspace = true }
33+
34+
[target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies]
35+
mockito = "1.4.0" # mockitoがwasm32に対応していないため

core/src/api.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
pub mod city_master_api;
2-
pub mod prefecture_master_api;
1+
pub use crate::repository::geolonia::city_master_api;
2+
pub use crate::repository::geolonia::prefecture_master_api;
33

4-
use crate::api::city_master_api::CityMasterApi;
5-
use crate::api::prefecture_master_api::PrefectureMasterApi;
6-
use crate::entity::{City, Prefecture};
7-
use crate::err::Error;
4+
use crate::domain::geolonia::entity::{City, Prefecture};
5+
use crate::domain::geolonia::error::Error;
6+
use crate::repository::geolonia::city_master_api::CityMasterApi;
7+
use crate::repository::geolonia::prefecture_master_api::PrefectureMasterApi;
88

99
#[derive(Default)]
1010
pub struct AsyncApi {

core/src/domain.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod geolonia;

core/src/domain/geolonia.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
pub mod entity;
2+
pub mod error;

0 commit comments

Comments
 (0)