Skip to content

Commit

Permalink
Simplify CI and bump geo
Browse files Browse the repository at this point in the history
  • Loading branch information
lnicola committed Oct 8, 2024
1 parent ef3ab70 commit 70651ba
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 17 deletions.
47 changes: 38 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
on: push
on:
push:
pull_request:
workflow_dispatch:

name: Run tests
jobs:
# The `ci-result` job doesn't actually test anything - it just aggregates the
Expand Down Expand Up @@ -30,20 +34,45 @@ jobs:
working-directory: .
strategy:
matrix:
container_image:
toolchain:
# We aim to support rust-stable plus (at least) the prior 3 releases,
# giving us about 6 months of coverage.
#
# Minimum supported rust version (MSRV)
- "georust/geo-ci:rust-1.67"
# Two most recent releases - we omit older ones for expedient CI
- "georust/geo-ci:rust-1.69"
- "georust/geo-ci:rust-1.70"
container:
image: ${{ matrix.container_image }}
- "1.67"
# Two recent releases - we omit older ones for expedient CI
- "1.80"
- "stable"
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install stable
run: |
rustup toolchain install ${{ matrix.toolchain }} --no-self-update --profile minimal --component rust-src clippy
rustup component add rustfmt clippy
- name: Check with Rustfmt
run: cargo fmt --all --check

- name: Build (--no-default-features)
run: cargo build --no-default-features
- name: Build (--all-features)
run: cargo build --all-features
- name: Run tests (--all-features)
run: cargo test --all-features
- name: Build
run: cargo build
- name: Run tests
run: cargo test

- name: Check with Clippy (--no-default-features)
run: cargo clippy --tests --no-default-features -- -D warnings
- name: Check with Clippy (--all-features)
run: cargo clippy --tests --all-features -- -D warnings
- name: Check with Clippy
run: cargo clippy --tests -- -D warnings

- run: cargo build --no-default-features
- run: cargo test --no-default-features
- run: cargo build --all-features
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,4 @@ serde = { version = "1.0", features = ["derive"], optional = true }

[dev-dependencies]
assert_approx_eq = "1"
geo = "0.27"
geo = "0.28"
19 changes: 12 additions & 7 deletions src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,11 @@ fn write_fix_if_exists<W: Write>(fix: &Option<Fix>, writer: &mut EventWriter<W>)
Ok(())
}

fn write_track<W: Write>(version: GpxVersion, track: &Track, writer: &mut EventWriter<W>) -> GpxResult<()> {
fn write_track<W: Write>(
version: GpxVersion,
track: &Track,
writer: &mut EventWriter<W>,
) -> GpxResult<()> {
write_xml_event(XmlEvent::start_element("trk"), writer)?;
write_string_if_exists("name", &track.name, writer)?;
write_string_if_exists("cmt", &track.comment, writer)?;
Expand All @@ -310,7 +314,11 @@ fn write_track<W: Write>(version: GpxVersion, track: &Track, writer: &mut EventW
Ok(())
}

fn write_route<W: Write>(version: GpxVersion, route: &Route, writer: &mut EventWriter<W>) -> GpxResult<()> {
fn write_route<W: Write>(
version: GpxVersion,
route: &Route,
writer: &mut EventWriter<W>,
) -> GpxResult<()> {
write_xml_event(XmlEvent::start_element("rte"), writer)?;
write_string_if_exists("name", &route.name, writer)?;
write_string_if_exists("cmt", &route.comment, writer)?;
Expand Down Expand Up @@ -354,11 +362,8 @@ fn write_waypoint<W: Write>(
writer,
)?;
write_value_if_exists("ele", &waypoint.elevation, writer)?;
match version {
GpxVersion::Gpx10 => {
write_value_if_exists("speed", &waypoint.speed, writer)?;
}
_ => {}
if version == GpxVersion::Gpx10 {
write_value_if_exists("speed", &waypoint.speed, writer)?;
}
write_time_if_exists(&waypoint.time, writer)?;
write_value_if_exists("geoidheight", &waypoint.geoidheight, writer)?;
Expand Down

0 comments on commit 70651ba

Please sign in to comment.