-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from jjm-one/develop
Develop
- Loading branch information
Showing
10 changed files
with
2,990 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,160 @@ | ||
name: dotNet | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- develop | ||
- feature/ci | ||
pull_request: | ||
branches: | ||
- main | ||
- develop | ||
- feature/ci | ||
|
||
jobs: | ||
|
||
build-and-test-debug: | ||
name: Build and test in Debug configuration | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest] | ||
version: [6.x, 7.x] | ||
defaults: | ||
run: | ||
working-directory: ./src | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup dotNET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: ${{ matrix.version }} | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore -c Debug | ||
- name: Test | ||
run: dotnet test --no-build --verbosity normal | ||
|
||
build-and-test-release: | ||
name: Build and test in Release configuration | ||
needs: build-and-test-debug | ||
defaults: | ||
run: | ||
working-directory: ./src | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup dotNET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 7.x | ||
- name: Restore dependencies | ||
run: dotnet restore | ||
- name: Build | ||
run: dotnet build --no-restore -c Release | ||
#- name: Upload artifact | ||
# uses: actions/upload-artifact@v3 | ||
# with: | ||
# name: release-buid | ||
# path: | | ||
# ./jjm-one_jjm.one.Microsoft.Extensions.Logging.Helpers/bin/Release/*.nupkg | ||
# retention-days: 1 | ||
|
||
sonarcloud: | ||
name: Build and analyze with SonarCloud | ||
needs: build-and-test-release | ||
runs-on: windows-latest | ||
steps: | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 1.11 | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: Cache SonarCloud packages | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~\sonar\cache | ||
key: ${{ runner.os }}-sonar | ||
restore-keys: ${{ runner.os }}-sonar | ||
- name: Cache SonarCloud scanner | ||
id: cache-sonar-scanner | ||
uses: actions/cache@v1 | ||
with: | ||
path: .\.sonar\scanner | ||
key: ${{ runner.os }}-sonar-scanner | ||
restore-keys: ${{ runner.os }}-sonar-scanner | ||
- name: Cache dotnet-coverage | ||
id: cache-dotnet-coverage | ||
uses: actions/cache@v1 | ||
with: | ||
path: .\.dotnet-coverage\dotnet-coverage | ||
key: ${{ runner.os }}-dotnet-coverage | ||
restore-keys: ${{ runner.os }}-dotnet-coverage | ||
- name: Setup dotNET | ||
uses: actions/setup-dotnet@v3 | ||
with: | ||
dotnet-version: 7.x | ||
- name: Install SonarCloud scanner | ||
if: steps.cache-sonar-scanner.outputs.cache-hit != 'true' | ||
shell: powershell | ||
run: | | ||
New-Item -Path .\.sonar\scanner -ItemType Directory | ||
dotnet tool update dotnet-sonarscanner --tool-path .\.sonar\scanner | ||
- name: Install dotnet-coverage | ||
if: steps.cache-dotnet-coverage.outputs.cache-hit != 'true' | ||
shell: powershell | ||
run: | | ||
New-Item -Path .\.dotnet-coverage\dotnet-coverage -ItemType Directory | ||
dotnet tool update dotnet-coverage --tool-path .\.dotnet-coverage\dotnet-coverage | ||
- name: Build and analyze | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
shell: powershell | ||
run: | | ||
cd .\src | ||
.\..\.sonar\scanner\dotnet-sonarscanner begin /k:"jjm-one_jjm.one.Serilog.Sinks.SlackWebHook" /o:"jjm-one" /d:sonar.login="${{ secrets.SONAR_TOKEN }}" /d:sonar.host.url="https://sonarcloud.io" /d:sonar.cs.vscoveragexml.reportsPaths=coverage.xml | ||
dotnet restore | ||
dotnet build --no-restore -c Debug | ||
.\..\.dotnet-coverage\dotnet-coverage\dotnet-coverage collect "dotnet test --no-build --verbosity normal" -f xml -o "coverage.xml" | ||
cat coverage.xml | ||
.\..\.sonar\scanner\dotnet-sonarscanner end /d:sonar.login="${{ secrets.SONAR_TOKEN }}" | ||
#publish-nuget: | ||
# name: Publish the NuGet package | ||
# needs: [build-and-test-debug, build-and-test-release, sonarcloud, publish-doc] | ||
# if: github.ref_type == 'tag' && startsWith(github.event.ref, 'refs/tags/version-') | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: Download a single artifact | ||
# uses: actions/download-artifact@v3 | ||
# with: | ||
# name: release-buid | ||
# - name: Setup dotNET | ||
# uses: actions/setup-dotnet@v3 | ||
# with: | ||
# dotnet-version: 7.x | ||
# - name: Publish the package to nuget.org | ||
# run: | | ||
# ls -la | ||
# #run: dotnet nuget push */bin/Release/*.nupkg -k $NUGET_AUTH_TOKEN -s https://api.nuget.org/v3/index.json | ||
# #env: | ||
# # NUGET_AUTH_TOKEN: ${{ secrets.NUGET_TOKEN }} | ||
|
||
publish-doc: | ||
name: Publish Documentation | ||
needs: [build-and-test-debug] | ||
runs-on: ubuntu-latest | ||
if: github.event_name != 'pull_request' | ||
steps: | ||
- uses: DenverCoder1/[email protected] | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: gh-pages | ||
folder: doc/html | ||
config_file: Doxyfile | ||
target_folder: ${{ github.ref_name }}/doc/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.