Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small improvements on workflows and on StartUp #15

Merged
merged 5 commits into from
Aug 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,8 @@ jobs:
secrets: inherit
with:
image_version: ${{ needs.build.outputs.image_version }}
cleanup:
if: always()
needs: test
uses: ./.github/workflows/cleanup.yml
secrets: inherit
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@ jobs:
secrets: inherit
with:
image_version: ${{ needs.test.outputs.image_version }}
cleanup:
if: always()
needs: release
uses: ./.github/workflows/cleanup.yml
secrets: inherit

Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,8 @@ jobs:
secrets: inherit
with:
image_version: ${{ inputs.image_version }}
cleanup:
if: always()
needs: release
uses: ./.github/workflows/cleanup.yml
secrets: inherit
13 changes: 13 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
on:
workflow_call:

jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: geekyeggo/delete-artifact@v5
with:
name: ${{ vars.IMAGE_NAME }}
failOnError: false
6 changes: 3 additions & 3 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ The workflows are described in the following table:

| Workflow | File name | Trigger | Description |
|----------------|----------------------------------------------------------------------------------------|------------------------------------------------------|----------------------------------------------------------------------------------------|
| ci | [build-test.yml](./.github/workflows/build-test.yml) | All branches and pull requests to develop and master | Builds and tests the software |
| release | [build-test-release.yml](./.github/workflows/build-test-release.yml) | Commits to develop, master and release/* branches | Builds and tests software and pushes it to the Docker Hub if the tests were successful |
| manual_release | [build-test-release_manually.yml](./.github/workflows/build-test-release_manually.yml) | Manual, can be triggeret on any branch | Builds and tests software and pushes it to the Docker Hub if the tests were successful |
| ci | [build-test-cleanup.yml](./.github/workflows/build-test-cleanup.yml) | All branches and pull requests to develop and master | Builds and tests the software |
| release | [build-test-release-cleanup.yml](./.github/workflows/build-test-release-cleanup.yml) | Commits to develop, master and release/* branches | Builds and tests software and pushes it to the Docker Hub if the tests were successful |
| manual_release | [build-test-release-cleanup_manually.yml](./.github/workflows/build-test-release-cleanup_manually.yml) | Manual, can be triggeret on any branch | Builds and tests software and pushes it to the Docker Hub if the tests were successful |
| update-readme | [update-dockerhub-readme.yml](./.github/workflows/update-dockerhub-readme.yml) | Commits on master branch | Updates ReadMe on docker hub |

Version names are automatically set by the reusable workflow `set_version`, based on branch names. See in the file [set_version.yml](./.github/workflows/set_version.yml)
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@
[![Docker Pulls](https://img.shields.io/docker/pulls/ramoy/bulkrename.svg)](https://hub.docker.com/r/ramoy/bulkrename)
[![MIT Licensed](https://img.shields.io/github/license/ramo-y/BulkRename.svg)](https://github.com/Ramo-Y/BulkRename/blob/master/LICENSE)
[![Activity](https://img.shields.io/github/commit-activity/m/Ramo-Y/BulkRename)](https://github.com/Ramo-Y/BulkRename/pulse)
[![ci](https://img.shields.io/github/actions/workflow/status/Ramo-Y/BulkRename/build-test.yml?label=ci)](https://github.com/Ramo-Y/BulkRename/actions/workflows/build-test.yml)
[![release](https://img.shields.io/github/actions/workflow/status/Ramo-Y/BulkRename/build-test-release.yml?label=release)](https://github.com/Ramo-Y/BulkRename/actions/workflows/build-test-release.yml)
[![ci](https://img.shields.io/github/actions/workflow/status/Ramo-Y/BulkRename/build-test-cleanup.yml?label=ci)](https://github.com/Ramo-Y/BulkRename/actions/workflows/build-test-cleanup.yml)
[![release](https://img.shields.io/github/actions/workflow/status/Ramo-Y/BulkRename/build-test-release-cleanup.yml?label=release)](https://github.com/Ramo-Y/BulkRename/actions/workflows/build-test-release-cleanup.yml)
[![GitHub contributors](https://img.shields.io/github/all-contributors/Ramo-Y/BulkRename)](#contributors-)
[![GitHub Sponsors](https://img.shields.io/github/sponsors/Ramo-Y)](https://github.com/sponsors/Ramo-Y)
![GitHub Downloads](https://img.shields.io/github/downloads/Ramo-Y/BulkRename/total)
[![Open Issues](https://img.shields.io/github/issues/Ramo-Y/BulkRename)](https://github.com/Ramo-Y/BulkRename/issues)
[![Closed Issues](https://img.shields.io/github/issues-closed/Ramo-Y/BulkRename)](https://github.com/Ramo-Y/BulkRename/issues?q=is%3Aissue+is%3Aclosed)

Expand Down
21 changes: 17 additions & 4 deletions src/BulkRename/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ private void ConfigurePersistance(IServiceCollection services)
}

public async Task Configure(WebApplication app)
{
ConfigureLogger();
await PreparateDatabase(app);
}

private void ConfigureLogger()
{
var seqUrl = Configuration[ConfigurationNameConstants.SEQ_URL];

Expand All @@ -78,11 +84,18 @@ public async Task Configure(WebApplication app)
.WriteTo.File(path: logPath, rollingInterval: RollingInterval.Day)
.WriteTo.Console().CreateLogger();
}
}

var connectionTimeOut = GetConnectionTimeOut();
var preparationDatabase = app.Services.GetService<PreparationDatabase>();
var task = preparationDatabase!.PreparatePopulation(app, connectionTimeOut);
await task;
private async Task PreparateDatabase(WebApplication app)
{
var persistanceMode = Configuration.GetValue<PersistanceMode>(nameof(PersistanceMode));
if (persistanceMode == PersistanceMode.Database)
{
var connectionTimeOut = GetConnectionTimeOut();
var preparationDatabase = app.Services.GetService<PreparationDatabase>();
var task = preparationDatabase!.PreparatePopulation(app, connectionTimeOut);
await task;
}
}

private void SetConnectionString()
Expand Down