-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
919 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# These are supported funding model platforms | ||
|
||
github: nager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Build, Test & Publish | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'src/**' | ||
- '.github/workflows/**' | ||
branches: [ main ] | ||
pull_request: | ||
paths: | ||
- 'src/**' | ||
branches: [ main ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Setup .NET | ||
uses: actions/setup-dotnet@v4 | ||
with: | ||
dotnet-version: 8.0.x | ||
- name: Restore dependencies | ||
working-directory: ./src | ||
run: dotnet restore | ||
- name: Build | ||
working-directory: ./src | ||
run: dotnet build --configuration Release --no-restore | ||
- name: Test | ||
working-directory: ./src | ||
run: | | ||
dotnet test --configuration Release --no-restore --no-build --verbosity normal | ||
- name: Build project and generate NuGet package | ||
run: | | ||
dotnet pack --configuration Release --output $GITHUB_WORKSPACE/out src/Nager.LongWeekend/Nager.LongWeekend.csproj | ||
- name: Push NuGet package | ||
if: github.event_name != 'pull_request' | ||
run: | | ||
cd $GITHUB_WORKSPACE/out | ||
dotnet nuget push *.nupkg --source https://api.nuget.org/v3/index.json --api-key ${{secrets.NUGET_TOKEN}} --skip-duplicate |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# Nager.LongWeekend | ||
|
||
Nager.LongWeekend is an open-source project designed to calculate potential long weekends based on public holidays. | ||
By providing a list of holidays, it determines where extended weekends are possible. | ||
|
||
## nuget | ||
|
||
The package is available on [nuget](https://www.nuget.org/packages/Nager.LongWeekend) | ||
``` | ||
PM> install-package Nager.LongWeekend | ||
``` | ||
|
||
## Example | ||
|
||
```cs | ||
var holidays = new HolidayRecord[] | ||
{ | ||
new HolidayRecord | ||
{ | ||
Date = new DateOnly(2020, 01, 10), | ||
Name = "Holiday Friday" | ||
}, | ||
new HolidayRecord | ||
{ | ||
Date = new DateOnly(2020, 01, 13), | ||
Name = "Holiday Monday" | ||
} | ||
}; | ||
|
||
var weekendDays = new DayOfWeek[] { DayOfWeek.Saturday, DayOfWeek.Sunday }; | ||
var availableBridgeDays = 1; | ||
|
||
var longWeekendCalculator = new LongWeekendCalculator(holidays, weekendDays); | ||
var longWeekends = longWeekendCalculator.Calculate(availableBridgeDays); | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
global using Microsoft.VisualStudio.TestTools.UnitTesting; |
Oops, something went wrong.