From a8f6c6fd71e76114153984b251d26744a3fa16eb Mon Sep 17 00:00:00 2001 From: John Stoletov <14274626+johnstoletov@users.noreply.github.com> Date: Wed, 17 Aug 2022 12:22:35 +0300 Subject: [PATCH 1/5] Create publish.yml --- .github/workflows/publish.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..feed972 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,24 @@ +name: Pack new version + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-dotnet@v2 + with: + dotnet-version: '3.1.x' # SDK Version to use. + env: + NUGET_APIKEY: ${{secrets.NUGET_APIKEY}} + - run: dotnet build --configuration Release + - name: Create the package + run: dotnet pack --configuration Release + - name: Publish the package to GPR + run: dotnet nuget push /bin/Release/*.nupkg From d5ba2c05646686b4e8c0797d8e2de98ad2ea4ff7 Mon Sep 17 00:00:00 2001 From: johnstoletov Date: Mon, 22 Aug 2022 12:57:03 +0300 Subject: [PATCH 2/5] build and deploy workflows --- .github/workflows/build.yml | 35 ++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 41 ++++++++++++++++++++++++----------- 2 files changed, 63 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..6ce6410 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +name: Build +on: + - workflow_call + - pull_request +jobs: + build: + runs-on: ubuntu-latest + services: + mongodb: + image: mongo:5.0.10 + ports: + - 27017:27017 + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-dotnet@v2 + with: + dotnet-version: '2.2.x' # SDK Version to use. + env: + MONGO_ADDRESS: localhost + - name: build + run: | + dotnet build src/Horarium.sln -c Release + - name: check mongo + run: | + sleep 5 + mongo --host localhost --eval "db.version()" + - name: run unit tests + run: | + dotnet test src/Horarium.Test/Horarium.Test.csproj -c Release --no-restore + - name: run MongoDB integration tests + run: | + DataBase=MongoDB dotnet test src/Horarium.IntegrationTest/Horarium.IntegrationTest.csproj -c Release --no-restore + - name: run InMemory integration tests + run: | + DataBase=Memory dotnet test src/Horarium.IntegrationTest/Horarium.IntegrationTest.csproj -c Release --no-restore \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index feed972..f9241fd 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,24 +1,39 @@ -name: Pack new version +name: Deploy on: release: - types: [created] + types: [released] jobs: + build: + uses: ./.github/workflows/build.yml + deploy: + needs: [ build ] runs-on: ubuntu-latest - permissions: - packages: write - contents: read + env: + VERSION: ${{ github.event.release.tag_name }} steps: - uses: actions/checkout@v3 - uses: actions/setup-dotnet@v2 with: - dotnet-version: '3.1.x' # SDK Version to use. - env: - NUGET_APIKEY: ${{secrets.NUGET_APIKEY}} - - run: dotnet build --configuration Release - - name: Create the package - run: dotnet pack --configuration Release - - name: Publish the package to GPR - run: dotnet nuget push /bin/Release/*.nupkg + dotnet-version: '2.2.x' # SDK Version to use. + - name: prepare version + run: | + echo "$VERSION" + - name: pack Horarium + run: | + cd src + dotnet pack Horarium/Horarium.csproj -c Release /p:PackageVersion=${{env.VERSION}} + - name: pack Horarium.Mongo + run: | + cd src + dotnet pack Horarium.Mongo/Horarium.Mongo.csproj -c Release /p:PackageVersion=${{env.VERSION}} + - name: pack Horarium.AspNetCore + run: | + cd src + dotnet pack Horarium.AspNetCore/Horarium.AspNetCore.csproj -c Release /p:PackageVersion=${{env.VERSION}} + - name: publish + run: | + cd src + dotnet nuget push **/Horarium.*.nupkg -k ${{secrets.NUGET_APIKEY}} -s https://www.nuget.org \ No newline at end of file From 72f243cc4d863d26738ec69857c76648f2a842d7 Mon Sep 17 00:00:00 2001 From: johnstoletov Date: Mon, 22 Aug 2022 12:58:22 +0300 Subject: [PATCH 3/5] breaking test interval fixed --- src/Horarium.Test/RunnerJobTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Horarium.Test/RunnerJobTest.cs b/src/Horarium.Test/RunnerJobTest.cs index af12ddd..345d78c 100644 --- a/src/Horarium.Test/RunnerJobTest.cs +++ b/src/Horarium.Test/RunnerJobTest.cs @@ -66,7 +66,7 @@ public async Task Start_RecoverAfterIntervalTimeout_AfterFailedDB() // Act runnerJobs.Start(); - await Task.Delay(settings.IntervalStartJob + TimeSpan.FromMilliseconds(500)); + await Task.Delay(settings.IntervalStartJob + TimeSpan.FromMilliseconds(1000)); // Assert jobRepositoryMock.Verify(r => r.GetReadyJob(It.IsAny(), It.IsAny()), Times.AtLeast(2)); From 2026e3152b9888be99b168668976562781ae2834 Mon Sep 17 00:00:00 2001 From: johnstoletov Date: Mon, 22 Aug 2022 13:51:46 +0300 Subject: [PATCH 4/5] trailing spaces fix --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index f9241fd..55794df 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,7 +7,7 @@ on: jobs: build: uses: ./.github/workflows/build.yml - + deploy: needs: [ build ] runs-on: ubuntu-latest From f88db618ed6d69eec08334834907b71b358b2c5c Mon Sep 17 00:00:00 2001 From: johnstoletov Date: Mon, 22 Aug 2022 14:03:45 +0300 Subject: [PATCH 5/5] drone ci removed --- .drone.yml | 59 ------------------------------------------------------ README.md | 4 +--- 2 files changed, 1 insertion(+), 62 deletions(-) delete mode 100644 .drone.yml diff --git a/.drone.yml b/.drone.yml deleted file mode 100644 index c408044..0000000 --- a/.drone.yml +++ /dev/null @@ -1,59 +0,0 @@ -kind: pipeline -name: default - -steps: -- name: check-mongo - image: mongo:4 - commands: - - sleep 5 - - mongo --host mongo --eval "db.version()" - -- name: build - image: mcr.microsoft.com/dotnet/core/sdk:2.2 - environment: - MONGO_ADDRESS: mongo - commands: - - cd src - - dotnet build Horarium.sln -c Release - - dotnet test Horarium.Test/Horarium.Test.csproj --no-restore /p:CollectCoverage=true /p:CoverletOutputFormat=opencover - - DataBase=MongoDB dotnet test Horarium.IntegrationTest/Horarium.IntegrationTest.csproj --no-restore - - DataBase=Memory dotnet test Horarium.IntegrationTest/Horarium.IntegrationTest.csproj --no-restore - -- name: coverage - image: plugins/codecov - settings: - token: - from_secret: CODECOV_TOKEN - files: - - src/Horarium.Test/coverage.opencover.xml - -- name: push - image: mcr.microsoft.com/dotnet/core/sdk:2.2 - environment: - NUGET_APIKEY: - from_secret: NUGET_APIKEY - commands: - - cd src - - dotnet pack Horarium/Horarium.csproj -c Release /p:PackageVersion=$DRONE_TAG - - dotnet pack Horarium.Mongo/Horarium.Mongo.csproj -c Release /p:PackageVersion=$DRONE_TAG - - dotnet pack Horarium.AspNetCore/Horarium.AspNetCore.csproj -c Release /p:PackageVersion=$DRONE_TAG - - dotnet nuget push **/Horarium.*.nupkg -k $NUGET_APIKEY -s https://www.nuget.org - when: - event: - - tag - - -services: -- name: mongo - image: mongo:4.0 - command: [ --smallfiles ] - ports: - - 27017 - -trigger: - event: - - pull_request - - push - - tag - - diff --git a/README.md b/README.md index f6b8b37..a9ecd90 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,7 @@ # Horarium -[![Build Status](https://cloud.drone.io/api/badges/TinkoffCreditSystems/Horarium/status.svg)](https://cloud.drone.io/TinkoffCreditSystems/Horarium) +[![Build Status](https://github.com/TinkoffCreditSystems/Horarium/actions/workflows/build.yml/badge.svg)](https://github.com/TinkoffCreditSystems/Horarium/actions/) [![Nuget](https://img.shields.io/nuget/v/Horarium.svg)](https://www.nuget.org/packages/Horarium) -[![codecov](https://codecov.io/gh/TinkoffCreditSystems/Horarium/branch/master/graph/badge.svg)](https://codecov.io/gh/TinkoffCreditSystems/Horarium) -[![codefactor](https://www.codefactor.io/repository/github/tinkoffcreditsystems/horarium/badge)](https://www.codefactor.io/repository/github/tinkoffcreditsystems/horarium) Horarium is an open source job scheduling .NET library with an easy to use API, that can be integrated within applications of any scale - from the smallest stand-alone application to the largest e-commerce system.