diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..843313e --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @bardin08 diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..392e2fa --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,20 @@ +# To get started with Dependabot version updates, you'll need to specify which +# Package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: "nuget" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + assignees: + - "bardin08" + pull-request-branch-name: + # Separate sections of the branch name with a hyphen + # for example, `dependabot-npm_and_yarn-next_js-acorn-6.4.1` + separator: "-" + # Add reviewers + reviewers: + - "bardin08" diff --git a/.github/workflows/common/action.yml b/.github/workflows/common/action.yml new file mode 100644 index 0000000..cbb7246 --- /dev/null +++ b/.github/workflows/common/action.yml @@ -0,0 +1,19 @@ +name: "Perform common steps" +description: "Performs common steps over the workflows" +runs: + using: "composite" + steps: + - name: ⚙ Setup .NET SDK ⚙ + uses: actions/setup-dotnet@v4 + with: + dotnet-version: '8.0.x' + + - name: ♻ NuGet Cache ♻ + uses: actions/cache@v3 + with: + path: ${{ env.NUGET_PACKAGES }} + key: ${{ runner.os }}.nuget.${{ hashFiles('**/*.csproj') }} + + - name: 🔄 Restore Nuget Packages 🔄 + shell: bash + run: dotnet restore diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml new file mode 100644 index 0000000..426e02e --- /dev/null +++ b/.github/workflows/pipeline.yml @@ -0,0 +1,81 @@ +name: Run Build and Unit tests + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + schedule: + - cron: '0 22 * * *' + +jobs: + main: + if: ${{ github.triggering_actor != 'dependabot[bot]' }} + + runs-on: ubuntu-latest + + env: + DOTNET_NOLOGO: 1 + DOTNET_CLI_TELEMETRY_OPTOUT: 1 + NUGET_PACKAGES: ${{ github.workspace }}/.github/nuget-packages + + steps: + - name: 📝 Fetch Sources 📝 + uses: actions/checkout@v2 + + - name: 💡 Perform Common Steps 💡 + uses: ./.github/workflows/common + + - name: 🛠 Build Solution 🛠 + shell: bash + run: dotnet build + + - name: ✅ Run Unit Tests ✅ + shell: bash + run: dotnet test + + - name: 🚀 Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: 'zulu' + + - name: 📥 Checkout Code + uses: actions/checkout@v3 + with: + fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis + + - name: 📦 Cache SonarCloud Packages + uses: actions/cache@v3 + with: + path: ~/.sonar/cache + key: ${{ runner.os }}-sonar + restore-keys: ${{ runner.os }}-sonar + + - name: 🗃️ Cache SonarCloud Scanner + id: cache-sonar-scanner + uses: actions/cache@v3 + with: + path: ~/.sonar/scanner + key: ${{ runner.os }}-sonar-scanner + restore-keys: ${{ runner.os }}-sonar-scanner + + - name: 🔧 Install SonarCloud Scanner + if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' + run: | + mkdir -p ~/.sonar/scanner + dotnet tool update dotnet-sonarscanner --tool-path ~/.sonar/scanner + + - name: 🔧 Install JetBrains dotCover + run: dotnet tool install --global JetBrains.dotCover.CommandLineTools --version 2023.3.0 + + - name: 🏗️ Build and Analyze + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} + run: | + ~/.sonar/scanner/dotnet-sonarscanner begin /k:"Bardin08_db-seeder" /o:"bardin08" /d:sonar.token="${{ secrets.SONAR_TOKEN }}" /d:sonar.cs.dotcover.reportsPaths=dotCover.Output.html /d:sonar.host.url="https://sonarcloud.io" + dotnet build ./DbSeeder.sln + dotnet-dotCover cover-dotnet --AttributeFilters="System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverageAttribute" --Filters="-:*.Tests" --Output=dotCover.Output.html --ReportType=HTML -- test "./DbSeeder.sln" + ~/.sonar/scanner/dotnet-sonarscanner end /d:sonar.token="${{ secrets.SONAR_TOKEN }}" diff --git a/.gitignore b/.gitignore index add57be..cac4b7d 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ -bin/ -obj/ +[bB]in/ +[oO]bj/ /packages/ riderModule.iml -/_ReSharper.Caches/ \ No newline at end of file +/_ReSharper.Caches/ +.idea/ diff --git a/DbSeeder.sln b/DbSeeder.sln index 125de0b..c62a117 100644 --- a/DbSeeder.sln +++ b/DbSeeder.sln @@ -1,5 +1,9 @@  Microsoft Visual Studio Solution File, Format Version 12.00 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DA355DBC-3290-4F91-9004-6A5680EE6B70}" + ProjectSection(SolutionItems) = preProject + .gitignore = .gitignore + EndProjectSection Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbSeeder", "DbSeeder\DbSeeder.csproj", "{AA89F82A-3339-4168-B56C-22F5559700F8}" EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DbSeeder.Tests", "DbSeeder.Tests\DbSeeder.Tests.csproj", "{4C3EA657-97AD-4E2E-AC54-57F4A05FA8CD}"