Skip to content

Commit 88de7c3

Browse files
committed
💚 Adds CI
1 parent da2dbca commit 88de7c3

6 files changed

Lines changed: 329 additions & 9 deletions

File tree

.github/workflows/codeql.yml

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: "CodeQL - C#"
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
schedule:
9+
- cron: '0 4 * * 0' # Runs every Sunday at 4AM
10+
11+
jobs:
12+
analyze:
13+
name: CodeQL Security Scan + Tests + Coverage
14+
runs-on: ubuntu-latest
15+
16+
permissions:
17+
actions: read
18+
contents: read
19+
security-events: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Setup .NET 8.x
26+
uses: actions/setup-dotnet@v4
27+
with:
28+
dotnet-version: '8.x'
29+
30+
- name: Setup .NET 9.x
31+
uses: actions/setup-dotnet@v4
32+
with:
33+
dotnet-version: '9.x'
34+
35+
- name: Setup .NET 10.x
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
dotnet-version: '10.x'
39+
40+
- name: Restore dependencies
41+
run: dotnet restore
42+
43+
- name: Initialize CodeQL
44+
uses: github/codeql-action/init@v3
45+
with:
46+
languages: csharp
47+
48+
- name: Build project
49+
run: dotnet build --no-restore --configuration Release
50+
51+
- name: Run tests
52+
run: |
53+
dotnet test \
54+
--configuration Release \
55+
--collect:"XPlat Code Coverage" \
56+
--blame \
57+
--results-directory ./TestResults
58+
59+
- name: Generate coverage report
60+
uses: danielpalme/ReportGenerator-GitHub-Action@5.3.5
61+
with:
62+
reports: 'TestResults/**/coverage.cobertura.xml'
63+
targetdir: 'CoverageReport'
64+
reporttypes: 'HtmlInline;Cobertura'
65+
verbosity: 'Info'
66+
67+
- name: Upload coverage report as artifact
68+
uses: actions/upload-artifact@v4
69+
with:
70+
name: coverage-report
71+
path: CoverageReport
72+
73+
- name: Run CodeQL Analysis
74+
uses: github/codeql-action/analyze@v3
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Publish NuGet Package
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+.[0-9]+'
7+
8+
jobs:
9+
publish:
10+
name: Publish to NuGet
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Setup .NET
18+
uses: actions/setup-dotnet@v4
19+
with:
20+
dotnet-version: '10.x'
21+
22+
- name: Restore dependencies
23+
run: dotnet restore
24+
25+
- name: Build with explicit version
26+
run: |
27+
VERSION=${GITHUB_REF_NAME}
28+
dotnet build \
29+
--configuration Release \
30+
-p:Version=$VERSION \
31+
--no-restore
32+
33+
- name: Pack with symbols
34+
run: |
35+
VERSION=${GITHUB_REF_NAME}
36+
dotnet pack \
37+
--configuration Release \
38+
-p:Version=$VERSION \
39+
-p:IncludeSymbols=true \
40+
-p:SymbolPackageFormat=snupkg \
41+
--no-build \
42+
--output ./nupkgs
43+
44+
- name: Publish .nupkg and .snupkg to NuGet.org
45+
run: |
46+
dotnet nuget push ./nupkgs/*.nupkg \
47+
--source https://api.nuget.org/v3/index.json \
48+
--api-key ${{ secrets.NUGET_API_KEY }} \
49+
--skip-duplicate
50+
51+
dotnet nuget push ./nupkgs/*.snupkg \
52+
--source https://api.nuget.org/v3/index.json \
53+
--api-key ${{ secrets.NUGET_API_KEY }} \
54+
--skip-duplicate

CODE_OF_CONDUCT.md

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for
6+
everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity
7+
and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion,
8+
or sexual identity and orientation.
9+
10+
We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.
11+
12+
---
13+
14+
## Our Standards
15+
16+
Examples of behavior that contributes to a positive environment include:
17+
18+
- Demonstrating empathy and kindness toward other people
19+
- Being respectful of differing opinions, viewpoints, and experiences
20+
- Giving and gracefully accepting constructive feedback
21+
- Accepting responsibility and apologizing to those affected by our mistakes
22+
- Focusing on what is best not just for us as individuals, but for the overall community
23+
24+
Examples of unacceptable behavior include:
25+
26+
- The use of sexualized language or imagery, and sexual attention or advances of any kind
27+
- Trolling, insulting or derogatory comments, and personal or political attacks
28+
- Public or private harassment
29+
- Publishing others’ private information, such as a physical or email address, without their explicit permission
30+
- Other conduct which could reasonably be considered inappropriate in a professional setting
31+
32+
---
33+
34+
## Enforcement Responsibilities
35+
36+
Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take
37+
appropriate and fair corrective action in response to any behavior they deem inappropriate, threatening, offensive, or
38+
harmful.
39+
40+
Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
41+
issues, and other contributions that are not aligned with this Code of Conduct, and will communicate reasons for
42+
moderation decisions when appropriate.
43+
44+
---
45+
46+
## Scope
47+
48+
This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing
49+
the project or its community in public spaces.
50+
51+
---
52+
53+
## Enforcement
54+
55+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the project maintainer
56+
responsible for enforcement at our [GitHub repository](https://github.com/thenoobsbr/valueobjects-externalid).
57+
58+
All complaints will be reviewed and investigated promptly and fairly.
59+
60+
All community leaders are obligated to respect the privacy and security of the reporter of any incident.
61+
62+
---
63+
64+
## Attribution
65+
66+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org), version 2.1.

CONTRIBUTING.md

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# Contributing to TheNoobs.ValueObjects.ExternalId
2+
3+
Thank you for your interest in contributing to this project!
4+
Whether you're fixing a bug, adding a feature, improving documentation, or reporting an issue — your help is
5+
appreciated.
6+
7+
---
8+
9+
## Table of Contents
10+
11+
- [How to contribute](#-how-to-contribute)
12+
- [Issue reporting](#-issue-reporting)
13+
- [Pull request guidelines](#-pull-request-guidelines)
14+
- [Development setup](#-development-setup)
15+
- [Code style and conventions](#-code-style-and-conventions)
16+
- [License](#-license)
17+
18+
---
19+
20+
## How to contribute
21+
22+
There are several ways to contribute:
23+
24+
- 🐛 Report a bug
25+
- ✨ Propose or implement a feature
26+
- 📝 Improve documentation
27+
- 🔧 Refactor or optimize existing code
28+
- ✅ Add tests or improve coverage
29+
30+
---
31+
32+
## Issue reporting
33+
34+
If you've encountered a bug or unexpected behavior:
35+
36+
1. Search [existing issues](https://github.com/thenoobsbr/valueobjects-externalid/issues) to avoid duplicates.
37+
2. If none exists, open a **new issue** with:
38+
- Steps to reproduce
39+
- Expected behavior
40+
- Environment (.NET version, OS, etc.)
41+
- Error logs or test case (if available)
42+
43+
Clear, reproducible issues help us fix things faster.
44+
45+
---
46+
47+
## Pull request guidelines
48+
49+
To contribute code:
50+
51+
1. Fork the repository
52+
2. Create a new branch:
53+
```bash
54+
git checkout -b feature/my-feature
55+
````
56+
3. Write your code and tests
57+
4. Run tests locally:
58+
```bash
59+
dotnet test
60+
```
61+
5. Commit using clear messages
62+
6. Push to your fork and open a PR against `main`
63+
64+
### PR checklist:
65+
66+
* [ ] Your code builds and tests pass
67+
* [ ] Follows the coding style (see below)
68+
* [ ] If you add functionality, include corresponding tests
69+
* [ ] Reference related issues in the PR (e.g., `Fixes #12`)
70+
71+
---
72+
73+
## Development setup
74+
75+
You need:
76+
77+
* [.NET SDK 8.0+](https://dotnet.microsoft.com/download)
78+
* (Optionally) [.NET SDK 9.0](https://dotnet.microsoft.com/en-us/download/dotnet/9.0)
79+
* Git, an IDE (like Visual Studio or VS Code), and NuGet
80+
81+
Clone the repository:
82+
```bash
83+
git clone https://github.com/thenoobsbr/valueobjects-externalid.git
84+
cd valueobjects-externalid
85+
```
86+
87+
Run tests:
88+
```bash
89+
dotnet test
90+
```
91+
92+
---
93+
94+
## Code style and conventions
95+
96+
*
97+
Use [C# standard conventions](https://learn.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions)
98+
* Prefer `async/await` over `Task.Result` or `.Wait()`
99+
* Use explicit access modifiers (`public`, `private`, etc.)
100+
* Tests follow the `Given_When_Then` pattern where appropriate
101+
102+
We recommend enabling automatic formatting with:
103+
104+
```bash
105+
dotnet format
106+
```
107+
108+
---
109+
110+
## License
111+
112+
By contributing, you agree that your code will be licensed under the [MIT License](LICENSE).
Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,30 @@
11
<Solution>
2+
<Folder Name="/.github/">
3+
<File Path=".github/CONTRIBUTING.md" />
4+
<File Path=".github/PULL_REQUEST_TEMPLATE.md" />
5+
</Folder>
6+
<Folder Name="/.github/ISSUE_TEMPLATE/">
7+
<File Path=".github/ISSUE_TEMPLATE/bug_report.md" />
8+
<File Path=".github/ISSUE_TEMPLATE/feature_request.md" />
9+
<File Path=".github/ISSUE_TEMPLATE/support_request.md" />
10+
</Folder>
11+
<Folder Name="/.github/workflows/">
12+
<File Path=".github/workflows/codeql.yml" />
13+
<File Path=".github/workflows/nuget-publish.yml" />
14+
</Folder>
215
<Folder Name="/Solution Items/">
3-
<File Path=".editorconfig"/>
4-
<File Path=".gitignore"/>
5-
<File Path="LICENSE"/>
6-
<File Path="nuget.config"/>
7-
<File Path="README.md"/>
16+
<File Path=".editorconfig" />
17+
<File Path=".gitignore" />
18+
<File Path="CODE_OF_CONDUCT.md" />
19+
<File Path="CONTRIBUTING.md" />
20+
<File Path="LICENSE" />
21+
<File Path="nuget.config" />
22+
<File Path="README.md" />
823
</Folder>
924
<Folder Name="/src/">
10-
<Project Path="src/TheNoobs.ValueObjects.ExternalId/TheNoobs.ValueObjects.ExternalId.csproj"/>
25+
<Project Path="src/TheNoobs.ValueObjects.ExternalId/TheNoobs.ValueObjects.ExternalId.csproj" />
1126
</Folder>
1227
<Folder Name="/tests/">
13-
<Project
14-
Path="tests/TheNoobs.ValueObjects.ExternalId.UnitTests/TheNoobs.ValueObjects.ExternalId.UnitTests.csproj"/>
28+
<Project Path="tests/TheNoobs.ValueObjects.ExternalId.UnitTests/TheNoobs.ValueObjects.ExternalId.UnitTests.csproj" />
1529
</Folder>
1630
</Solution>

src/TheNoobs.ValueObjects.ExternalId/TheNoobs.ValueObjects.ExternalId.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22
<PropertyGroup>
3-
<TargetFrameworks>net10.0;net9.0;net8.0;net7.0;net6.0;netstandard2.0</TargetFrameworks>
3+
<TargetFramework>netstandard2.0</TargetFramework>
44
<Nullable>enable</Nullable>
55
<ImplicitUsings>true</ImplicitUsings>
66
<IsPackable>true</IsPackable>

0 commit comments

Comments
 (0)