From 0926b8f0f76e0468887f0c1696fd4b4e183115ef Mon Sep 17 00:00:00 2001 From: Michael Kriese Date: Mon, 22 Nov 2021 12:24:22 +0100 Subject: [PATCH] feat: refactor pacakges (#17) Use GitHub actions BREAKING CHANGE: drop deprecated framworks --- .appveyor.yml | 44 --------- .github/workflows/build.yml | 35 +++++++ .vscode/tasks.json | 35 ++++--- CHANGELOG.md | 4 + NCrontab.Advanced.Tests/CronInstanceTests.cs | 85 ++++++++-------- .../NCrontab.Advanced.Tests.csproj | 98 ++----------------- .../Properties/AssemblyInfo.cs | 36 ------- NCrontab.Advanced/Directory.Build.props | 6 +- NCrontab.Advanced/NCrontab.Advanced.csproj | 8 +- .../NCrontab.Advanced.nuget.targets | 6 -- README.md | 5 +- 11 files changed, 120 insertions(+), 242 deletions(-) delete mode 100644 .appveyor.yml create mode 100644 .github/workflows/build.yml delete mode 100644 NCrontab.Advanced.Tests/Properties/AssemblyInfo.cs delete mode 100644 NCrontab.Advanced/NCrontab.Advanced.nuget.targets diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index e6802a8..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,44 +0,0 @@ -pull_requests: - do_not_increment_build_number: true -branches: - only: - - master - - dev - - /renovate\/.*/ -skip_tags: true -max_jobs: 1 -skip_commits: - files: - - README.md - - CHANGELOG.md - - .editorconfig - - .gitignore - -image: Visual Studio 2017 - -cache: - - '%USERPROFILE%\.nuget\packages -> **\*.csproj' - -init: - - git config --global core.autocrlf true - -nuget: - account_feed: false - project_feed: true - disable_publish_on_pr: true - -configuration: Release - -before_build: - - dotnet --version - - dotnet restore --verbosity m - -build: - verbosity: minimal - publish_nuget: true - publish_nuget_symbols: false - -test: - assemblies: - only: - - 'NCrontab.Advanced.Tests\bin\**\NCrontab.Advanced.Tests.dll' diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..be10924 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: build + +on: + push: + branches: + - main + - 'renovate/**' + pull_request: + + +concurrency: + group: ${{ github.workflow }}-${{ github.event.number || github.ref }} + cancel-in-progress: true + +jobs: + build: + + runs-on: windows-latest + + steps: + - uses: actions/checkout@v2 + + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + + - name: Restore dependencies + run: dotnet restore + + - name: Build + run: dotnet build --no-restore + + - name: Test + run: dotnet test --no-build --verbosity normal diff --git a/.vscode/tasks.json b/.vscode/tasks.json index f110bd9..7ad9993 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -1,17 +1,20 @@ { - // See https://go.microsoft.com/fwlink/?LinkId=733558 - // for the documentation about the tasks.json format - "version": "0.1.0", - "command": "dotnet", - "isShellCommand": true, - "args": [], - "tasks": [ - { - "taskName": "build", - "args": [ "NCrontab.Advanced" ], - "isBuildCommand": true, - "showOutput": "silent", - "problemMatcher": "$msCompile" - } - ] -} \ No newline at end of file + // See https://go.microsoft.com/fwlink/?LinkId=733558 + // for the documentation about the tasks.json format + "version": "2.0.0", + "command": "dotnet", + "args": [], + "tasks": [ + { + "label": "build", + "type": "shell", + "command": "dotnet", + "args": ["build", "NCrontab.Advanced"], + "problemMatcher": "$msCompile", + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/CHANGELOG.md b/CHANGELOG.md index 83ba08e..ff51dbc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Build on GitHub actions +- Drop deprecated frameworks + ## [2.0.0] - 2019-01-16 ### Added - Changes from [Joe Coutcher](https://github.com/jcoutch/NCrontab-Advanced) v1.3.15. diff --git a/NCrontab.Advanced.Tests/CronInstanceTests.cs b/NCrontab.Advanced.Tests/CronInstanceTests.cs index 68c900f..bef14c9 100644 --- a/NCrontab.Advanced.Tests/CronInstanceTests.cs +++ b/NCrontab.Advanced.Tests/CronInstanceTests.cs @@ -6,14 +6,14 @@ // #endregion -using System; -using System.Diagnostics; -using System.Globalization; -using System.Linq; using Microsoft.VisualStudio.TestTools.UnitTesting; using NCrontab.Advanced.Enumerations; using NCrontab.Advanced.Exceptions; using NCrontab.Advanced.Tests.Extensions; +using System; +using System.Diagnostics; +using System.Globalization; +using System.Linq; namespace NCrontab.Advanced.Tests { @@ -65,43 +65,43 @@ public void InvalidPatternCount() Assert2.Throws(() => CrontabSchedule.Parse("* * * * * * * *", CronStringFormat.WithSecondsAndYears)); } - [TestMethod] - public void OutOfBoundsValues() - { - Assert2.Throws(() => CrontabSchedule.Parse("-1 * * * * *", CronStringFormat.WithSeconds)); - Assert2.Throws(() => CrontabSchedule.Parse("60 * * * * *", CronStringFormat.WithSeconds)); + [TestMethod] + public void OutOfBoundsValues() + { + Assert2.Throws(() => CrontabSchedule.Parse("-1 * * * * *", CronStringFormat.WithSeconds)); + Assert2.Throws(() => CrontabSchedule.Parse("60 * * * * *", CronStringFormat.WithSeconds)); - Assert2.Throws(() => CrontabSchedule.Parse("* * * * * 0", CronStringFormat.WithYears)); - Assert2.Throws(() => CrontabSchedule.Parse("* * * * * 10000", CronStringFormat.WithYears)); + Assert2.Throws(() => CrontabSchedule.Parse("* * * * * 0", CronStringFormat.WithYears)); + Assert2.Throws(() => CrontabSchedule.Parse("* * * * * 10000", CronStringFormat.WithYears)); - Assert2.Throws(() => CrontabSchedule.Parse("-1 * * * *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("60 * * * *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("-1 * * * *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("60 * * * *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* -1 * * *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* 24 * * *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* -1 * * *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* 24 * * *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* * 0 * *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* * 32 * *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* * 0 * *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* * 32 * *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* * * 0 *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* * * 13 *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* * * 0 *", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* * * 13 *", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* * * * -1", CronStringFormat.Default)); - Assert2.Throws(() => CrontabSchedule.Parse("* * * * 8", CronStringFormat.Default)); - } + Assert2.Throws(() => CrontabSchedule.Parse("* * * * -1", CronStringFormat.Default)); + Assert2.Throws(() => CrontabSchedule.Parse("* * * * 8", CronStringFormat.Default)); + } - [TestMethod] - public void SundayProcessesCorrectly() - { - var tests = new[] - { - new { startTime = "01/01/2016 00:00:00", inputString = "0 0 * * 0", nextOccurence = "03/01/2016 00:00:00", cronStringFormat = CronStringFormat.Default }, - new { startTime = "01/01/2016 00:00:00", inputString = "0 0 * * 7", nextOccurence = "03/01/2016 00:00:00", cronStringFormat = CronStringFormat.Default }, - }; + [TestMethod] + public void SundayProcessesCorrectly() + { + var tests = new[] + { + new { startTime = "01/01/2016 00:00:00", inputString = "0 0 * * 0", nextOccurence = "03/01/2016 00:00:00", cronStringFormat = CronStringFormat.Default }, + new { startTime = "01/01/2016 00:00:00", inputString = "0 0 * * 7", nextOccurence = "03/01/2016 00:00:00", cronStringFormat = CronStringFormat.Default }, + }; - foreach (var test in tests) - CronCall(test.startTime, test.inputString, test.nextOccurence, test.cronStringFormat); - } + foreach (var test in tests) + CronCall(test.startTime, test.inputString, test.nextOccurence, test.cronStringFormat); + } [TestMethod] public void ThirtyFirstWeekdayForMonthsWithLessThanThirtyDaysProcessesCorrectly() @@ -131,13 +131,13 @@ public void Formatting() { var tests = new[] { new { inputString = "* 1-2,3 * * *" , outputString = "* 1-2,3 * * *" , cronStringFormat = CronStringFormat.Default }, - new { inputString = "* * * */2 *" , outputString = "* * * */2 *" , cronStringFormat = CronStringFormat.Default }, - new { inputString = "10-40/15 * * * *" , outputString = "10-40/15 * * * *" , cronStringFormat = CronStringFormat.Default }, - new { inputString = "* * * Mar,Jan,Aug Fri,Mon-Tue" , outputString = "* * * 3,1,8 5,1-2" , cronStringFormat = CronStringFormat.Default }, - new { inputString = "1 * 1-2,3 * * *" , outputString = "1 * 1-2,3 * * *" , cronStringFormat = CronStringFormat.WithSeconds }, - new { inputString = "22 * * * */2 *" , outputString = "22 * * * */2 *" , cronStringFormat = CronStringFormat.WithSeconds }, - new { inputString = "33 10-40/15 * * * *" , outputString = "33 10-40/15 * * * *" , cronStringFormat = CronStringFormat.WithSeconds }, - new { inputString = "55 * * * Mar,Jan,Aug Fri,Mon-Tue", outputString = "55 * * * 3,1,8 5,1-2" , cronStringFormat = CronStringFormat.WithSeconds }, + new { inputString = "* * * */2 *" , outputString = "* * * */2 *" , cronStringFormat = CronStringFormat.Default }, + new { inputString = "10-40/15 * * * *" , outputString = "10-40/15 * * * *" , cronStringFormat = CronStringFormat.Default }, + new { inputString = "* * * Mar,Jan,Aug Fri,Mon-Tue" , outputString = "* * * 3,1,8 5,1-2" , cronStringFormat = CronStringFormat.Default }, + new { inputString = "1 * 1-2,3 * * *" , outputString = "1 * 1-2,3 * * *" , cronStringFormat = CronStringFormat.WithSeconds }, + new { inputString = "22 * * * */2 *" , outputString = "22 * * * */2 *" , cronStringFormat = CronStringFormat.WithSeconds }, + new { inputString = "33 10-40/15 * * * *" , outputString = "33 10-40/15 * * * *" , cronStringFormat = CronStringFormat.WithSeconds }, + new { inputString = "55 * * * Mar,Jan,Aug Fri,Mon-Tue", outputString = "55 * * * 3,1,8 5,1-2" , cronStringFormat = CronStringFormat.WithSeconds }, }; foreach (var test in tests) @@ -454,7 +454,7 @@ public void EvaluationsBlank() //Fire every November 11 at 11:11 AM new { startTime = "01/07/1984 00:00:00", inputString = "0 11 11 11 11 ?", nextOccurence = "11/11/1984 11:11:00", cronStringFormat = CronStringFormat.WithSeconds }, }; - + foreach (var test in tests) CronCall(test.startTime, test.inputString, test.nextOccurence, test.cronStringFormat); } @@ -463,7 +463,7 @@ public void EvaluationsBlank() [TestMethod] public void FiniteOccurrences() { - var tests = new [] + var tests = new[] { new { inputString = " * * * * * ", startTime = "01/01/2003 00:00:00", endTime = "01/01/2003 00:00:00", cronStringFormat = CronStringFormat.Default }, new { inputString = " * * * * * ", startTime = "31/12/2002 23:59:59", endTime = "01/01/2003 00:00:00", cronStringFormat = CronStringFormat.Default }, @@ -502,7 +502,6 @@ public void IllegalDates() BadField("* * 30-31 Feb *", CronStringFormat.Default); } - [TestMethod] static void BadField(string expression, CronStringFormat format) { Assert2.Throws(() => CrontabSchedule.Parse(expression, format)); diff --git a/NCrontab.Advanced.Tests/NCrontab.Advanced.Tests.csproj b/NCrontab.Advanced.Tests/NCrontab.Advanced.Tests.csproj index 1ea721f..0491875 100644 --- a/NCrontab.Advanced.Tests/NCrontab.Advanced.Tests.csproj +++ b/NCrontab.Advanced.Tests/NCrontab.Advanced.Tests.csproj @@ -1,93 +1,15 @@ - - + + + - Debug - AnyCPU - {CCAD3304-0882-4244-8F66-1890126AC5C6} - Library - Properties - NCrontab.Advanced.Tests - NCrontab.Advanced.Tests - v4.5.2 - 512 - {3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - $(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages - False - UnitTest + net48;net6.0 - - true - full - false - bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\Release\ - TRACE - prompt - 4 - - - - - - - - - - - - - - - - - - - - - - - + - - {D56BC51A-E8F9-4911-8C4C-EAB2763699CD} - NCrontab.Advanced - + + + + - - - - - - False - - - False - - - False - - - False - - - - - - - + \ No newline at end of file diff --git a/NCrontab.Advanced.Tests/Properties/AssemblyInfo.cs b/NCrontab.Advanced.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 30e4323..0000000 --- a/NCrontab.Advanced.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; -using System.Runtime.InteropServices; - -// General Information about an assembly is controlled through the following -// set of attributes. Change these attribute values to modify the information -// associated with an assembly. -[assembly: AssemblyTitle("NCrontab.Advanced.Tests")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("NCrontab.Advanced.Tests")] -[assembly: AssemblyCopyright("Copyright © 2016")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// Setting ComVisible to false makes the types in this assembly not visible -// to COM components. If you need to access a type in this assembly from -// COM, set the ComVisible attribute to true on that type. -[assembly: ComVisible(false)] - -// The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("ccad3304-0882-4244-8f66-1890126ac5c6")] - -// Version information for an assembly consists of the following four values: -// -// Major Version -// Minor Version -// Build Number -// Revision -// -// You can specify all the values or you can default the Build and Revision Numbers -// by using the '*' as shown below: -// [assembly: AssemblyVersion("1.0.*")] -[assembly: AssemblyVersion("1.0.0.0")] -[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/NCrontab.Advanced/Directory.Build.props b/NCrontab.Advanced/Directory.Build.props index 1a79c26..d56fe3a 100644 --- a/NCrontab.Advanced/Directory.Build.props +++ b/NCrontab.Advanced/Directory.Build.props @@ -9,11 +9,13 @@ jcoutch; VisualOn Apache-2.0 - https://github.com/VisualOn/NCrontab-Advanced - https://raw.githubusercontent.com/VisualOn/NCrontab-Advanced/master/NCrontab.Advanced/Icons/x-office-calendar.png + https://github.com/visualon/NCrontab-Advanced + https://raw.githubusercontent.com/visualon/NCrontab-Advanced/main/NCrontab.Advanced/Icons/x-office-calendar.png + icon.png + diff --git a/NCrontab.Advanced/NCrontab.Advanced.csproj b/NCrontab.Advanced/NCrontab.Advanced.csproj index 9d59a2e..1121ebc 100644 --- a/NCrontab.Advanced/NCrontab.Advanced.csproj +++ b/NCrontab.Advanced/NCrontab.Advanced.csproj @@ -1,16 +1,12 @@ - + 1.2.3.3 1.2.3.3 Joe Coutcher - netstandard1.0;netstandard2.0;net46;net45;net40;net35 + netstandard2.0;net46;net6.0 NCrontab.Advanced Cron string parser for .NET - win10-x64 - $(PackageTargetFallback);dnxcore50 - 1.6.0 - C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v3.5\Profile\Client true true diff --git a/NCrontab.Advanced/NCrontab.Advanced.nuget.targets b/NCrontab.Advanced/NCrontab.Advanced.nuget.targets deleted file mode 100644 index e69ce0e..0000000 --- a/NCrontab.Advanced/NCrontab.Advanced.nuget.targets +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/README.md b/README.md index e7d3382..7be8bf9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# NCrontab Advanced [![Build status](https://ci.appveyor.com/api/projects/status/74py94r0mcwogo5f?svg=true)](https://ci.appveyor.com/project/ViceIce/ncrontab-advanced) [![](https://img.shields.io/myget/visualon/v/VisualOn.NCrontab.Advanced.svg?label=MyGet&style=flat)](https://www.myget.org/gallery/visualon) +[![Build status](https://github.com/visualon/NCrontab-Advanced/actions/workflows/build.yml/badge.svg)](https://github.com/visualon/NCrontab-Advanced/actions/workflows/build.yml) +[![](https://img.shields.io/myget/visualon/v/VisualOn.NCrontab.Advanced.svg?label=MyGet&style=flat)](https://www.myget.org/gallery/visualon) + +# NCrontab Advanced This is a fork from [Joe Coutcher](https://github.com/jcoutch/NCrontab-Advanced).