Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/daily_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Daily Build
# This job builds and publishes to GitHub Packages.
# It uses branch selected with workflow dispatch
# It depends on the included tests job to complete successfully.
on:
workflow_dispatch: {}

jobs:
test_and_publish:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
6.0.x
3.1.x
- name: Restore dependencies
run: dotnet restore
- name: Set version ''5.0.0-daily' variable
run: |
Version='5.0.0-daily'
echo "VERSION=$Version" >> $GITHUB_ENV
echo "Version: $Version"
- name: Get commit hash
run: |
COMMIT_HASH=$(git rev-parse --short HEAD)
echo "COMMIT_HASH=$COMMIT_HASH" >> $GITHUB_ENV
echo "Commit Hash: $COMMIT_HASH"
- name: Build Test
run: dotnet build --no-restore --configuration Release -p:Nullable=disable -p:nowarn=1591
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
- name: Build and pack daily build
run: |
dotnet build --no-restore --configuration Release Ical.Net/Ical.Net.csproj -p:Version=${{env.VERSION}} -p:FileVersion=${{env.VERSION}}.${{github.run_number}} -p:VersionSuffix=${{env.COMMIT_HASH}} -p:Nullable=disable -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:ContinuousIntegrationBuild=true
dotnet pack --configuration Release Ical.Net/Ical.Net.csproj -p:Version=${{env.VERSION}} -p:PackageReleaseNotes="Commit: ${{env.COMMIT_HASH}}" -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg --no-build -p:PackageVersion=${{env.VERSION}}.${{github.run_number}}
- name: Store artifacts
uses: actions/upload-artifact@v4
with:
name: ICal.Net_pkg_${{env.VERSION}}.${{github.run_number}}
path: |
Ical.Net/bin/Release/**/*.nupkg
Ical.Net/bin/Release/**/*.snupkg
- name: Push package to GitHub Packages
run: dotnet nuget push Ical.Net/bin/Release/Ical.Net.${{env.VERSION}}.${{github.run_number}}.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate
34 changes: 26 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish
# This job builds and and publishes the package to NuGet.
# This job builds and publishes the package to NuGet.
# It depends on the included tests job to complete successfully.
# The version number is determined by the latest tag for the 'main' branch selected with workflow dispatch.
# The version number is determined by the latest 'v*' tag for the main branch.
on:
workflow_dispatch: {}

Expand All @@ -10,16 +10,27 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Checkout main
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
ref: main
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: |
8.0.x
6.0.x
3.1.x
- name: Get version tag
# The latest tag for the selected branch.
# Get it and strip off any leading 'v' from the version tag
run: |
Version=$(git tag --list 'v*' --sort=-v:refname | head -n 1 | sed 's/^v//')
echo "VERSION=$Version" >> $GITHUB_ENV
echo "Version: $Version"
- name: Reset branch to specified tag
run: git reset --hard v${{ env.VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand All @@ -32,22 +43,29 @@ jobs:
needs: tests

steps:
- uses: actions/checkout@v4
- name: Checkout main
uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for all tags and branches
- uses: actions/setup-dotnet@v4
ref: main
- name: Setup .NET
uses: actions/setup-dotnet@v4
with:
dotnet-version: 8.0.x
dotnet-version: |
8.0.x
- name: Get version tag
# The latest tag for the selected branch.
# Get it and strip off any leading 'v' from the version tag
run: |
Version=$(git describe --tags --abbrev=0 | sed 's/^v//')
Version=$(git tag --list 'v*' --sort=-v:refname | head -n 1 | sed 's/^v//')
echo "VERSION=$Version" >> $GITHUB_ENV
echo "Version: $Version"
- name: Reset branch to specified tag
run: git reset --hard v${{ env.VERSION }}
- name: Restore dependencies
run: dotnet restore
- name: Build and pack for publishing
run: |
dotnet restore
dotnet build --configuration Release Ical.Net/Ical.Net.csproj -p:Version=${{env.VERSION}} -p:FileVersion=${{env.VERSION}}.${{github.run_number}} -p:Nullable=disable -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg -p:ContinuousIntegrationBuild=true
dotnet pack --configuration Release Ical.Net/Ical.Net.csproj -p:Version=${{env.VERSION}} -p:IncludeSymbols=true -p:SymbolPackageFormat=snupkg --no-build -p:PackageVersion=${{env.VERSION}}
- name: Store artifacts
Expand Down
133 changes: 61 additions & 72 deletions Ical.Net.Tests/RecurrenceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3197,83 +3197,72 @@ public void OccurrenceMustBeCompletelyContainedWithinSearchRange()
Assert.That(occurrences.Last().StartTime.Equals(lastExpected), Is.True);
}

/// <summary>
/// Evaluate relevancy and validity of the request.
/// Find a solution for issue #120 or close forever
/// </summary>
[Test, Ignore("No solution for issue #120 yet", Until = "2024-12-31")]
[Test]
public void EventsWithShareUidsShouldGenerateASingleRecurrenceSet()
{
//https://github.com/rianjs/ical.net/issues/120 dated Sep 5, 2016
const string ical =
@"BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Calendar 2
X-WR-TIMEZONE:Europe/Bucharest
BEGIN:VEVENT
DTSTART;TZID=Europe/Bucharest:20160829T110000
DTEND;TZID=Europe/Bucharest:20160829T163000
RRULE:FREQ=DAILY
DTSTAMP:20160901T104339Z
UID:[email protected]
CREATED:20160901T104300Z
DESCRIPTION:
LAST-MODIFIED:20160901T104311Z
LOCATION:
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:testRScuAD
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Bucharest:20160901T163000
DTEND;TZID=Europe/Bucharest:20160901T220000
DTSTAMP:20160901T104339Z
UID:[email protected]
RECURRENCE-ID;TZID=Europe/Bucharest:20160901T110000
CREATED:20160901T104300Z
DESCRIPTION:
LAST-MODIFIED:20160901T104314Z
LOCATION:
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:testRScuAD
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Bucharest:20160903T070000
DTEND;TZID=Europe/Bucharest:20160903T123000
DTSTAMP:20160901T104339Z
UID:[email protected]
RECURRENCE-ID;TZID=Europe/Bucharest:20160903T110000
CREATED:20160901T104300Z
DESCRIPTION:
LAST-MODIFIED:20160901T104315Z
LOCATION:
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:testRScuAD
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR";

var calendars = CalendarCollection.Load(ical);
var events = calendars.SelectMany(c => c.Events).ToList();
// This test goes back to issue #120
const string ical = """
BEGIN:VCALENDAR
PRODID:-//Google Inc//Google Calendar 70.9054//EN
VERSION:2.0
CALSCALE:GREGORIAN
METHOD:PUBLISH
X-WR-CALNAME:Calendar 2
X-WR-TIMEZONE:Europe/Bucharest
BEGIN:VEVENT
DTSTART;TZID=Europe/Bucharest:20160829T110000
DTEND;TZID=Europe/Bucharest:20160829T163000
RRULE:FREQ=DAILY
DTSTAMP:20160901T104339Z
UID:[email protected]
CREATED:20160901T104300Z
DESCRIPTION:
LAST-MODIFIED:20160901T104311Z
LOCATION:
SEQUENCE:1
STATUS:CONFIRMED
SUMMARY:testRScuAD
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Bucharest:20160901T163000
DTEND;TZID=Europe/Bucharest:20160901T220000
DTSTAMP:20160901T104339Z
UID:[email protected]
RECURRENCE-ID;TZID=Europe/Bucharest:20160901T110000
CREATED:20160901T104300Z
DESCRIPTION:
LAST-MODIFIED:20160901T104314Z
LOCATION:
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:testRScuAD
TRANSP:OPAQUE
END:VEVENT
BEGIN:VEVENT
DTSTART;TZID=Europe/Bucharest:20160903T070000
DTEND;TZID=Europe/Bucharest:20160903T123000
DTSTAMP:20160901T104339Z
UID:[email protected]
RECURRENCE-ID;TZID=Europe/Bucharest:20160903T110000
CREATED:20160901T104300Z
DESCRIPTION:
LAST-MODIFIED:20160901T104315Z
LOCATION:
SEQUENCE:2
STATUS:CONFIRMED
SUMMARY:testRScuAD
TRANSP:OPAQUE
END:VEVENT
END:VCALENDAR
""";

var startSearch = DateTime.Parse("2016-08-01T00:00:00");
var endSearch = startSearch.AddDays(45);
var calendar = Calendar.Load(ical);

//The API should be something like:
//var occurrences = calendar.GetOccurrences(string eventUid, DateTime startSearch, DateTime endSearch);

var occurrences = new HashSet<Occurrence>();

var orderedOccurrences = occurrences
var orderedOccurrences = calendar.GetOccurrences()
.Take(10)
.Select(o => o.Period)
.OrderBy(p => p.StartTime)
.ToList();

var expectedSept1Start = new CalDateTime(DateTime.Parse("2016-09-01T16:30:00"), "Europe/Bucharest");
Expand All @@ -3285,7 +3274,7 @@ public void EventsWithShareUidsShouldGenerateASingleRecurrenceSet()
});

var expectedSept3Start = new CalDateTime(DateTime.Parse("2016-09-03T07:00:00"), "Europe/Bucharest");
var expectedSept3End = new CalDateTime(DateTime.Parse("2016-09-01T12:30:00"), "Europe/Bucharest");
var expectedSept3End = new CalDateTime(DateTime.Parse("2016-09-03T12:30:00"), "Europe/Bucharest");
Assert.Multiple(() =>
{
Assert.That(orderedOccurrences[5].StartTime, Is.EqualTo(expectedSept3Start));
Expand Down
Loading