Skip to content
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
65 changes: 65 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

[*.{json,yml,yaml,props,targets,csproj,slnx,xml,config}]
indent_size = 2

[*.md]
trim_trailing_whitespace = false

[*.cs]
# Namespaces and usings
csharp_style_namespace_declarations = file_scoped:warning
dotnet_sort_system_directives_first = true
dotnet_separate_import_directive_groups = false
dotnet_diagnostic.IDE0005.severity = warning
dotnet_diagnostic.IDE0161.severity = warning

# Language preferences
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = false:suggestion
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = true:suggestion
csharp_prefer_braces = when_multiline:suggestion
csharp_style_prefer_primary_constructors = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
dotnet_style_readonly_field = true:warning

# Naming
dotnet_naming_rule.private_fields_underscore.symbols = private_fields
dotnet_naming_rule.private_fields_underscore.style = underscore_camel
dotnet_naming_rule.private_fields_underscore.severity = warning
dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private
dotnet_naming_style.underscore_camel.required_prefix = _
dotnet_naming_style.underscore_camel.capitalization = camel_case

dotnet_naming_rule.private_static_readonly.symbols = private_static_readonly_fields
dotnet_naming_rule.private_static_readonly.style = pascal_case
dotnet_naming_rule.private_static_readonly.severity = warning
dotnet_naming_symbols.private_static_readonly_fields.applicable_kinds = field
dotnet_naming_symbols.private_static_readonly_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = static, readonly
dotnet_naming_style.pascal_case.capitalization = pascal_case

dotnet_naming_rule.private_const.symbols = private_const_fields
dotnet_naming_rule.private_const.style = pascal_case
dotnet_naming_rule.private_const.severity = warning
dotnet_naming_symbols.private_const_fields.applicable_kinds = field
dotnet_naming_symbols.private_const_fields.applicable_accessibilities = private
dotnet_naming_symbols.private_const_fields.required_modifiers = const

[tests/**.cs]
# Test names describe behavior with underscores for readability.
dotnet_diagnostic.CA1707.severity = none
# Test classes and members are not part of any public contract, so they carry no XML docs.
dotnet_diagnostic.CS1591.severity = none
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Minor and patch updates arrive grouped by family; majors arrive one by one.
version: 2
updates:
- package-ecosystem: nuget
directory: /
schedule:
interval: weekly
day: monday
open-pull-requests-limit: 5
groups:
analyzers-and-build:
patterns: ["Microsoft.CodeAnalysis.*", "MinVer"]
update-types: [minor, patch]
testing:
patterns: ["xunit*", "Shouldly", "Microsoft.Testing.*", "BenchmarkDotNet*"]
update-types: [minor, patch]
dotnet:
patterns: ["Microsoft.*", "System.*"]
update-types: [minor, patch]
other:
patterns: ["*"]
update-types: [minor, patch]

- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
groups:
actions:
patterns: ["*"]
update-types: [minor, patch]
102 changes: 102 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

permissions:
contents: read

concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true

env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true

jobs:
build-test:
name: build-test (${{ matrix.os }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
timeout-minutes: 15
steps:
# Full history: MinVer computes the version from the tags.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
global-json-file: global.json

- name: Restore
run: dotnet restore

- name: Build
run: dotnet build --no-restore --configuration Release

- name: Test
if: runner.os == 'Linux'
run: dotnet test --no-build --configuration Release --coverage --coverage-output-format cobertura --results-directory artifacts/test-results

# GitHub's Windows runners cannot run Linux containers.
- name: Test (without Docker)
if: runner.os == 'Windows'
run: dotnet test --no-build --configuration Release --filter-not-trait "Category=Docker"

- name: Coverage summary
if: runner.os == 'Linux'
run: bash eng/coverage-summary.sh artifacts/test-results

- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
if: runner.os == 'Linux'
with:
name: coverage
path: artifacts/test-results/**/*.cobertura.xml
if-no-files-found: error

quality:
name: quality
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
global-json-file: global.json

- name: format
run: dotnet format --verify-no-changes

pack:
name: pack
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
global-json-file: global.json

- name: Pack
run: dotnet pack --configuration Release --output artifacts/packages

# Builds of untagged commits are always prereleases.
- name: Check packages
run: bash eng/check-packages.sh artifacts/packages 7 '^[0-9]+\.[0-9]+\.[0-9]+-'
58 changes: 58 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: CodeQL

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: '27 4 * * 1'

permissions:
contents: read

concurrency:
group: codeql-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: analyze (${{ matrix.language }})
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false
matrix:
include:
- language: csharp
build-mode: manual
- language: actions
build-mode: none
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
if: matrix.language == 'csharp'
with:
global-json-file: global.json

- uses: github/codeql-action/init@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}
queries: security-extended

- name: Build
if: matrix.build-mode == 'manual'
run: dotnet build --configuration Release

- uses: github/codeql-action/analyze@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
with:
category: /language:${{ matrix.language }}
31 changes: 31 additions & 0 deletions .github/workflows/contract-samples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Contract and samples

on:
pull_request:
branches: [main]
types: [opened, synchronize, reopened, labeled, unlabeled]

permissions:
contents: read

concurrency:
group: contract-samples-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
contract-samples:
name: contract-samples
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: contract-samples
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
HAS_NO_SAMPLE_IMPACT_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-sample-impact') }}
run: bash eng/check-contract-samples.sh
46 changes: 46 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Pull request

on:
pull_request:
branches: [main]
types: [opened, edited, synchronize, reopened]

permissions:
contents: read

concurrency:
group: pull-request-${{ github.event.pull_request.number }}
cancel-in-progress: true

jobs:
pr-title:
name: pr-title
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: pr-title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: bash eng/check-pr-title.sh

internal-references:
name: internal-references
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: internal-references
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_TITLE: ${{ github.event.pull_request.title }}
PR_BODY: ${{ github.event.pull_request.body }}
run: bash eng/check-internal-references.sh
42 changes: 42 additions & 0 deletions .github/workflows/scorecard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Scorecard

on:
branch_protection_rule:
push:
branches: [main]
schedule:
- cron: '41 5 * * 1'

permissions:
contents: read

jobs:
analysis:
name: analysis
runs-on: ubuntu-latest
timeout-minutes: 15
permissions:
actions: read
contents: read
id-token: write
security-events: write
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: ossf/scorecard-action@fa7117db83c52d787ae5a89f350999701505d78e # v2.5.0
with:
results_file: results.sarif
results_format: sarif
publish_results: true

- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: scorecard-results
path: results.sarif
retention-days: 5

- uses: github/codeql-action/upload-sarif@24c54180a607b1449ed407dd24f251e4e9147c8d # v4.38.3
with:
sarif_file: results.sarif
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Changelog

All notable changes to this project are documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project adheres to
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
Loading
Loading