Skip to content

Commit

Permalink
Add project files.
Browse files Browse the repository at this point in the history
  • Loading branch information
realybin committed Oct 11, 2024
0 parents commit 09dab87
Show file tree
Hide file tree
Showing 29 changed files with 2,294 additions and 0 deletions.
386 changes: 386 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

63 changes: 63 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
###############################################################################
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
16 changes: 16 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# 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/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
- package-ecosystem: "nuget" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"

- package-ecosystem: "github-actions" # See documentation for possible values
directory: "/" # Location of package manifests
schedule:
interval: "weekly"
86 changes: 86 additions & 0 deletions .github/workflows/build_app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Build SketchNow

on:
push:
branches:
- main
pull_request:
branches:
- main
workflow_dispatch:

defaults:
run:
shell: pwsh

env:
version: "1.0.${{ github.run_number }}"

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v4

- name: Set up .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.x'

- name: dotnet build
run: dotnet build --configuration Release -p:Version="${{ env.version }}"

- name: dotnet test
run: dotnet test --configuration Release --no-build --collect:"XPlat Code Coverage" --results-directory ${{github.workspace}}/.build/coverage

- name: ReportGenerator
uses: danielpalme/[email protected]
with:
reports: ${{github.workspace}}/.build/coverage/**/coverage.cobertura.xml
targetdir: ${{github.workspace}}/.build/coveragereport/
reporttypes: Html;MarkdownSummaryGithub
title: 'Code Coverage'

- name: Write PR Number
if: ${{ github.event_name == 'pull_request' }}
run: |
New-Item -Type File -Value "${{ github.event.number }}" -Force -Path "${{github.workspace}}/.build/coveragereport/PullRequestNumber"
- name: Upload Code Coverage Report
uses: actions/upload-artifact@v3
with:
name: CodeCoverage
path: ${{github.workspace}}/.build/coveragereport/
if-no-files-found: error

- name: dotnet publish
if: ${{ github.event_name != 'pull_request' }}
run: dotnet publish --configuration Release --no-build -p:Version="${{ env.version }}" -p:PublishDir=${{github.workspace}}/.build/publish

- name: Upload artifact for deployment job
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v3
with:
name: app
path: ${{github.workspace}}/.build/publish

# This will automatically mark PRs from dependabot with auto merge.
# This allows them to automatically complete if they pass the rest of the CI
auto-merge:
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest

permissions:
pull-requests: write
contents: write

steps:
- uses: fastify/[email protected]
with:
# For GitHub Auto Merge to work it must be enabled on the repo.
# This can be done with the script here:
# https://github.com/Keboo/DotnetTemplates/blob/main/SetupRepo.ps1
# See documentation here:
# https://docs.github.com/pull-requests/collaborating-with-pull-requests/incorporating-changes-from-a-pull-request/automatically-merging-a-pull-request
use-github-auto-merge: true
42 changes: 42 additions & 0 deletions .github/workflows/code_coverage_comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Code Coverage PR Comment

on:
workflow_run:
workflows: [Build SketchNow]
types:
- completed

defaults:
run:
shell: pwsh

# This is required by marocchino/sticky-pull-request-comment
# You must enable read/write permissions to allow workflows to create comments on the PR.
# On your repo navigate to: Settings > Actions > General > Workflow permissions, and make sure to enable read and write permissions.
# https://github.com/marocchino/sticky-pull-request-comment#error-resource-not-accessible-by-integration
permissions:
pull-requests: write

jobs:
post-code-coverage:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion == 'success'
steps:
- name: Download artifacts
run: gh run download ${{ github.event.workflow_run.id }} -n CodeCoverage --repo ${{ github.repository }}
env:
GH_TOKEN: ${{ github.token }}

- name: 'Get PR Number'
id: get-pr-number
run: |
$pr_number = (cat PullRequestNumber)
"pr_number=$pr_number" >> $env:GITHUB_OUTPUT
- uses: marocchino/sticky-pull-request-comment@v2
with:
recreate: true
number: ${{ steps.get-pr-number.outputs.pr_number }}
path: SummaryGithub.md
Loading

0 comments on commit 09dab87

Please sign in to comment.