Skip to content

Commit 7cce772

Browse files
committed
ci: Add CI, CodeQL, and Dependabot workflows, a PR template, and update README with status badges.
1 parent 01ffb9f commit 7cce772

5 files changed

Lines changed: 218 additions & 0 deletions

File tree

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Pull Request Template
2+
3+
## Description
4+
<!-- Provide a brief description of the changes in this PR -->
5+
6+
## Type of Change
7+
<!-- Mark the relevant option with an "x" -->
8+
9+
- [ ] Bug fix (non-breaking change which fixes an issue)
10+
- [ ] New feature (non-breaking change which adds functionality)
11+
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
12+
- [ ] Documentation update
13+
- [ ] Code refactoring
14+
- [ ] Performance improvement
15+
- [ ] Test addition/update
16+
17+
## Related Issues
18+
<!-- Link to related issues using #issue_number -->
19+
20+
Fixes #
21+
22+
## Changes Made
23+
<!-- List the main changes made in this PR -->
24+
25+
-
26+
-
27+
-
28+
29+
## Testing
30+
<!-- Describe the tests you ran to verify your changes -->
31+
32+
- [ ] Unit tests pass (`dotnet test`)
33+
- [ ] Build succeeds (`dotnet build`)
34+
- [ ] Code formatting is correct (`dotnet format --verify-no-changes`)
35+
- [ ] No new analyzer warnings
36+
- [ ] Manual testing completed
37+
38+
## Checklist
39+
<!-- Mark completed items with an "x" -->
40+
41+
- [ ] My code follows the project's [coding standards](CONTRIBUTING.md)
42+
- [ ] I have performed a self-review of my code
43+
- [ ] I have commented my code, particularly in hard-to-understand areas
44+
- [ ] I have made corresponding changes to the documentation
45+
- [ ] My changes generate no new warnings
46+
- [ ] I have added tests that prove my fix is effective or that my feature works
47+
- [ ] New and existing unit tests pass locally with my changes
48+
- [ ] Any dependent changes have been merged and published
49+
50+
## Screenshots (if applicable)
51+
<!-- Add screenshots to help explain your changes -->
52+
53+
## Additional Notes
54+
<!-- Add any other context about the PR here -->

.github/dependabot.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
version: 2
2+
3+
updates:
4+
# Enable version updates for NuGet packages
5+
- package-ecosystem: "nuget"
6+
directory: "/"
7+
schedule:
8+
interval: "weekly"
9+
day: "monday"
10+
open-pull-requests-limit: 10
11+
reviewers:
12+
- "antaoalmada"
13+
labels:
14+
- "dependencies"
15+
- "nuget"
16+
commit-message:
17+
prefix: "chore"
18+
include: "scope"
19+
groups:
20+
aspire:
21+
patterns:
22+
- "Aspire.*"
23+
marten:
24+
patterns:
25+
- "Marten*"
26+
microsoft:
27+
patterns:
28+
- "Microsoft.*"
29+
testing:
30+
patterns:
31+
- "xunit*"
32+
- "NSubstitute"
33+
34+
# Enable version updates for GitHub Actions
35+
- package-ecosystem: "github-actions"
36+
directory: "/"
37+
schedule:
38+
interval: "weekly"
39+
day: "monday"
40+
labels:
41+
- "dependencies"
42+
- "github-actions"
43+
commit-message:
44+
prefix: "ci"

.github/workflows/ci.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, develop ]
6+
pull_request:
7+
branches: [ main, develop ]
8+
workflow_dispatch:
9+
10+
env:
11+
DOTNET_VERSION: '10.0.x'
12+
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
13+
DOTNET_CLI_TELEMETRY_OPTOUT: true
14+
15+
jobs:
16+
build-and-test:
17+
runs-on: ubuntu-latest
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Setup .NET
24+
uses: actions/setup-dotnet@v4
25+
with:
26+
dotnet-version: ${{ env.DOTNET_VERSION }}
27+
28+
- name: Install Aspire workload
29+
run: dotnet workload install aspire
30+
31+
- name: Restore dependencies
32+
run: dotnet restore
33+
34+
- name: Build
35+
run: dotnet build --no-restore --configuration Release
36+
37+
- name: Run tests
38+
run: dotnet test --no-build --configuration Release --verbosity normal --logger "trx;LogFileName=test-results.trx"
39+
40+
- name: Upload test results
41+
uses: actions/upload-artifact@v4
42+
if: always()
43+
with:
44+
name: test-results
45+
path: '**/test-results.trx'
46+
47+
code-quality:
48+
runs-on: ubuntu-latest
49+
50+
steps:
51+
- name: Checkout code
52+
uses: actions/checkout@v4
53+
54+
- name: Setup .NET
55+
uses: actions/setup-dotnet@v4
56+
with:
57+
dotnet-version: ${{ env.DOTNET_VERSION }}
58+
59+
- name: Restore dependencies
60+
run: dotnet restore
61+
62+
- name: Check code formatting
63+
run: dotnet format --verify-no-changes --verbosity diagnostic
64+
65+
- name: Run analyzers
66+
run: dotnet build --no-restore --configuration Release /p:TreatWarningsAsErrors=true

.github/workflows/codeql.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: CodeQL Analysis
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
schedule:
9+
- cron: '0 0 * * 1' # Weekly on Monday
10+
11+
jobs:
12+
analyze:
13+
name: Analyze
14+
runs-on: ubuntu-latest
15+
permissions:
16+
actions: read
17+
contents: read
18+
security-events: write
19+
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
language: [ 'csharp' ]
24+
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
29+
- name: Initialize CodeQL
30+
uses: github/codeql-action/init@v3
31+
with:
32+
languages: ${{ matrix.language }}
33+
34+
- name: Setup .NET
35+
uses: actions/setup-dotnet@v4
36+
with:
37+
dotnet-version: '10.0.x'
38+
39+
- name: Install Aspire workload
40+
run: dotnet workload install aspire
41+
42+
- name: Restore dependencies
43+
run: dotnet restore
44+
45+
- name: Build
46+
run: dotnet build --no-restore --configuration Release
47+
48+
- name: Perform CodeQL Analysis
49+
uses: github/codeql-action/analyze@v3
50+
with:
51+
category: "/language:${{matrix.language}}"

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Book Store
22

3+
[![CI](https://github.com/aalmada/BookStore/actions/workflows/ci.yml/badge.svg)](https://github.com/aalmada/BookStore/actions/workflows/ci.yml)
4+
[![CodeQL](https://github.com/aalmada/BookStore/actions/workflows/codeql.yml/badge.svg)](https://github.com/aalmada/BookStore/actions/workflows/codeql.yml)
5+
36
Full-stack online book store application with event-sourced backend API and Blazor frontend, orchestrated by .NET Aspire.
47

58
## Overview

0 commit comments

Comments
 (0)