Skip to content

Commit

Permalink
Merge pull request #277 from martincostello/GitHub-Actions
Browse files Browse the repository at this point in the history
Switch to GitHub Actions
  • Loading branch information
martincostello authored Sep 16, 2020
2 parents 5a50d31 + ae82b8f commit 8a910a6
Show file tree
Hide file tree
Showing 16 changed files with 651 additions and 329 deletions.
13 changes: 6 additions & 7 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,19 @@ If you wish to contribute code, please consider the guidelines below:
1. If fixing a bug or adding new functionality, add any tests you deem appropriate.
1. Test coverage should not go down.
1. Note any breaking changes in your PR description.
1. Ensure ```Build.ps1```/```build.sh``` runs with no errors or warnings and all the tests pass.
1. Open a pull request against the ```master``` branch, referencing your issue, if appropriate.
1. Ensure `build.ps1` runs with no errors or warnings and all the tests pass.
1. Open a pull request against the `master` branch, referencing your issue, if appropriate.

Once your pull request is opened, the project maintainers will assess it for validity and an appropriate level of quality. For example, the Pull Request status checks should all be green.

If the project maintainers are satisfied that your contribution is appropriate it will be merged into the master branch when appropriate and it will then be released when the library is next published to [NuGet](https://www.nuget.org/profiles/JUSTEAT_OSS).

## Releases

* AppVeyor and Travis CI should be green on the master branch.
* Check the version number has been updated since the last release - follow [SemVer rules](http://semver.org)
* Bump the version in `appveyor.yml` and `version.props` if neccessary.
* Bump the version in `version.props` if neccessary.
* Update the CHANGELOG.md
* Create a new release in [GitHub](https://github.com/justeat/JustEat.StatsD/releases) with appropriate release notes and tagged version number (for example `v1.2.3-beta01`).
* Wait for the tag build to complete in AppVeyor and check the metadata/version is as expected.
* Push the tag build's package to [NuGet](https://www.nuget.org/packages/JustEat.StatsD) using an AppVeyor deployment and wait for the pushed version to be indexed.
* Create a new release in [GitHub](https://github.com/justeat/JustEat.StatsD/releases) with appropriate release notes and tagged version number (for example `v1.2.3`).
* A build will run for the tag in GitHub Actions and publish the package to [NuGet](https://www.nuget.org/packages/JustEat.StatsD).
* Wait for NuGet.org to index the package.
* Share the news! 🎉
79 changes: 79 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
name: build

on:
push:
branches: [ master ]
tags: [ v* ]
pull_request:
branches: [ master ]
workflow_dispatch:

jobs:
build:
name: ${{ matrix.os }}
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ macos-latest, ubuntu-latest, windows-latest ]
include:
- os: macos-latest
os_name: macos
- os: ubuntu-latest
os_name: linux
- os: windows-latest
os_name: windows

steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v1

- name: Install StatsD
shell: pwsh
if: ${{ runner.os == 'Windows' }}
run: |
git clone https://github.com/etsy/statsd.git ./_statsd
Start-Process "node" -ArgumentList "./_statsd/stats.js ./tests/JustEat.StatsD.Tests/statsdconfig.js" -WindowStyle Hidden
- name: Install StatsD
shell: bash
if: ${{ runner.os != 'Windows' }}
run: |
git clone https://github.com/etsy/statsd.git ./_statsd
node ./_statsd/stats.js ./tests/JustEat.StatsD.Tests/statsdconfig.js &
- name: Build, Test and Package
shell: pwsh
run: ./build.ps1
env:
DOTNET_CLI_TELEMETRY_OPTOUT: true
DOTNET_NO_LOGO: true
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
NUGET_XMLDOC_MODE: skip

- uses: codecov/codecov-action@v1
name: Upload coverage to Codecov
with:
file: ./artifacts/coverage.netcoreapp3.1.cobertura.xml
flags: ${{ matrix.os_name }}

- name: Publish artifacts
uses: actions/upload-artifact@v1
with:
name: artifacts-${{ matrix.os_name }}
path: ./artifacts

- name: Publish NuGet packages
uses: actions/upload-artifact@v1
with:
name: packages-${{ matrix.os_name }}
path: ./artifacts/packages

- name: Push NuGet packages to NuGet.org
run: dotnet nuget push "artifacts\packages\*.nupkg" --api-key ${{ secrets.NUGET_TOKEN }} --skip-duplicate --source https://api.nuget.org/v3/index.json
if: ${{ github.repository_owner == 'justeat' && startsWith(github.ref, 'refs/tags/v') && runner.os == 'Windows' }}
20 changes: 20 additions & 0 deletions .github/workflows/update-dotnet-sdk.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: update-dotnet-sdk

on:
schedule:
- cron: '0 */6 * * *'
workflow_dispatch:

jobs:
build:
name: Update .NET SDK
runs-on: windows-latest

steps:

- name: Checkout code
uses: actions/checkout@v2

- name: Update .NET SDK
shell: pwsh
run: ./update-dotnet-sdk.ps1 -Channel "3.1" -GitHubToken ${{ secrets.GITHUB_TOKEN }} -UserName "github-actions[bot]" -UserEmail "github-actions[bot]@users.noreply.github.com"
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -482,5 +482,5 @@ healthchecksdb

# End of https://www.gitignore.io/api/rider,macos,windows,visualstudio,visualstudiocode

# build.sh can install a local dotnet sdk under this directory
# build.ps1 can install a local .NET SDK under this directory
.dotnetcli
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

151 changes: 0 additions & 151 deletions Build.ps1

This file was deleted.

5 changes: 1 addition & 4 deletions JustEat.StatsD.sln
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Assets", "Assets", "{06BE4D
.editorconfig = .editorconfig
.gitattributes = .gitattributes
.gitignore = .gitignore
.travis.yml = .travis.yml
appveyor.yml = appveyor.yml
Build.ps1 = Build.ps1
build.sh = build.sh
build.ps1 = build.ps1
CHANGELOG.md = CHANGELOG.md
Directory.Build.props = Directory.Build.props
Directory.Build.targets = Directory.Build.targets
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

[![NuGet version](https://buildstats.info/nuget/JustEat.StatsD?includePreReleases=false)](http://www.nuget.org/packages/JustEat.StatsD)

| | Linux | Windows |
|:-:|:-:|:-:|
| **Build Status** | [![Build status](https://img.shields.io/travis/justeat/JustEat.StatsD/master.svg)](https://travis-ci.org/justeat/JustEat.StatsD) | [![Build status](https://img.shields.io/appveyor/ci/justeattech/justeat-statsd/master.svg)](https://ci.appveyor.com/project/justeattech/justeat-statsd) [![codecov](https://codecov.io/gh/justeat/JustEat.StatsD/branch/master/graph/badge.svg)](https://codecov.io/gh/justeat/JustEat.StatsD) |
| **Build History** | [![Build history](https://buildstats.info/travisci/chart/justeat/JustEat.StatsD?branch=master&includeBuildsFromPullRequest=false)](https://travis-ci.org/justeat/JustEat.StatsD) | [![Build history](https://buildstats.info/appveyor/chart/justeattech/justeat-statsd?branch=master&includeBuildsFromPullRequest=false)](https://ci.appveyor.com/project/justeattech/justeat-statsd) |
[![Build status](https://github.com/justeat/JustEat.StatsD/workflows/build/badge.svg?branch=master&event=push)](https://github.com/justeat/JustEat.StatsD/actions?query=workflow%3Abuild+branch%3Amaster+event%3Apush)

[![codecov](https://codecov.io/gh/justeat/JustEat.StatsD/branch/master/graph/badge.svg)](https://codecov.io/gh/justeat/JustEat.StatsD)

## Summary

Expand All @@ -19,7 +18,6 @@ We use this library within our components to publish [StatsD](http://github.com/
* `netstandard2.0`
* `netstandard2.1`
* `netcoreapp2.1`
* `netcoreapp2.2`

### Features

Expand Down Expand Up @@ -69,7 +67,7 @@ public class MyService

#### Simplest example

No service registration or IoC. Works for both .NET 4.5.1 and .NET Core.
No service registration or IoC. Works for both .NET Framework and .NET Core.

```csharp
var statsDConfig = new StatsDConfiguration { Host = "metrics_server.mycompany.com" };
Expand Down Expand Up @@ -118,7 +116,7 @@ services.AddStatsD(
});
```

#### .NET 4.5.1
#### .NET Framework

An example of IoC in Ninject for StatsD publisher with values for all options, read from configuration:

Expand Down
Loading

0 comments on commit 8a910a6

Please sign in to comment.