Skip to content

Commit

Permalink
Change GH-actions to full continuous integration
Browse files Browse the repository at this point in the history
Adapted from core NetTopologySuite project.
  • Loading branch information
FObermaier authored Apr 12, 2021
1 parent c604084 commit 6734917
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 22 deletions.
100 changes: 82 additions & 18 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
name: .NET
name: Full Continuous Integration

on:
push:
branches: [ develop ]
pull_request:
branches: [ develop ]
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest
pack:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true


strategy:
matrix:
os: [ ubuntu-latest, windows-latest, macOS-latest ]

steps:
- uses: huaxk/postgis-action@v1
- name: PostGis docker image
if: ${{ matrix.os == 'ubuntu-latest' }}
uses: huaxk/postgis-action@v1
with:
# See https://https://hub.docker.com/r/mdillon/postgis for available versions, if it
# is not specified, use the default value 'latest'
Expand All @@ -32,14 +34,76 @@ jobs:
# default database that is created when the image is first started. If it is not
# specified, then the value of postgresql user will be used.
postgresql db: 'postgis'
- uses: actions/checkout@v2
- name: Setup .NET

- name: Get source
uses: actions/checkout@v2

- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.x
- name: Restore dependencies
run: dotnet restore
dotnet-version: 3.1.406

- name: Build
run: dotnet build -c Release --no-restore
run: dotnet build -c Release -v minimal -p:WarningLevel=3

- name: Test
run: dotnet test -c Release --no-build --verbosity normal
run: dotnet test -c Release --no-build -v normal

- name: Pack
run: dotnet pack -c Release --no-build -o artifacts -p:NoWarn=NU5105

- name: Upload
uses: actions/upload-artifact@v2
with:
name: NuGet Package Files (${{ matrix.os }})
path: artifacts

deployToMyGet:
name: Deploy to MyGet
runs-on: ubuntu-latest

needs: pack
if: github.event_name == 'push' && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master')

steps:
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.406

- name: Download Package Files
uses: actions/download-artifact@v2
with:
name: NuGet Package Files (ubuntu-latest)
path: artifacts

- name: Publish Package Files to MyGet
run: dotnet nuget push artifacts/*.nupkg -s https://www.myget.org/F/nettopologysuite/api/v3/index.json -k $MYGET_API_KEY
shell: bash
env:
MYGET_API_KEY: ${{ secrets.MYGET_API_KEY }}

deployToNuGet:
name: Deploy to NuGet
runs-on: ubuntu-latest

needs: pack
if: github.event_name == 'push' && github.ref == 'refs/heads/master'

steps:
- name: Setup .NET Core 3.1
uses: actions/setup-dotnet@v1
with:
dotnet-version: 3.1.406

- name: Download Package Files
uses: actions/download-artifact@v2
with:
name: NuGet Package Files (ubuntu-latest)
path: artifacts

- name: Publish Package Files to NuGet
run: dotnet nuget push artifacts/*.nupkg -s https://api.nuget.org/v3/index.json -k $NUGET_API_KEY
shell: bash
env:
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }}
5 changes: 5 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@
<LangVersion>7.3</LangVersion> <!-- latest version supported by VS2017 -->

<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory)nts.snk</AssemblyOriginatorKeyFile>
<PackageIcon>icon.png</PackageIcon>
</PropertyGroup>

<ItemGroup>
<None Include="$(MSBuildThisFileDirectory)icon.png" Pack="true" PackagePath="\" />
</ItemGroup>

</Project>
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
PostGis IO module for NTS.
| Branch | Status
| --- | ---
| develop | ![.NET](https://github.com/NetTopologySuite/NetTopologySuite.IO.PostGis/workflows/.NET/badge.svg?branch=develop)
| [master](https://github.com/NetTopologySuite/NetTopologySuite.IO.PostGis/tree/master) | ![.NET](https://github.com/NetTopologySuite/NetTopologySuite.IO.PostGis/workflows/.NET/badge.svg?branch=master)
| develop | ![.NET](https://github.com/NetTopologySuite/NetTopologySuite.IO.PostGis/actions/workflows/dotnet.yml/badge.svg?branch=develop)
| [master](https://github.com/NetTopologySuite/NetTopologySuite.IO.PostGis/tree/master) | ![.NET](https://github.com/NetTopologySuite/NetTopologySuite.IO.PostGis/actions/workflows/dotnet.yml/badge.svg?branch=master)

## Install with NuGet package manager

Expand Down
Binary file added icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 10 additions & 1 deletion src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,15 @@
<NtsBuildMetadata Condition=" '$(NtsBuildMetadata)' == '' ">ci.appveyor.$(APPVEYOR_BUILD_NUMBER)</NtsBuildMetadata>
</PropertyGroup>

<!-- GitHub Actions -->
<PropertyGroup Condition=" '$(GITHUB_ACTIONS)' == 'True' ">
<Deterministic>true</Deterministic>
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
<NtsBuildMetadata Condition=" '$(NtsBuildMetadata)' == '' ">ci.github.$(GITHUB_ACTION)</NtsBuildMetadata>

<NtsOfficialRelease Condition=" '$(GITHUB_REF)' == 'refs/heads/master' And '$(GITHUB_EVENT_NAME)' == 'push' ">true</NtsOfficialRelease>
</PropertyGroup>

<!-- Fallback for local builds and CI environments we don't recognize -->
<PropertyGroup>
<NtsBuildMetadata Condition=" '$(NtsBuildMetadata)' == '' ">local</NtsBuildMetadata>
Expand All @@ -38,7 +47,7 @@
<PropertyGroup Label="Version numbers">
<!-- MAJOR, MINOR, and PATCH are defined according to SemVer 2.0.0. -->
<NtsMajorVersion>2</NtsMajorVersion>
<NtsMinorVersion>1</NtsMinorVersion>
<NtsMinorVersion>2</NtsMinorVersion>
<NtsPatchVersion>0</NtsPatchVersion>

<NtsBuildTimestamp>$([System.DateTime]::UtcNow.Ticks)</NtsBuildTimestamp>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
<Authors>NetTopologySuite - Team</Authors>
<Owners>NetTopologySuite - Team</Owners>
<PackageLicenseExpression>BSD-3-Clause</PackageLicenseExpression>
<PackageIconUrl>https://raw.githubusercontent.com/NetTopologySuite/GeoAPI/master/icon.png</PackageIconUrl>
<Description>This package contains the IO library to cope with PostGis spatial data.</Description>
<PackageTags>NTS;PostGis</PackageTags>
</PropertyGroup>
Expand Down

0 comments on commit 6734917

Please sign in to comment.