Skip to content
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

Update appveyor.yml #373

Merged
merged 6 commits into from
Nov 13, 2024
Merged

Update appveyor.yml #373

merged 6 commits into from
Nov 13, 2024

Conversation

guibranco
Copy link
Owner

@guibranco guibranco commented Nov 12, 2024

Closes #

πŸ“‘ Description

βœ… Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

☒️ Does this introduce a breaking change?

  • Yes
  • No

β„Ή Additional Information

Summary by CodeRabbit

  • Chores
    • Enhanced build configuration for improved clarity and organization.
    • Updated paths and commands for test execution and coverage reporting.
    • Added commands for generating and uploading artifacts.
    • Reformatted deployment section for better readability.
    • Updated Java home path to JDK 21.

Copy link

coderabbitai bot commented Nov 12, 2024

Walkthrough

The changes in this pull request focus on restructuring the appveyor.yml file to enhance clarity and organization of the build configuration. Key modifications include the adoption of list formats for various sections, updates to paths and commands for coverage reporting, and the addition of commands for generating and uploading artifacts. The build section is disabled, and the deploy section has been reformatted while maintaining the existing deployment logic.

Changes

File Change Summary
appveyor.yml - Restructured init, before_build, and deploy sections to list format for clarity.
- Disabled build section with build: off.
- Updated build_script with new parameters for SonarScanner and modified coverage report paths.
- Added logger for JUnit output in test execution command and included upload of test results to AppVeyor.
- Expanded after_build section for generating and pushing artifacts, including nupkg and snupkg files.
- Enhanced coverage artifact generation with commands for zipping and pushing results.

Possibly related PRs

Suggested labels

enhancement, size/M, Review effort [1-5]: 2

Suggested reviewers

  • gstraccini

🐰 In the meadow, changes bloom,
A YAML file finds more room.
With lists and paths, it’s clear and bright,
Artifacts ready, all in sight!
A hop, a skip, let’s build with glee,
For every change, there’s joy, you see! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❀️ Share
πŸͺ§ Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Nov 12, 2024
@guibranco guibranco enabled auto-merge (squash) November 12, 2024 05:20
@gstraccini gstraccini bot added the β˜‘οΈ auto-merge Automatic merging of pull requests (gstraccini-bot) label Nov 12, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (7)
appveyor.yml (7)

37-42: Consider adding token validation for enhanced security

The PR detection logic is good, but consider adding token validation to ensure the security tokens are properly set before attempting to use them.

 - ps: $env:LOCAL_PR = 0
 - ps: if(-Not $env:APPVEYOR_PULL_REQUEST_NUMBER) { $env:LOCAL_PR = 1 }
 - ps: if($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -Eq $env:APPVEYOR_REPO_NAME) { $env:LOCAL_PR = 1 }
+- ps: |
+     if ($env:LOCAL_PR -eq 1) {
+       if (-Not $env:SONAR_TOKEN) { throw "SONAR_TOKEN is not set" }
+       if (-Not $env:CODACY_PROJECT_TOKEN) { throw "CODACY_PROJECT_TOKEN is not set" }
+       if (-Not $env:CODECLIMATE_TOKEN) { throw "CODECLIMATE_TOKEN is not set" }
+     }

67-71: Fix trailing whitespace and consider parameterizing .NET version

  1. Remove trailing whitespace on line 70
  2. Consider parameterizing the .NET version in coverage paths to make it more maintainable
-          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))          
+          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))

Also consider adding:

$env:DOTNET_VERSION = "net8.0"

And using it in coverage paths:

"/p:CoverletOutputFormat=`"cobertura,opencover,lcov`"" --logger:"junit;LogFilePath=test-results.xml"
🧰 Tools
πŸͺ› yamllint

[error] 70-70: trailing spaces

(trailing-spaces)


79-80: Enhance exclusions file content

The exclusions.txt file content seems minimal. Consider expanding it to exclude other common unnecessary files.

-echo refs > exclusions.txt
+@echo refs > exclusions.txt
+@echo *.pdb >> exclusions.txt
+@echo *.xml >> exclusions.txt
+@echo *.deps.json >> exclusions.txt

81-82: Consider moving configuration to variables section

Move these arrays to the environment section for better maintainability and reusability.

-  - ps: $VERSIONS = ("netstandard2.0", "netstandard2.1", "net6.0", "net8.0")
-  - ps: $PROJECTS = ("Health")
+environment:
+  VERSIONS: netstandard2.0;netstandard2.1;net6.0;net8.0
+  PROJECTS: Health

Then use:

$VERSIONS = $env:VERSIONS.Split(';')
$PROJECTS = $env:PROJECTS.Split(';')

129-141: Consider adding deployment validation steps

The deployment configuration looks good, but consider adding validation steps to ensure package quality before deployment.

Add these checks before deployment:

  - provider: NuGet
    api_key: $(NUGET_TOKEN)
    skip_symbols: false
    artifact: /.*\.nupkg/
    on:
      branch: main
      APPVEYOR_REPO_TAG: true  # Only deploy on tagged commits

Line range hint 1-141: Add pipeline documentation

Consider adding comments to document the pipeline's major sections and their purposes. This will help future maintainers understand the workflow.

Add section headers like:

# Build configuration
version: 2.3.{build}
skip_tags: true

# Build environment setup
environment:
  # Tokens for various services
  CODACY_PROJECT_TOKEN:
    secure: ...

# And so on for each major section
🧰 Tools
πŸͺ› yamllint

[error] 34-34: trailing spaces

(trailing-spaces)


[error] 70-70: trailing spaces

(trailing-spaces)


Line range hint 6-8: Document security token management

Consider adding documentation about token rotation procedures and access requirements for the secure tokens.

Add a comment block:

environment:
  # Security tokens - Rotate every 90 days
  # Required permissions:
  # - CODACY_PROJECT_TOKEN: Project-level access
  # - CODECLIMATE_TOKEN: Repository-level access
  CODACY_PROJECT_TOKEN:
    secure: ...
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 1f2e144 and 575b10c.

πŸ“’ Files selected for processing (1)
  • appveyor.yml (2 hunks)
🧰 Additional context used
πŸͺ› yamllint
appveyor.yml

[error] 70-70: trailing spaces

(trailing-spaces)

πŸ”‡ Additional comments (1)
appveyor.yml (1)

22-23: LGTM: Java environment setup for coverage tools

The Java environment setup is correctly configured for the Codacy coverage reporter.

@AppVeyorBot
Copy link

❌ Build VTEX-SDK-dotnet 2.3.1687 failed (commit e9205e43d3 by @gstraccini[bot])

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (4)
appveyor.yml (4)

44-47: Consider consolidating coverage tools

The configuration installs multiple coverage reporting tools (OpenCover, Codecov, Codacy, CodeClimate) which might be redundant. Consider standardizing on fewer tools to reduce build complexity and maintenance overhead.


67-71: Fix test results upload formatting

  1. Remove trailing spaces on line 70
  2. Consider adding error handling for test result upload
-          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))          
+          try {
+              $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))
+          } catch {
+              Write-Warning "Failed to upload test results: $_"
+          }
🧰 Tools
πŸͺ› yamllint

[error] 70-70: trailing spaces

(trailing-spaces)


81-82: Consider dynamic version detection

Instead of hardcoding supported .NET versions and projects, consider detecting them from the solution/project files.

# Example approach for version detection
$VERSIONS = Get-ChildItem -Path Src -Filter *.csproj | 
    Select-String -Pattern "<TargetFramework>(.*)</TargetFramework>" | 
    ForEach-Object { $_.Matches.Groups[1].Value } | 
    Sort-Object -Unique

Line range hint 1-141: Addressing the reported build failure

Based on the review, here are the key areas to investigate for the build failure:

  1. Verify Java 19 installation on the build agent
  2. Check if the hardcoded paths for coverage reports match the actual file locations
  3. Consider simplifying the coverage tool chain to reduce potential points of failure

Would you like me to help investigate the build logs for more specific error details?

🧰 Tools
πŸͺ› yamllint

[error] 34-34: trailing spaces

(trailing-spaces)


[error] 70-70: trailing spaces

(trailing-spaces)

πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 575b10c and 08cc244.

πŸ“’ Files selected for processing (1)
  • appveyor.yml (3 hunks)
🧰 Additional context used
πŸͺ› yamllint
appveyor.yml

[error] 70-70: trailing spaces

(trailing-spaces)

πŸ”‡ Additional comments (3)
appveyor.yml (3)

1-1: Version bump looks appropriate

The version increment from 2.3 to 2.4 aligns with the significant changes in the build configuration.


129-141: Deployment configuration looks good

The deployment setup follows best practices:

  • Restricted to main branch
  • Includes both NuGet and GitHub releases
  • Uses secure token handling

22-23: Verify Java installation on build agent

Given the reported build failure, ensure that JDK19 is available on the Visual Studio 2022 image. Consider using a more flexible Java version detection approach.

- ps: $Params += "/d:sonar.host.url=`"https://sonarcloud.io`" /d:sonar.scanner.scanAll=false"
- ps: if($env:LOCAL_PR -Eq 1) { $Params += "/d:sonar.token=`"$env:SONAR_TOKEN`"" }
- ps: $Params += "/d:sonar.exclusions=`"**/bin/**/*,**/obj/**/*`"", "/d:sonar.coverage.exclusions=`"**/$env:SOLUTION_NAME.Tests/**,**/*Tests.cs`""
- ps: $Params += "/d:sonar.cs.opencover.reportsPaths=`"Tests\$env:SOLUTION_NAME.Tests\coverage.net8.0.opencover.xml`""
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

Avoid hardcoding .NET version in coverage path

The coverage path is hardcoded to net8.0. Consider making it dynamic to support multiple .NET versions.

-/d:sonar.cs.opencover.reportsPaths=`"Tests\$env:SOLUTION_NAME.Tests\coverage.net8.0.opencover.xml`""
+/d:sonar.cs.opencover.reportsPaths=`"Tests\$env:SOLUTION_NAME.Tests\coverage.*.opencover.xml`""
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- ps: $Params += "/d:sonar.cs.opencover.reportsPaths=`"Tests\$env:SOLUTION_NAME.Tests\coverage.net8.0.opencover.xml`""
- ps: $Params += "/d:sonar.cs.opencover.reportsPaths=`"Tests\$env:SOLUTION_NAME.Tests\coverage.*.opencover.xml`""

@guibranco
Copy link
Owner Author

@gstraccini appveyor build pr

@guibranco
Copy link
Owner Author

@gstraccini appveyor build commit

Copy link
Contributor

gstraccini bot commented Nov 13, 2024

I'm sorry @guibranco, I can't do that. Invalid parameter. πŸ₯Ί

@guibranco
Copy link
Owner Author

@gstraccini appveyor build pull request

Copy link
Contributor

gstraccini bot commented Nov 13, 2024

AppVeyor build (commit) started! πŸš€

Build ID: 50978504
Version: 2.4.0

Copy link
Contributor

gstraccini bot commented Nov 13, 2024

AppVeyor build (pull request) started! πŸš€

Build ID: 50978506
Version: 2.4.1

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (4)
appveyor.yml (4)

22-23: Consider using a more resilient Java setup

Hardcoding the Java path might break if AppVeyor's image changes. Consider using AppVeyor's built-in Java configuration or verifying the path exists.

-  - SET JAVA_HOME=C:\Program Files\Java\jdk19
-  - SET PATH=%JAVA_HOME%\bin;%PATH%
+  - ps: |
+      $javaHome = Get-ChildItem "C:\Program Files\Java" -Filter "jdk*" | Sort-Object Name -Descending | Select-Object -First 1
+      if ($javaHome) {
+          $env:JAVA_HOME = $javaHome.FullName
+          $env:PATH = "$env:JAVA_HOME\bin;$env:PATH"
+      } else {
+          throw "Java installation not found"
+      }

70-70: Remove trailing spaces

Remove trailing spaces to maintain consistent formatting.

-          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))          
+          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))
🧰 Tools
πŸͺ› yamllint

[error] 70-70: trailing spaces

(trailing-spaces)


81-82: Consider externalizing configuration

Move version and project lists to environment variables or a configuration file for easier maintenance.

-  - ps: $VERSIONS = ("netstandard2.0", "netstandard2.1", "net6.0", "net8.0")
-  - ps: $PROJECTS = ("Health")
+  - ps: |
+      $versionsJson = Get-Content "build-config.json" | ConvertFrom-Json
+      $VERSIONS = $versionsJson.targetFrameworks
+      $PROJECTS = $versionsJson.projects

129-134: Enhance deployment reliability

Consider adding timeout and retry settings for NuGet deployment to handle temporary network issues.

   - provider: NuGet
     api_key: $(NUGET_TOKEN)
     skip_symbols: false
+    max_trials: 3
+    timeout: 300
     on:
       branch: main
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between 08cc244 and dd7b099.

πŸ“’ Files selected for processing (1)
  • appveyor.yml (3 hunks)
🧰 Additional context used
πŸͺ› yamllint
appveyor.yml

[error] 70-70: trailing spaces

(trailing-spaces)

Comment on lines +44 to +46
- cmd: choco install opencover.portable
- cmd: choco install codecov
- cmd: curl -L https://github.com/codacy/codacy-coverage-reporter/releases/latest/download/codacy-coverage-reporter-assembly.jar > ./codacy-test-reporter.jar
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Enhance security and reliability of tool installation

  1. Specify versions for Chocolatey packages to ensure reproducible builds
  2. Verify downloaded files' integrity using checksums
-  - cmd: choco install opencover.portable
-  - cmd: choco install codecov
-  - cmd: curl -L https://github.com/codacy/codacy-coverage-reporter/releases/latest/download/codacy-coverage-reporter-assembly.jar > ./codacy-test-reporter.jar
+  - cmd: choco install opencover.portable --version=4.7.1922
+  - cmd: choco install codecov --version=1.13.0
+  - ps: |
+      $codacyUrl = "https://github.com/codacy/codacy-coverage-reporter/releases/latest/download/codacy-coverage-reporter-assembly.jar"
+      $expectedHash = "SHA256_HASH_HERE" # Replace with actual hash
+      Invoke-WebRequest -Uri $codacyUrl -OutFile "./codacy-test-reporter.jar"
+      $actualHash = (Get-FileHash -Path "./codacy-test-reporter.jar" -Algorithm SHA256).Hash
+      if ($actualHash -ne $expectedHash) {
+          throw "Codacy reporter JAR checksum verification failed"
+      }

Committable suggestion skipped: line range outside the PR's diff.

assembly_version: '{version}'
file_version: '{version}'
informational_version: '{version}'
file: '**\*.props'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ’‘ Codebase verification

Changing the file pattern to **/*.props excludes all .csproj files, which may prevent the CI/CD pipeline from building the projects correctly.

πŸ”— Analysis chain

**Verify the impact of changing file pattern from .csproj to .props

This change could affect version patching behavior. Ensure that all necessary files are still being properly versioned.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check for both .props and .csproj files to understand the impact
echo "Checking for .props files:"
fd -e props
echo -e "\nChecking for .csproj files:"
fd -e csproj

Length of output: 335

Copy link

codacy-production bot commented Nov 13, 2024

Coverage summary from Codacy

See diff coverage on Codacy

Coverage variation Diff coverage
Report missing for 699ae9f1 βœ… βˆ…
Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (699ae9f) Report Missing Report Missing Report Missing
Head commit (b86e5e6) 1777 4 0.23%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#373) 0 0 βˆ… (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

See your quality gate settingsΒ Β Β Β Change summary preferences

Codacy stopped sending the deprecated coverage status on June 5th, 2024. Learn more

Footnotes

  1. Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct. ↩

@AppVeyorBot
Copy link

❌ Build VTEX-SDK-dotnet 2.4.1 failed (commit f39cd63186 by @guibranco)

Copy link
Contributor

Infisical secrets check: βœ… No secrets leaked!

πŸ’» Scan logs
2:27PM INF scanning for exposed secrets...
2:27PM INF 576 commits scanned.
2:27PM INF scan completed in 302ms
2:27PM INF no leaks found

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (3)
appveyor.yml (3)

70-70: Fix trailing whitespace

Remove trailing spaces at the end of line 70.

-          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))          
+          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))
🧰 Tools
πŸͺ› yamllint

[error] 70-70: trailing spaces

(trailing-spaces)


67-71: Consider parameterizing test result configuration

The test results configuration is hardcoded. Consider making it more configurable:

  1. Test result filename could be an environment variable
  2. Test framework type (xunit) could be configurable
-          dotnet test $testProject --no-build --verbosity minimal /p:CollectCoverage=true "/p:CoverletOutputFormat=\`"cobertura,opencover,lcov\`"" --logger:"junit;LogFilePath=test-results.xml"
+          $testResultFile = "test-results.xml"
+          $testFramework = $env:TEST_FRAMEWORK ?? "xunit"
+          dotnet test $testProject --no-build --verbosity minimal /p:CollectCoverage=true "/p:CoverletOutputFormat=\`"cobertura,opencover,lcov\`"" --logger:"junit;LogFilePath=$testResultFile"
-          $wc.UploadFile("https://ci.appveyor.com/api/testresults/xunit/$($env:APPVEYOR_JOB_ID)", (Resolve-Path $path/test-results.xml))
+          $wc.UploadFile("https://ci.appveyor.com/api/testresults/$testFramework/$($env:APPVEYOR_JOB_ID)", (Resolve-Path "$path/$testResultFile"))
🧰 Tools
πŸͺ› yamllint

[error] 70-70: trailing spaces

(trailing-spaces)


81-82: Consider making framework versions configurable

The .NET versions and project list are hardcoded. Consider moving these to environment variables or a configuration file for better maintainability.

-  - ps: $VERSIONS = ("netstandard2.0", "netstandard2.1", "net6.0", "net8.0")
-  - ps: $PROJECTS = ("Health")
+  - ps: $VERSIONS = $env:TARGET_FRAMEWORKS?.Split(',') ?? @("netstandard2.0", "netstandard2.1", "net6.0", "net8.0")
+  - ps: $PROJECTS = $env:SOLUTION_PROJECTS?.Split(',') ?? @("Health")
πŸ“œ Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

πŸ“₯ Commits

Reviewing files that changed from the base of the PR and between dd7b099 and b86e5e6.

πŸ“’ Files selected for processing (1)
  • appveyor.yml (3 hunks)
🧰 Additional context used
πŸͺ› yamllint
appveyor.yml

[error] 70-70: trailing spaces

(trailing-spaces)

πŸ”‡ Additional comments (2)
appveyor.yml (2)

22-23: Verify JDK 21 compatibility

The Java runtime has been upgraded from JDK 19 to JDK 21. This is a major version change that could affect tools like SonarQube and Codacy reporter.

#!/bin/bash
# Check for any Java version dependencies in the tools
rg -l "java.*version|jdk.*version|runtime.*version" -g "*.{xml,json,config,props}"

1-1: Verify version bump implications

The version has been bumped from 2.3 to 2.4. Please ensure this is intentional and follows semantic versioning principles.

Comment on lines +86 to +90
xcopy Src\$env:SOLUTION_NAME\bin\Release\$version\*.* Build\Core\$version\ /s /f /e /r /k /y /EXCLUDE:exclusions.txt
foreach($project in $PROJECTS)
{
xcopy Src\$env:SOLUTION_NAME.$project\bin\Release\$version\*.* Build\$project\$version\ /s /f /e /r /k /y /EXCLUDE:exclusions.txt
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Add error handling for file operations

File operations (xcopy, 7z) lack error handling. Consider adding try-catch blocks and validation:

+  - ps: function Copy-ProjectFiles {
+      param($source, $target)
+      if (-not (Test-Path $source)) {
+          Write-Warning "Source path not found: $source"
+          return $false
+      }
+      try {
+          xcopy $source $target /s /f /e /r /k /y /EXCLUDE:exclusions.txt
+          return $true
+      } catch {
+          Write-Error "Failed to copy files from $source to $target: $_"
+          return $false
+      }
+  }
   - ps: |
       foreach($version in $VERSIONS)
       {
-          xcopy Src\$env:SOLUTION_NAME\bin\Release\$version\*.* Build\Core\$version\ /s /f /e /r /k /y /EXCLUDE:exclusions.txt
+          $success = Copy-ProjectFiles "Src\$env:SOLUTION_NAME\bin\Release\$version\*.*" "Build\Core\$version\"
+          if (-not $success) { continue }
           foreach($project in $PROJECTS)
           {
-              xcopy Src\$env:SOLUTION_NAME.$project\bin\Release\$version\*.* Build\$project\$version\ /s /f /e /r /k /y /EXCLUDE:exclusions.txt
+              Copy-ProjectFiles "Src\$env:SOLUTION_NAME.$project\bin\Release\$version\*.*" "Build\$project\$version\"
           }
       }

Also applies to: 117-122

Comment on lines +129 to +141
- provider: NuGet
api_key: $(NUGET_TOKEN)
skip_symbols: false
on:
branch: main

- provider: GitHub
on:
branch: main
tag: v$(appveyor_build_version)
description: "Release of $(SOLUTION_NAME) - v$(appveyor_build_version)"
auth_token: $(GITHUB_TOKEN)
force_update: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

πŸ› οΈ Refactor suggestion

Consider adding deployment validation

The deployment configuration lacks pre-deployment validation steps. Consider adding checks for required environment variables and artifact existence.

deploy:
   - provider: NuGet
     api_key: $(NUGET_TOKEN)
     skip_symbols: false
+    artifact: /.*\.s?nupkg/
     on:
       branch: main
+      NUGET_TOKEN: true

   - provider: GitHub
     on:
       branch: main
+      GITHUB_TOKEN: true
     tag: v$(appveyor_build_version)
     description: "Release of $(SOLUTION_NAME) - v$(appveyor_build_version)"
     auth_token: $(GITHUB_TOKEN)
     force_update: true
+    artifact: /.*\.(zip|s?nupkg)/
πŸ“ Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
- provider: NuGet
api_key: $(NUGET_TOKEN)
skip_symbols: false
on:
branch: main
- provider: GitHub
on:
branch: main
tag: v$(appveyor_build_version)
description: "Release of $(SOLUTION_NAME) - v$(appveyor_build_version)"
auth_token: $(GITHUB_TOKEN)
force_update: true
- provider: NuGet
api_key: $(NUGET_TOKEN)
skip_symbols: false
artifact: /.*\.s?nupkg/
on:
branch: main
NUGET_TOKEN: true
- provider: GitHub
on:
branch: main
GITHUB_TOKEN: true
tag: v$(appveyor_build_version)
description: "Release of $(SOLUTION_NAME) - v$(appveyor_build_version)"
auth_token: $(GITHUB_TOKEN)
force_update: true
artifact: /.*\.(zip|s?nupkg)/

@AppVeyorBot
Copy link

@guibranco guibranco merged commit 579c3a2 into main Nov 13, 2024
36 checks passed
@guibranco guibranco deleted the guibranco-patch-16 branch November 13, 2024 15:27
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests βœ…

Project coverage is 0.22%. Comparing base (1f2e144) to head (b86e5e6).
Report is 13 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff            @@
##            main    #373      +/-   ##
========================================
- Coverage   0.22%   0.22%   -0.01%     
========================================
  Files        117     117              
  Lines       1774    1777       +3     
  Branches      75      75              
========================================
  Hits           4       4              
- Misses      1770    1771       +1     
- Partials       0       2       +2     

β˜” View full report in Codecov by Sentry.
πŸ“’ Have feedback on the report? Share it here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
β˜‘οΈ auto-merge Automatic merging of pull requests (gstraccini-bot) size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants