Skip to content

Conversation

@josesimoes
Copy link
Member

@josesimoes josesimoes commented Apr 29, 2025

Description

  • Merge with main.

Motivation and Context

  • Used for unit tests in interpreter.

How Has This Been Tested?

[tested against nanoclr buildId 57190].

Screenshots

Types of changes

  • Improvement (non-breaking change that improves a feature, code or algorithm)
  • Bug fix (non-breaking change which fixes an issue with code or algorithm)
  • New feature (non-breaking change which adds functionality to code)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Config and build (change in the configuration and build system, has no impact on code or features)
  • Dependencies (update dependencies and changes associated, has no impact on code or features)
  • Unit Tests (add new Unit Test(s) or improved existing one(s), has no impact on code or features)
  • Documentation (changes or updates in the documentation, has no impact on code or features)

Checklist:

  • My code follows the code style of this project (only if there are changes in source code).
  • My changes require an update to the documentation (there are changes that require the docs website to be updated).
  • I have updated the documentation accordingly (the changes require an update on the docs in this repo).
  • I have read the CONTRIBUTING document.
  • I have tested everything locally and all new and existing tests passed (only if there are changes in source code).
  • I have added new tests to cover my changes.

Summary by CodeRabbit

  • Chores

    • Simplified pipeline triggers and adjusted release gating to consider main and develop branches.
    • Switched to semantic preview versioning (preview height-based build number) and added an extra branch pattern for public releases.
    • Added options to pipeline templates to support preview builds and set the base branch for publishing.
  • New Features

    • Added a pipeline check that detects referenced nanoCLR preview builds in PRs and can download and expose the preview runtime for testing.

- Publish to nuget now happens on build from develop branch too.
- Temporary disable trigger for tags.

***NO_CI***
- Fix parameter name.
- Add branch to publish nugets from.

***NO_CI***
@coderabbitai
Copy link

coderabbitai bot commented Apr 29, 2025

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

CI pipeline and versioning were updated: azure-pipelines.yml changes template parameters, variables, triggers, and release conditions; a new template was added to extract nanoCLR build IDs from PRs and optionally download artifacts; version.json switched to semantic preview versioning and added a branch pattern.

Changes

Cohort / File(s) Change Summary
Pipeline root
azure-pipelines.yml
Removed top-level tag-based trigger filter; added DOTNET_NOLOGO: true under build_mscorlib; inserted check-nf-interpreter-to-test.yml template; passed usePreviewBuild: true to class-lib-build-only.yml; passed baseBranchName: 'develop' to class-lib-publish.yml; broadened release conditions to consider develop (via Build.SourceBranchName) and adjusted isPreRelease logic; minor reordering/cleanup.
New pipeline template
azure-pipelines-templates/check-nf-interpreter-to-test.yml
New template that calls GitHub REST API (using GITHUB_TOKEN) to read PR body, validates PR number, extracts a nanoCLR buildId via regex, sets NFINTERPRETER_BUILDID pipeline variable, conditionally downloads a nanoCLR preview artifact when enabled, and exposes NF_MDP_NANOCLR_INSTANCE_PATH.
Versioning config
version.json
Switched base version to 2.0.0-preview.{height} (preview tag with height-based build number) and added branch pattern ^refs/heads/generics$ to branches considered for public releases.

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer
    participant AP as AzurePipelines
    participant GH as GitHub
    participant Art as ArtifactStorage

    Dev->>AP: Push / open PR
    AP->>AP: Start pipeline
    alt PR present
        AP->>AP: Run check-nf-interpreter-to-test template
        AP->>GH: GET /repos/.../pulls/{PR} (auth: GITHUB_TOKEN)
        GH-->>AP: PR payload (body)
        AP->>AP: Verify PR number, extract buildId via regex
        alt buildId found and DownloadNanoClrPreview = true
            AP->>Art: Download nanoCLR artifact (by buildId)
            Art-->>AP: artifact (nanoCLR dll)
            AP->>AP: Set NF_MDP_NANOCLR_INSTANCE_PATH variable
        else
            AP-->>AP: Skip download
        end
    end
    AP->>AP: Run class-lib-build-only (usePreviewBuild: true)
    AP->>AP: Run class-lib-publish (baseBranchName: develop)
    AP->>AP: Read version.json (2.0.0-preview.{height})
    AP->>AP: Evaluate release condition (branch main or develop, not StartReleaseCandidate)
    alt release conditions satisfied
        AP->>GH: Create GitHub release (isPreRelease when branch is develop)
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Title Check ⚠️ Warning The title asserts that this PR merges generics support into mscorlib, but the changeset consists solely of CI pipeline configuration and versioning updates without any mscorlib code modifications related to generics. This discrepancy means the title does not accurately summarize the main content of the changes. Please revise the PR title to reflect the actual scope of the changes—such as updating Azure Pipelines and versioning for generics testing—or include the intended generics support code changes in mscorlib so that the title matches the diff.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

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

🧹 Nitpick comments (2)
azure-pipelines.yml (2)

59-60: Remove duplicate variable declaration & trailing spaces.

You’ve declared DOTNET_NOLOGO both globally (lines 36–37) and again under the Build_mscorlib job. This duplication is unnecessary and may lead to confusion. Also, YAMLlint flagged trailing spaces on line 60.

🧰 Tools
🪛 YAMLlint (1.35.1)

[error] 60-60: trailing spaces

(trailing-spaces)


132-136: Consider adding the generics branch to release conditions.

You’ve broadened the GitHub release condition to run on main and develop. To stay consistent with the new publicReleaseRefSpec, you might also include generics here if you intend to create releases from that branch.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cca059e and e37e4b8.

⛔ Files ignored due to path filters (11)
  • .runsettings is excluded by none and included by none
  • Tests/NFUnitTestGC/TestGC.cs is excluded by none and included by none
  • Tests/NFUnitTestSystemLib/UnitTestGCTest.cs is excluded by none and included by none
  • Tests/NFUnitTestSystemLib/UnitTestInitLocalTests.cs is excluded by none and included by none
  • Tests/NFUnitTestSystemLib/UnitTestReflectionTypeTest.cs is excluded by none and included by none
  • Tests/UnitTestLauncher/UnitTestLauncher.nfproj is excluded by none and included by none
  • nanoFramework.CoreLibrary.nuspec is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/AssemblyInfo.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/GC.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Guid.cs is excluded by none and included by none
  • nanoFramework.TestFramework is excluded by none and included by none
📒 Files selected for processing (2)
  • azure-pipelines.yml (3 hunks)
  • version.json (2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.35.1)
azure-pipelines.yml

[error] 60-60: trailing spaces

(trailing-spaces)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: nanoframework.CoreLibrary (Build_mscorlib)
  • GitHub Check: nanoframework.CoreLibrary (Build_mscorlib)
🔇 Additional comments (4)
version.json (2)

3-3: Approve semantic version update.

Updating the base version to "2.0.0-preview.{height}" correctly switches to semantic versioning with a preview suffix. This aligns with the pipeline change enabling preview builds.


14-14: Approve new public release branch pattern.

Adding ^refs/heads/generics$ to publicReleaseRefSpec ensures the newly merged “generics” branch is considered for public releases.

azure-pipelines.yml (2)

79-79: Verify template supports usePreviewBuild.

You’ve enabled usePreviewBuild: true in the class-lib-build-only.yml invocation. Please confirm that the template accepts and correctly propagates this parameter to invoke preview-mode builds as expected.


122-125: Ensure publish step aligns with new branches.

The class-lib-publish.yml template is now called with baseBranchName: 'develop'. Given that version.json includes a generics branch for public releases, please verify whether baseBranchName should dynamically reflect generics (or accept a list of branches) to fully support that branch.

@sonarqubecloud
Copy link

- Add target for .NET Framework v4.7.2
- Add AZDO template to run unit tests with specific build of nanoCLR.

***NO_CI***
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: 3

🧹 Nitpick comments (7)
azure-pipelines-templates/check-nf-interpreter-to-test.yml (6)

27-31: Comment mismatch (body vs commit message).

You’re parsing the PR body, not the commit message. Update the comment to avoid confusion.

-        # grab PR commit message
+        # grab PR body (description)

47-51: Condition compares against unquoted booleans.

Azure DevOps variables are strings; compare to 'true' to avoid surprises.

-      and(
-        eq(variables['DownloadNanoClrPreview'], true),
-        ne(variables['NFINTERPRETER_BUILDID'], '')
-      )
+      and(
+        eq(variables['DownloadNanoClrPreview'], 'true'),
+        ne(variables['NFINTERPRETER_BUILDID'], '')
+      )

63-69: Replicate boolean-string comparison in second condition.

Mirror the fix to keep behavior consistent.

       and(
         succeeded(),
-        eq(variables['DownloadNanoClrPreview'], true),
+        eq(variables['DownloadNanoClrPreview'], 'true'),
         ne(variables['NFINTERPRETER_BUILDID'], '')
       )

44-45: Env var provided but not used in script.

You set GITHUB_TOKEN but read $(GitHubToken) inline. After adopting $env:GITHUB_TOKEN, this stays aligned.

Verify the variable is secret-scoped in the pipeline/variable group.


1-1: Normalize line endings to LF.

YAMLlint flags CRLF. Convert to LF to satisfy linters/CI.


74-75: Variable vs env for downstream tasks.

setvariable defines a pipeline variable; ensure consumers read it as variable or map to env if required. If an env var is needed, use isOutput + stage/job dependencies or setVariable with isSecret as needed.

azure-pipelines.yml (1)

59-61: Duplicate DOTNET_NOLOGO variable.

Already defined at pipeline level (Lines 35-37). Remove duplication here.

-    - name: DOTNET_NOLOGO
-      value: true  
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e37e4b8 and 03e6ddb.

⛔ Files ignored due to path filters (24)
  • Tests/NFUnitTestSystemLib/NFUnitTestSystemLib.nfproj is excluded by none and included by none
  • Tests/NFUnitTestSystemLib/RuntimeHelpersTests.cs is excluded by none and included by none
  • Tests/NFUnitTestSystemLib/UnitTestNullable.cs is excluded by none and included by none
  • Tests/NFUnitTestSystemLib/UnitTestReflectionTypeTest.cs is excluded by none and included by none
  • Tests/NFUnitTestTypes/UnitTestsSpanByte.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary.nuspec is excluded by none and included by none
  • nanoFramework.CoreLibrary/CoreLibrary.nfproj is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Array.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/ArrayTypeMismatchException.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/Comparer.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/ComparerHelpers.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/IComparer.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Diagnostics/DebuggerAttributes.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Diagnostics/StackTraceHiddenAttribute.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Guid.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Nullable.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/ReadOnlySpan.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Runtime/CompilerServices/RuntimeFeature.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Runtime/CompilerServices/RuntimeHelpers.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Runtime/InteropServices/InAttribute .cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Span.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/SpanDebugView.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/String.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Type.cs is excluded by none and included by none
📒 Files selected for processing (2)
  • azure-pipelines-templates/check-nf-interpreter-to-test.yml (1 hunks)
  • azure-pipelines.yml (3 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
azure-pipelines-templates/check-nf-interpreter-to-test.yml

[error] 1-1: wrong new line character: expected \n

(new-lines)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: nanoframework.CoreLibrary (Build_mscorlib)
🔇 Additional comments (4)
azure-pipelines-templates/check-nf-interpreter-to-test.yml (1)

55-56: Verify Azure DevOps project name.

project: 'nf-interpreter' must be the Azure DevOps Project, not the repo. Confirm it matches the pipeline definition 34.

azure-pipelines.yml (3)

72-73: New nf-interpreter check template inclusion looks good.

Placement after process-pr-labels is appropriate; inner step condition limits to PRs.

Confirm the template file path is correct in this repo.


81-81: usePreviewBuild parameter addition LGTM.

Matches the PR goal to enable preview builds.


124-126: class-lib-publish baseBranchName parameter LGTM.

Explicitly setting to develop clarifies behavior.

- Fix task to download nanclr artifact for unit tests.
- GitHub auth now uses token directly.
- Fix condition for pre-release on develop branch.

***NO_CI***
@josesimoes josesimoes marked this pull request as draft September 25, 2025 22:11
@josesimoes josesimoes added ⚠️ DO NOT MERGE ⚠️ This is not to be merged. In doubt check with the person that put the label. Status: in progress labels Sep 25, 2025
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
azure-pipelines.yml (2)

49-51: Inconsistent boolean vs string comparisons in conditions

Azure DevOps variables are strings; mixing boolean literals leads to false negatives. Standardize to string comparisons.

-        eq(variables['UPDATE_DEPENDENTS'], 'false'),
-        eq(variables['StartReleaseCandidate'], 'true')
+        eq(variables['UPDATE_DEPENDENTS'], 'false'),
+        eq(variables['StartReleaseCandidate'], 'true')
-        eq(variables['StartReleaseCandidate'], false),
+        eq(variables['StartReleaseCandidate'], 'false'),

Apply the same fix to all occurrences in this file (e.g., Lines 88-89, 109-110, 134-135).

Also applies to: 88-89, 109-110, 134-135


45-52: Align tag conditions and comment in Build_mscorlib job

The Build_mscorlib job excludes refs/tags/v*, so its “ON tags” release step never runs. Either:

  • Option A (tags): remove the job’s not(startsWith(…,'refs/tags/v')) and change the GithubRelease step’s branch check to startsWith(variables['Build.SourceBranch'], 'refs/tags/v').
  • Option B (branches): rename the # create or update GitHub release ON tags comment to reflect main/develop-only releases.

Applies to lines 44–52 & 128–139.

🧹 Nitpick comments (4)
azure-pipelines.yml (2)

59-60: Duplicate DOTNET_NOLOGO variable

Already defined at Lines 36-37. Remove the duplicate in job variables.

-    - name: DOTNET_NOLOGO
-      value: true  

124-127: baseBranchName hardcoded to 'develop' can misroute behavior on main

If the template adapts behavior based on the base branch, prefer passing the actual branch.

-      baseBranchName: 'develop'
+      baseBranchName: ${{ variables['Build.SourceBranchName'] }}

If the template expects the long ref, use variables['Build.SourceBranch'] instead.

azure-pipelines-templates/check-nf-interpreter-to-test.yml (2)

13-18: Add guard when GITHUB_TOKEN is missing

Avoid unauthenticated requests and confusing failures.

         $headers = @{
           Authorization = "token $env:GITHUB_TOKEN"
           'User-Agent'  = 'azure-pipelines'
           Accept        = 'application/vnd.github+json'
         }
+
+        if (-not $env:GITHUB_TOKEN) {
+          Write-Error "GITHUB_TOKEN is not set. Configure the 'GitHubToken' secret variable."
+          exit 1
+        }

1-1: Normalize line endings to LF

YAML lint flagged “wrong new line character”. Convert file EOLs to LF to satisfy linters.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03e6ddb and d2b908e.

⛔ Files ignored due to path filters (11)
  • Tests/NFUnitTestSystemLib/RuntimeHelpersTests.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/CoreLibrary.nfproj is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Array.Enumerators.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/Comparer.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/IComparer.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/IEnumerable.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/Generic/IEnumerator.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/IEnumerable.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Collections/IList.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/IComparable.cs is excluded by none and included by none
  • nanoFramework.CoreLibrary/System/Nullable.cs is excluded by none and included by none
📒 Files selected for processing (2)
  • azure-pipelines-templates/check-nf-interpreter-to-test.yml (1 hunks)
  • azure-pipelines.yml (4 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
azure-pipelines-templates/check-nf-interpreter-to-test.yml

[error] 1-1: wrong new line character: expected \n

(new-lines)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: nanoframework.CoreLibrary (Build_mscorlib)
🔇 Additional comments (4)
azure-pipelines.yml (3)

72-73: Good addition: PR-driven nanoCLR discovery

Template inclusion looks correct. Ensure the secret variable GitHubToken exists in the pipeline/library so the template can authenticate to GitHub.


81-81: usePreviewBuild parameter: LGTM

Passing usePreviewBuild: true aligns with the intent to exercise preview bits in CI.


151-151: Prerelase flag on develop: LGTM

This prevents stable releases from develop while keeping main stable.

azure-pipelines-templates/check-nf-interpreter-to-test.yml (1)

52-68: DownloadPipelineArtifact inputs: LGTM (uses buildId correctly)

Using buildId with buildVersionToDownload: specific is correct. Thanks for fixing the prior pipelineId issue.

Comment on lines +55 to +57
eq(variables['DownloadNanoClrPreview'], true),
ne(variables['NFINTERPRETER_BUILDID'], '')
)
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Boolean condition mismatch may disable nanoCLR download

Template compares variables to boolean true; variables are strings. Quote the literal.

-        eq(variables['DownloadNanoClrPreview'], true),
+        eq(variables['DownloadNanoClrPreview'], 'true'),

Apply to both conditions (Lines 55 and 73).

Also applies to: 72-75

🤖 Prompt for AI Agents
In azure-pipelines-templates/check-nf-interpreter-to-test.yml around lines 55-57
(and likewise adjust the similar block at lines 72-75), the pipeline is
comparing pipeline variables to the boolean literal true which fails because
variables are strings; change the comparison to use the string literal 'true'
(e.g., eq(variables['DownloadNanoClrPreview'], 'true')) and ensure any other
boolean comparisons in the indicated lines use quoted string literals.

@sonarqubecloud
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Status: in progress ⚠️ DO NOT MERGE ⚠️ This is not to be merged. In doubt check with the person that put the label.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants