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

Setup repository automation #4

Merged
merged 6 commits into from
Apr 16, 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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @bardin08
20 changes: 20 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -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"
19 changes: 19 additions & 0 deletions .github/workflows/common/action.yml
Original file line number Diff line number Diff line change
@@ -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
81 changes: 81 additions & 0 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
@@ -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 }}"
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
bin/
obj/
[bB]in/
[oO]bj/
/packages/
riderModule.iml
/_ReSharper.Caches/
/_ReSharper.Caches/
.idea/
4 changes: 4 additions & 0 deletions DbSeeder.sln
Original file line number Diff line number Diff line change
@@ -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}"
Expand Down
Loading