-
Notifications
You must be signed in to change notification settings - Fork 20
Create build.yml #866
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+116
β248
Merged
Create build.yml #866
Changes from 5 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
1cb5fdf
Create build.yml
guibranco b5622f3
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] daa8242
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] 4f21909
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] d61a4db
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] 5276ca7
Update build.yml
guibranco 88d485e
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] b38fa20
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] 94081fa
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] 0191ce7
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] 50664bf
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] d9085d1
Update build.yml
guibranco 18bf3b6
Merge branch 'main' into guibranco-patch-1
gstraccini[bot] 36d7739
Update build.yml
guibranco 36a9e11
Update build.yml
guibranco 2226afc
Delete appveyor.yml
guibranco 17a3ea8
Update build.yml
guibranco 7436611
Update build.yml
guibranco ef90f19
Delete .github/workflows/deep-source.yml
guibranco ad6ebb2
Delete .github/workflows/sonarcloud.yml
guibranco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or 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,196 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches-ignore: | ||
| - main | ||
| pull_request: | ||
|
|
||
| concurrency: | ||
| group: ci-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| env: | ||
| DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true | ||
| DOTNET_NOLOGO: true | ||
|
|
||
| jobs: | ||
| build-test-coverage: | ||
| name: Build Β· Test Β· Coverage | ||
| runs-on: ubuntu-latest | ||
|
|
||
| # ββ CouchDB service container ββββββββββββββββββββββββββββββββββββββββββββββ | ||
| services: | ||
| couchdb: | ||
| image: couchdb:3.3.3 | ||
| env: | ||
| COUCHDB_USER: Admin | ||
| COUCHDB_PASSWORD: myP@ssw0rd | ||
|
github-advanced-security[bot] marked this conversation as resolved.
Fixed
github-advanced-security[bot] marked this conversation as resolved.
Fixed
guibranco marked this conversation as resolved.
Dismissed
|
||
| ports: | ||
| - 5984:5984 | ||
| options: >- | ||
| --health-cmd "curl -sf http://localhost:5984/_up" | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 10 | ||
|
|
||
| steps: | ||
| # ββ Checkout βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| # ββ Toolchain ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Setup .NET 10 | ||
| uses: actions/setup-dotnet@v4 | ||
| with: | ||
| dotnet-version: "10.0.x" | ||
|
|
||
| - name: Setup Java 21 # Required by SonarScanner and Codacy reporter | ||
| uses: actions/setup-java@v4 | ||
| with: | ||
| distribution: temurin | ||
| java-version: "21" | ||
|
|
||
| # ββ GitVersion βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Install GitVersion | ||
| uses: gittools/actions/gitversion/setup@v3 | ||
| with: | ||
| versionSpec: "6.x" | ||
|
|
||
| - name: Determine version | ||
| id: gitversion | ||
| uses: gittools/actions/gitversion/execute@v3 | ||
|
|
||
| - name: Patch .props files with computed version | ||
| run: | | ||
| VERSION="${{ steps.gitversion.outputs.semVer }}" | ||
| echo "Patching version β $VERSION" | ||
| find . -name "*.props" -print0 | xargs -0 sed -i \ | ||
| -e "s|<Version>[^<]*</Version>|<Version>$VERSION</Version>|g" \ | ||
| -e "s|<PackageVersion>[^<]*</PackageVersion>|<PackageVersion>$VERSION</PackageVersion>|g" \ | ||
| -e "s|<AssemblyVersion>[^<]*</AssemblyVersion>|<AssemblyVersion>$VERSION</AssemblyVersion>|g" \ | ||
| -e "s|<FileVersion>[^<]*</FileVersion>|<FileVersion>$VERSION</FileVersion>|g" \ | ||
| -e "s|<InformationalVersion>[^<]*</InformationalVersion>|<InformationalVersion>$VERSION</InformationalVersion>|g" | ||
|
|
||
| # ββ Resolve solution name βββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Resolve solution name | ||
| id: solution | ||
| run: | | ||
| SLN=$(find . -maxdepth 2 -name "*.sln" | head -1 | xargs basename -s .sln) | ||
| echo "name=$SLN" >> "$GITHUB_OUTPUT" | ||
| echo "Solution: $SLN" | ||
|
|
||
| # ββ Install global tools ββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Install dotnet-sonarscanner | ||
| run: dotnet tool install --global dotnet-sonarscanner | ||
|
|
||
| - name: Restore NuGet packages | ||
| run: dotnet restore | ||
|
|
||
| # ββ Determine whether this is an internal PR or a fork PR βββββββββββββββββ | ||
| # Sonar/Codecov/Codacy are only invoked for internal branches and | ||
| # PRs from the same repo (matching AppVeyor's LOCAL_PR guard). | ||
| - name: Resolve Sonar context flags | ||
| id: ctx | ||
| run: | | ||
| IS_FORK="false" | ||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| if [[ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then | ||
| IS_FORK="true" | ||
| fi | ||
| fi | ||
| echo "is_fork=$IS_FORK" >> "$GITHUB_OUTPUT" | ||
|
|
||
| SONAR_PROJECT="${GITHUB_REPOSITORY/\//_}" | ||
| SONAR_ORG="${GITHUB_REPOSITORY_OWNER}" | ||
| echo "sonar_project=$SONAR_PROJECT" >> "$GITHUB_OUTPUT" | ||
| echo "sonar_org=$SONAR_ORG" >> "$GITHUB_OUTPUT" | ||
|
|
||
| # ββ SonarCloud: begin βββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: SonarCloud β begin scan | ||
| if: steps.ctx.outputs.is_fork == 'false' | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| run: | | ||
| SLN="${{ steps.solution.outputs.name }}" | ||
| VERSION="${{ steps.gitversion.outputs.semVer }}" | ||
| PROJECT="${{ steps.ctx.outputs.sonar_project }}" | ||
| ORG="${{ steps.ctx.outputs.sonar_org }}" | ||
|
|
||
| PARAMS=( | ||
| "/k:$PROJECT" | ||
| "/o:$ORG" | ||
| "/v:$VERSION" | ||
| "/d:sonar.host.url=https://sonarcloud.io" | ||
| "/d:sonar.token=$SONAR_TOKEN" | ||
| "/d:sonar.scanner.scanAll=false" | ||
| "/d:sonar.exclusions=**/bin/**/*,**/obj/**/*" | ||
| "/d:sonar.coverage.exclusions=**/${SLN}.Tests/**,**/*Tests.cs" | ||
| "/d:sonar.cs.opencover.reportsPaths=Tests/${SLN}.Tests/coverage.net9.0.opencover.xml" | ||
| ) | ||
|
|
||
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | ||
| PARAMS+=( | ||
| "/d:sonar.pullrequest.key=${{ github.event.pull_request.number }}" | ||
| "/d:sonar.pullrequest.branch=${{ github.head_ref }}" | ||
| "/d:sonar.pullrequest.base=${{ github.base_ref }}" | ||
| ) | ||
| else | ||
| PARAMS+=("/d:sonar.branch.name=${{ github.ref_name }}") | ||
| fi | ||
|
guibranco marked this conversation as resolved.
Outdated
|
||
|
|
||
| dotnet sonarscanner begin "${PARAMS[@]}" | ||
|
|
||
| # ββ Build βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Build | ||
| run: dotnet build --no-restore --verbosity minimal ${{ steps.solution.outputs.name }}.sln | ||
|
|
||
| # ββ Test + coverage βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Test with coverage | ||
| run: | | ||
| for TEST_PROJ in $(find ./Tests -name "*.csproj" -type f); do | ||
| PROJ_DIR=$(dirname "$TEST_PROJ") | ||
| dotnet test "$TEST_PROJ" \ | ||
| --no-build \ | ||
| --verbosity minimal \ | ||
| /p:CollectCoverage=true \ | ||
| /p:CoverletOutputFormat='"cobertura,opencover,lcov"' \ | ||
| --logger:"junit;LogFilePath=test-results.xml" | ||
| done | ||
|
|
||
| - name: Publish test results | ||
| uses: actions/upload-artifact@v4 | ||
| if: always() | ||
| with: | ||
| name: test-results-${{ github.run_id }} | ||
| path: Tests/**/test-results.xml | ||
|
|
||
| # ββ Coverage reporting ββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: Report coverage β Codecov | ||
| if: steps.ctx.outputs.is_fork == 'false' | ||
| uses: codecov/codecov-action@v4 | ||
| with: | ||
| token: ${{ secrets.CODECOV_TOKEN }} | ||
| files: Tests/${{ steps.solution.outputs.name }}.Tests/coverage.net9.0.opencover.xml | ||
| fail_ci_if_error: false | ||
|
|
||
| - name: Report coverage β Codacy | ||
| if: steps.ctx.outputs.is_fork == 'false' | ||
| run: | | ||
| SLN="${{ steps.solution.outputs.name }}" | ||
| curl -fsSL \ | ||
| https://github.com/codacy/codacy-coverage-reporter/releases/latest/download/codacy-coverage-reporter-assembly.jar \ | ||
| -o codacy-reporter.jar | ||
| java -jar codacy-reporter.jar report \ | ||
| -l CSharp \ | ||
| -t "${{ secrets.CODACY_PROJECT_TOKEN }}" \ | ||
| -r "Tests/${SLN}.Tests/coverage.net9.0.opencover.xml" | ||
|
|
||
| # ββ SonarCloud: end βββββββββββββββββββββββββββββββββββββββββββββββββββββββ | ||
| - name: SonarCloud β end scan | ||
| if: steps.ctx.outputs.is_fork == 'false' | ||
| env: | ||
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
| run: dotnet sonarscanner end /d:sonar.token="$SONAR_TOKEN" | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.