Skip to content

Commit

Permalink
feat: change how the project is organized and release an alpha version (
Browse files Browse the repository at this point in the history
#26)

* chore: change how projects are organized

- Remove library `JSM.PartialJsonObject`.
- Update Dockerfile.
- Format some files given `docker compose up lint-formatter` execution.
- Use net8.0 in all projects.
- Remove `wait-for-it.sh` and use healthcheck in sqlserver service.

* feat: remove sample project and configure tests

- Add `Microsoft.AspNetCore.Mvc.NewtonsoftJson`.
- `NewtonsoftJson` is required by the framework.
- Use a new database for each test method to avoid race condition.
- Use SqlServer instead of InMemory database

* docs: add license file

* chore(nuget): enable repeatable package restores using a lock file

Know more at:
- https://bit.ly/3QnsqTU

* chore(ci/cd): add actions for pr, coverage, and package publication

* chore: add project metadata

* test: improve coverage

* docs: translate readme to en-us and change some statements
  • Loading branch information
willianantunes authored Sep 17, 2024
1 parent 2569dd7 commit 89a7d0f
Show file tree
Hide file tree
Showing 102 changed files with 5,656 additions and 2,771 deletions.
7 changes: 7 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
*
!src
!tests
**/bin
**/obj
!AspNetCore.RestFramework.sln
!scripts/*.sh
40 changes: 40 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Validate PR

on:
pull_request:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- '*.sln'
- 'Dockerfile'

jobs:
validate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- uses: actions/setup-dotnet@v4
with:
dotnet-version: '8'
- name: Check if the project is well formatted
run: |
./scripts/start-check-formatting.sh
- name: Install dotnet-sonarscanner
run: |
dotnet tool install --global dotnet-sonarscanner
- name: Build the project, run all tests, and publish the test results
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PR_SOURCE_BRANCH: ${{ github.head_ref }}
PR_TARGET_BRANCH: ${{ github.base_ref }}
GITHUB_PR_NUMBER: ${{github.event.pull_request.number}}
run: |
set -e
docker compose up -d db
./scripts/start-sonarcloud.sh
33 changes: 33 additions & 0 deletions .github/workflows/publish-coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Publish package and coverage report

on:
push:
branches:
- main
paths:
- 'src/**'
- 'tests/**'
- '*.sln'
- 'Directory.Build.props'

jobs:
publish-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Shallow clones should be disabled for a better relevancy of analysis
fetch-depth: 0
- name: Install dotnet-sonarscanner
run: |
dotnet tool install --global dotnet-sonarscanner
- name: Build the project, run all tests and publish to SonarCloud
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
PROJECT_VERSION: ${{ github.sha }}
SOURCE_BRANCH_NAME: ${{ github.ref_name }}
run: |
set -e
docker compose up -d db
./scripts/start-sonarcloud.sh
29 changes: 29 additions & 0 deletions .github/workflows/publish-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish coverage report

on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch:

permissions:
contents: read

jobs:
publish-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Generate package
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
dotnet pack -o out -p:PackageVersion=$TAG_NAME
- name: Push package
run: |
dotnet nuget push out/*.nupkg \
--api-key ${{ secrets.PUBLIC_NUGET_API_KEY }} \
--source "https://api.nuget.org/v3/index.json" \
--skip-duplicate
16 changes: 0 additions & 16 deletions AspNetCore.RestFramework.Core/AspNetCore.RestFramework.Core.csproj

This file was deleted.

This file was deleted.

27 changes: 0 additions & 27 deletions AspNetCore.RestFramework.Sample/Context/ApplicationDbContext.cs

This file was deleted.

This file was deleted.

41 changes: 0 additions & 41 deletions AspNetCore.RestFramework.Sample/Controllers/CustomersController.cs

This file was deleted.

This file was deleted.

35 changes: 0 additions & 35 deletions AspNetCore.RestFramework.Sample/Controllers/SellersController.cs

This file was deleted.

This file was deleted.

10 changes: 0 additions & 10 deletions AspNetCore.RestFramework.Sample/DTO/CustomerDocumentDto.cs

This file was deleted.

18 changes: 0 additions & 18 deletions AspNetCore.RestFramework.Sample/DTO/CustomerDto.cs

This file was deleted.

Loading

0 comments on commit 89a7d0f

Please sign in to comment.