Skip to content

Commit

Permalink
Merge pull request #1 from natemcmaster/main
Browse files Browse the repository at this point in the history
merge origin
  • Loading branch information
scott-xu authored Nov 26, 2023
2 parents 497f598 + 14f9a49 commit 8ba9f11
Show file tree
Hide file tree
Showing 543 changed files with 4,736 additions and 3,374 deletions.
8 changes: 4 additions & 4 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
"version": 1,
"isRoot": true,
"tools": {
"dotnet-reportgenerator-globaltool": {
"version": "4.4.0",
"dotnet-format": {
"version": "5.1.250801",
"commands": [
"reportgenerator"
"dotnet-format"
]
}
}
}
}
31 changes: 28 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ indent_size = 4
csharp_style_expression_bodied_constructors = false
csharp_prefer_braces = true
dotnet_sort_system_directives_first = true
csharp_using_directive_placement = outside_namespace

# Stuff that is usually best
csharp_style_inlined_variable_declaration = true
Expand All @@ -38,22 +39,43 @@ csharp_new_line_before_open_brace = all
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current
csharp_prefer_simple_default_expression = true
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true

# Good defaults, but not always
dotnet_style_object_initializer = true
csharp_style_expression_bodied_indexers = true
csharp_style_expression_bodied_accessors = true
csharp_style_throw_expression = true

# Default severity for analyzer diagnostics with category 'Style' (escalated to build warnings)
# dotnet_analyzer_diagnostic.category-Style.severity = suggestion

# Required naming style
dotnet_diagnostic.IDE0006.severity = error

# suppress warning aboud unused methods
dotnet_diagnostic.IDE0051.severity = none

# Missing required header
dotnet_diagnostic.IDE0073.severity = error

# Remove unnecessary parenthesis
dotnet_diagnostic.IDE0047.severity = warning

# Parenthesis added for clarity
dotnet_diagnostic.IDE0048.severity = warning

# Naming styles

## Constants are PascalCase
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_symbols.constants.applicable_kinds = *
dotnet_naming_symbols.constants.required_modifiers = const
dotnet_naming_symbols.const.applicable_kinds = field, property
dotnet_naming_symbols.const.applicable_accessibilities = *
dotnet_naming_symbols.const.required_modifiers = const

dotnet_naming_rule.constants_should_be_pascale_case.symbols = constants
dotnet_naming_rule.constants_should_be_pascale_case.symbols = const
dotnet_naming_rule.constants_should_be_pascale_case.style = pascal_case
dotnet_naming_rule.constants_should_be_pascale_case.severity = error

Expand All @@ -79,3 +101,6 @@ dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_rule.private_fields_should_be_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_should_be_underscore.style = underscore_camel_case
dotnet_naming_rule.private_fields_should_be_underscore.severity = error

# File header
file_header_template = Copyright (c) Nate McMaster.\nLicensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
13 changes: 0 additions & 13 deletions .github/no-response.yml

This file was deleted.

26 changes: 0 additions & 26 deletions .github/stale.yml

This file was deleted.

103 changes: 103 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: CI

on:
push:
branches-ignore:
- dependabot/*
pull_request:
workflow_dispatch:
inputs:
is_stable_build:
description: Use a version number indicating this is a stable release
required: true
default: "false"
release:
description: Create a release
required: true
default: "false"
branches:
- main
- release/*

env:
IS_STABLE_BUILD: ${{ github.event.inputs.is_stable_build }}

jobs:
build:
if: "!contains(github.event.head_commit.message, 'ci skip') || github.event_name == 'workflow_dispatch'"
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}

outputs:
package_version: ${{ steps.build_script.outputs.package_version }}

steps:
- uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
- name: Run build script
id: build_script
run: ./build.ps1 -ci
- uses: actions/upload-artifact@v2
if: ${{ matrix.os == 'windows-latest' }}
with:
name: packages
path: artifacts/
if-no-files-found: error
- uses: codecov/codecov-action@v3
with:
name: unittests-${{ matrix.os }}
fail_ci_if_error: true
release:
if: "github.event.inputs.release"
needs: build
runs-on: windows-latest
env:
PACKAGE_VERSION: ${{ needs.build.outputs.package_version }}
steps:
- run: echo "Releasing ${{ env.PACKAGE_VERSION }}"
- name: Setup NuGet
uses: NuGet/setup-nuget@v1
with:
nuget-version: latest
- uses: actions/download-artifact@v2
with:
name: packages
path: packages
- name: Configure GitHub NuGet registry
run: nuget sources add -name github -source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json -username ${{ github.repository_owner }} -password ${{ secrets.GITHUB_TOKEN }}
- name: Push to GitHub package registry
run: nuget push packages\*.nupkg -ApiKey ${{ secrets.GITHUB_TOKEN }} -Source github -SkipDuplicate
- name: Push to NuGet.org
run: nuget push packages\*.nupkg -ApiKey ${{ secrets.NUGET_API_KEY }} -Source https://api.nuget.org/v3/index.json
- name: Create GitHub release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
name: ${{ env.PACKAGE_VERSION }}
tag_name: v${{ env.PACKAGE_VERSION }}
body: |
## How to get this update
Packages have been posted to these feeds:
#### NuGet.org
https://nuget.org/packages/McMaster.Extensions.CommandLineUtils/${{ env.PACKAGE_VERSION }}
https://nuget.org/packages/McMaster.Extensions.Hosting.CommandLine/${{ env.PACKAGE_VERSION }}
#### GitHub Package Registry
https://github.com/natemcmaster?tab=packages&repo_name=CommandLineUtils
draft: false
append_body: true
generate_release_notes: true
prerelease: ${{ env.IS_STABLE_BUILD == 'false' }} # Example: v3.1.0-beta
files: packages/*
33 changes: 33 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Docs

on:
push:
branches:
- main
paths:
- 'docs/**'
- 'src/*/PublicAPI.*.txt'
- '.github/workflows/docs.yml'

pull_request:
paths:
- 'docs/**'
- 'src/*/PublicAPI.*.txt'
- '.github/workflows/docs.yml'

jobs:
generate_docs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v2
- name: Setup .NET 6
uses: actions/setup-dotnet@v3
with:
dotnet-version: '6.0.x'
- name: Run docs generation
run: ./docs/generate.ps1

- name: Publish docs to GH Pages
if: github.event_name == 'push'
run: ./docs/push.ps1 -a ${{ github.token }}
41 changes: 41 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'Close stale issues and PRs'
on:
workflow_dispatch:
inputs:
debug-only:
description: Run in debug mode
required: false
default: 'false'
schedule:
- cron: '30 1 * * *'

jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: actions/stale@v5
with:
debug-only: ${{ github.event.inputs.debug-only == 'true' }}
days-before-stale: 365
days-before-close: 14
stale-issue-label: stale
close-issue-label: closed-stale
close-issue-reason: not_planned
exempt-issue-labels: announcement,planning
exempt-all-milestones: true
exempt-all-assignees: true
stale-issue-message: >
This issue has been automatically marked as stale because it has no recent activity.
It will be closed if no further activity occurs. Please comment if you believe this
should remain open, otherwise it will be closed in 14 days.
Thank you for your contributions to this project.
close-issue-message: >
Closing due to inactivity.
If you are looking at this issue in the future and think it should be reopened,
please make a commented here and mention natemcmaster so he sees the notification.
stale-pr-message: >
This pull request appears to be stale. Please comment if you believe this should remain
open and reviewed. If there are no updates, it will be closed in 14 days.
close-pr-message: >
Thank you for your contributions to this project. This pull request has been closed due to inactivity.
Loading

0 comments on commit 8ba9f11

Please sign in to comment.