Skip to content

Commit bce0d1d

Browse files
committed
Merge remote-tracking branch 'original/master' into update-dependencies
2 parents 1db0b13 + 1736b26 commit bce0d1d

File tree

8 files changed

+70
-40
lines changed

8 files changed

+70
-40
lines changed

.github/pull_request_template.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
- [ ] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/master/CODE_OF_CONDUCT.md).
2+
- [ ] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
3+
---
4+

.github/workflows/test.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
on: push
2+
name: Run tests
3+
jobs:
4+
# The `ci-result` job doesn't actually test anything - it just aggregates the
5+
# overall build status for bors, otherwise our bors.toml would need an entry
6+
# for each individual job produced by the job-matrix.
7+
#
8+
# Ref: https://github.com/rust-lang/crater/blob/9ab6f9697c901c4a44025cf0a39b73ad5b37d198/.github/workflows/bors.yml#L125-L149
9+
#
10+
# ALL THE SUBSEQUENT JOBS NEED THEIR `name` ADDED TO THE `needs` SECTION OF THIS JOB!
11+
ci-result:
12+
name: ci result
13+
runs-on: ubuntu-latest
14+
needs:
15+
- geocoding
16+
steps:
17+
- name: Mark the job as a success
18+
if: success()
19+
run: exit 0
20+
- name: Mark the job as a failure
21+
if: "!success()"
22+
run: exit 1
23+
24+
geocoding:
25+
name: geocoding
26+
runs-on: ubuntu-latest
27+
if: "!contains(github.event.head_commit.message, '[skip ci]')"
28+
defaults:
29+
run:
30+
working-directory: .
31+
strategy:
32+
matrix:
33+
container_image: ["georust/geo-ci:rust-1.50", "georust/geo-ci:rust-1.51"]
34+
container:
35+
image: ${{ matrix.container_image }}
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v2
39+
- run: cargo install cargo-all-features
40+
- run: cargo build-all-features
41+
- run: cargo test-all-features

.travis.yml

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

CHANGES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44

55
- Switch GeoAdmin API to WGS84
66
- <https://github.com/georust/geocoding/pull/43>
7+
- Migrate to Github Actions
8+
- Update tests and dependencies
79

810
## 0.3.1
911

Cargo.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@
22
name = "geocoding"
33
description = "Geocoding library for Rust"
44
version = "0.3.1"
5-
authors = [
6-
"Stephan Hügel <urschrei@gmail.com>",
7-
"Blake Grotewold <hello@grotewold.me>",
8-
]
5+
authors = ["The Georust Developers <admins@georust.org>"]
96
license = "MIT OR Apache-2.0"
107
repository = "https://github.com/georust/geocoding"
118
keywords = ["gecoding", "geo", "gis", "geospatial"]
@@ -19,6 +16,7 @@ num-traits = "0.2"
1916
serde = { version = "1.0", features = ["derive"] }
2017
serde_json = "1.0"
2118
reqwest = { version = "0.11", default-features = false, features = [
19+
"default-tls",
2220
"blocking",
2321
"json",
2422
] }

bors.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
status = [
2+
"ci result",
3+
]

src/opencage.rs

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ impl<'a> Opencage<'a> {
210210
/// let res = oc.forward_full(&address, bbox).unwrap();
211211
/// let first_result = &res.results[0];
212212
/// // the first result is correct
213-
/// assert_eq!(first_result.formatted, "UCL, 188 Tottenham Court Road, London W1T 7PQ, United Kingdom");
213+
/// assert!(first_result.formatted.contains("UCL, 188 Tottenham Court Road"));
214214
///```
215215
///
216216
/// ```
@@ -238,10 +238,10 @@ impl<'a> Opencage<'a> {
238238
/// );
239239
/// let res = oc.forward_full(&address, bbox).unwrap();
240240
/// let first_result = &res.results[0];
241-
/// assert_eq!(
242-
/// first_result.formatted,
243-
/// "UCL, 188 Tottenham Court Road, London W1T 7PQ, United Kingdom"
244-
/// );
241+
/// assert!(
242+
/// first_result.formatted.contains(
243+
/// "UCL, 188 Tottenham Court Road"
244+
/// ));
245245
/// ```
246246
pub fn forward_full<T, U>(
247247
&self,
@@ -681,10 +681,7 @@ mod test {
681681
};
682682
let res = oc.forward_full(address, bbox).unwrap();
683683
let first_result = &res.results[0];
684-
assert_eq!(
685-
first_result.formatted,
686-
"UCL, 188 Tottenham Court Road, London W1T 7PQ, United Kingdom"
687-
);
684+
assert!(first_result.formatted.contains("UCL"));
688685
}
689686
#[test]
690687
fn forward_full_test_floats() {
@@ -696,10 +693,9 @@ mod test {
696693
);
697694
let res = oc.forward_full(address, bbox).unwrap();
698695
let first_result = &res.results[0];
699-
assert_eq!(
700-
first_result.formatted,
701-
"UCL, 188 Tottenham Court Road, London W1T 7PQ, United Kingdom"
702-
);
696+
assert!(first_result
697+
.formatted
698+
.contains("UCL, 188 Tottenham Court Road"));
703699
}
704700
#[test]
705701
fn forward_full_test_pointfrom() {
@@ -711,10 +707,9 @@ mod test {
711707
);
712708
let res = oc.forward_full(address, bbox).unwrap();
713709
let first_result = &res.results[0];
714-
assert_eq!(
715-
first_result.formatted,
716-
"UCL, 188 Tottenham Court Road, London W1T 7PQ, United Kingdom"
717-
);
710+
assert!(first_result
711+
.formatted
712+
.contains("UCL, 188 Tottenham Court Road"));
718713
}
719714
#[test]
720715
fn forward_full_test_pointinto() {
@@ -726,10 +721,9 @@ mod test {
726721
);
727722
let res = oc.forward_full(address, bbox).unwrap();
728723
let first_result = &res.results[0];
729-
assert_eq!(
730-
first_result.formatted,
731-
"UCL, 188 Tottenham Court Road, London W1T 7PQ, United Kingdom"
732-
);
724+
assert!(first_result
725+
.formatted
726+
.contains("Tottenham Court Road, London"));
733727
}
734728
#[test]
735729
fn forward_full_test_nobox() {

src/openstreetmap.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,13 +133,13 @@ impl Openstreetmap {
133133
/// (-0.13806939125061035, 51.51989264641164),
134134
/// (-0.13427138328552246, 51.52319711775629),
135135
/// );
136-
/// let params = OpenstreetmapParams::new(&"University College London")
136+
/// let params = OpenstreetmapParams::new(&"UCL CASA")
137137
/// .with_addressdetails(true)
138138
/// .with_viewbox(&viewbox)
139139
/// .build();
140140
/// let res: OpenstreetmapResponse<f64> = osm.forward_full(&params).unwrap();
141141
/// let result = res.features[0].properties.clone();
142-
/// assert!(result.display_name.contains("London Borough of Camden, London, Greater London"));
142+
/// assert!(result.display_name.contains("Gordon Square"));
143143
/// ```
144144
pub fn forward_full<T>(
145145
&self,
@@ -371,9 +371,7 @@ mod test {
371371
.build();
372372
let res: OpenstreetmapResponse<f64> = osm.forward_full(&params).unwrap();
373373
let result = res.features[0].properties.clone();
374-
assert!(result
375-
.display_name
376-
.contains("London Borough of Camden, London, Greater London"));
374+
assert!(result.display_name.contains("Gordon Square"));
377375
assert_eq!(result.address.unwrap().city.unwrap(), "London");
378376
}
379377

0 commit comments

Comments
 (0)