Skip to content

Commit

Permalink
Merge pull request #70 from mattjohnsonpint/updates
Browse files Browse the repository at this point in the history
Updates
  • Loading branch information
mattjohnsonpint authored Jan 26, 2025
2 parents deb5e6c + e105ef1 commit d96c340
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 34 deletions.
12 changes: 10 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,20 @@ env:

jobs:
build:
name: Build
name: Build / Test
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Restore
run: dotnet restore --nologo
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: pack-for-release
name: release

on:
workflow_dispatch:
Expand All @@ -13,7 +13,15 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install .NET SDKs
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
6.0.x
8.0.x
9.0.x
- name: Restore
run: dotnet restore --nologo
Expand All @@ -30,8 +38,11 @@ jobs:
- name: Pack
run: dotnet pack -c Release --nologo --no-build

- name: Push to NuGet
run: dotnet nuget push -s https://api.nuget.org/v3/index.json -k ${{secrets.NUGET_API_KEY}} **/*.nupkg

- name: Archive Artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: nuget-packages
path: src/**/Release/*.*nupkg
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Roslynator.Analyzers" Version="4.2.0" PrivateAssets="All" />
<PackageReference Include="Roslynator.Analyzers" Version="4.12.10" PrivateAssets="All" />
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="All" />
</ItemGroup>

Expand Down
4 changes: 2 additions & 2 deletions src/GeoTimeZone.DataBuilder/GeoTimeZone.DataBuilder.csproj
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<OutputType>Exe</OutputType>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="NetTopologySuite" Version="2.5.0" />
<PackageReference Include="NetTopologySuite.IO.ShapeFile" Version="2.1.0" />
<PackageReference Include="NetTopologySuite.IO.Esri.ShapeFile" Version="1.2.0" />
</ItemGroup>

</Project>
20 changes: 4 additions & 16 deletions src/GeoTimeZone.DataBuilder/TimeZoneShapeFileReader.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using NetTopologySuite.Features;
using NetTopologySuite.Geometries;
using NetTopologySuite.IO;
using NetTopologySuite.IO.Esri;

namespace GeoTimeZone.DataBuilder;

Expand All @@ -15,27 +13,17 @@ public TimeZoneShapeFileReader(string shapeFile)

public IEnumerable<TimeZoneFeature> ReadShapeFile()
{
using var reader = new ShapefileDataReader(_shapeFile, GeometryFactory.Default);
var header = reader.DbaseHeader;

while (reader.Read())
foreach (var feature in Shapefile.ReadAllFeatures(_shapeFile))
{
var attributes = new AttributesTable();
for (var i = 0; i < header.NumFields; i++)
{
var name = header.Fields[i].Name;
var value = reader.GetValue(i + 1);
attributes.Add(name, value);
}
var zone = (string) feature.Attributes["tzid"];

// skip uninhabited areas
var zone = (string) attributes["tzid"];
if (zone.Equals("uninhabited", StringComparison.OrdinalIgnoreCase))
{
continue;
}

yield return new TimeZoneFeature(zone, reader.Geometry);
yield return new TimeZoneFeature(zone, feature.Geometry);
}
}
}
2 changes: 1 addition & 1 deletion src/GeoTimeZone/GeoTimeZone.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<Description>Provides an IANA time zone identifier from latitude and longitude coordinates.</Description>
<Authors>Matt Johnson-Pint,Simon Bartlett</Authors>
<TargetFrameworks>net6.0;netstandard2.1;netstandard2.0;net462</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net462;net6.0;net8.0;net9.0</TargetFrameworks>
<PackageId>GeoTimeZone</PackageId>
<PackageTags>timezone;time;zone;geolocation;geo;latitude;longitude;coordinates;iana;tzdb</PackageTags>
<PackageProjectUrl>https://github.com/mattjohnsonpint/GeoTimeZone</PackageProjectUrl>
Expand Down
21 changes: 14 additions & 7 deletions test/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,30 @@
<Import Project="..\Directory.Build.props" />

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5">
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.12.0" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.8.2">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="xunit" Version="2.4.2" />
<PackageReference Include="Xunit.SkippableFact" Version="1.4.13" />
<PackageReference Include="Verify.Xunit" Version="19.5.0" />
<PackageReference Include="Verify.DiffPlex" Version="2.0.1" />
<PackageReference Include="xunit" Version="2.9.3" />
<PackageReference Include="Xunit.SkippableFact" Version="1.5.23" />
<PackageReference Include="Verify.DiffPlex" Version="3.1.2" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<PackageReference Include="Verify.Xunit" Version="28.2.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' != 'net6.0'">
<PackageReference Include="Verify.Xunit" Version="28.9.0" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net462'">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>

<ItemGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
<PackageReference Include="GitHubActionsTestLogger" Version="2.0.1" />
<PackageReference Include="GitHubActionsTestLogger" Version="2.4.1" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion test/GeoTimeZone.Tests/GeoTimeZone.Tests.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit d96c340

Please sign in to comment.