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

Nightly dotnet #13838

Merged
merged 8 commits into from
Apr 18, 2024
Merged

Nightly dotnet #13838

merged 8 commits into from
Apr 18, 2024

Conversation

diemol
Copy link
Member

@diemol diemol commented Apr 18, 2024

User description

Thanks for contributing to Selenium!
A PR well described will help maintainers to quickly review and merge it

Before submitting your PR, please check our contributing guidelines.
Avoid large PRs, help reviewers by making them as simple and short as possible.

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist

  • I have read the contributing document.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

Type

enhancement, tests


Description

  • Introduced enhancements across multiple configuration and build scripts to support nightly builds for the DotNet bindings.
  • Updated the Selenium version in .bzl file to a new nightly version.
  • Added GitHub Actions workflow modifications to allow custom DotNet version setups and added a specific workflow for DotNet nightly builds.
  • Rakefile changes include sophisticated version handling for DotNet releases, including support for pushing to GitHub's NuGet repository for nightly builds.

Changes walkthrough

Relevant files
Enhancement
selenium-dotnet-version.bzl
Update Selenium version for .NET to nightly build               

dotnet/selenium-dotnet-version.bzl

  • Updated the Selenium version to 4.20.0-nightly202404171829.
+1/-1     
bazel.yml
Enhance GitHub Actions to support custom DotNet versions 

.github/workflows/bazel.yml

  • Added a new input parameter dotnet-version to customize the DotNet
    version.
  • Added steps to setup DotNet based on the provided version.
  • +10/-0   
    nightly.yml
    Introduce DotNet nightly build process in GitHub Actions 

    .github/workflows/nightly.yml

  • Added a new job for DotNet to handle nightly releases.
  • Updated job names to reflect 'Nightly' instead of 'Release'.
  • +18/-4   
    Rakefile
    Enhance Rake tasks for DotNet version management and package
    deployment

    Rakefile

  • Added logic to handle nightly build versioning and NuGet package
    pushing for DotNet.
  • Enhanced the dotnet:version task to handle different scenarios of
    version bumping.
  • +39/-3   

    PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link
    Contributor

    PR Description updated to latest commit (2e65057)

    Copy link
    Contributor

    PR Review

    ⏱️ Estimated effort to review [1-5]

    3, because the PR includes changes across multiple files and workflows, involving version updates, workflow modifications, and conditional logic for nightly builds. The changes are not overly complex but require careful review to ensure they align with the project's versioning and deployment strategies.

    🧪 Relevant tests

    No

    🔍 Possible issues

    Possible Bug: The conditional logic in the Rakefile for handling nightly version updates is complex and could lead to errors in version naming if not thoroughly tested. Specifically, the manipulation of version strings with time-based suffixes needs careful validation.

    Configuration Error: The new 'dotnet-version' parameter in the GitHub Actions workflows needs to be verified to ensure it correctly influences the build environment without side effects.

    🔒 Security concerns

    No


    ✨ Review tool usage guide:

    Overview:
    The review tool scans the PR code changes, and generates a PR review which includes several types of feedbacks, such as possible PR issues, security threats and relevant test in the PR. More feedbacks can be added by configuring the tool.

    The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on any PR.

    • When commenting, to edit configurations related to the review tool (pr_reviewer section), use the following template:
    /review --pr_reviewer.some_config1=... --pr_reviewer.some_config2=...
    
    [pr_reviewer]
    some_config1=...
    some_config2=...
    

    See the review usage page for a comprehensive guide on using this tool.

    Copy link
    Contributor

    PR Code Suggestions

    CategorySuggestions                                                                                                                                                       
    Enhancement
    Add a pattern check for the 'dotnet-version' input to ensure it adheres to semantic versioning.

    Consider adding a check for the 'dotnet-version' input to ensure it matches expected
    version patterns, such as semantic versioning. This can prevent errors or misuse when
    specifying custom versions.

    .github/workflows/bazel.yml [39-43]

     dotnet-version:
       description: Custom DotNet version to install
       required: false
       type: string
       default: ''
    +  pattern: '^\d+\.\d+\.\d+(-[a-zA-Z0-9]+)?$'
     
    Add error handling for missing environment variables to prevent runtime errors.

    Add error handling for environment variable fetching to prevent runtime errors if the
    expected keys are not present in the environment.

    Rakefile [815]

    -api_key = ENV.fetch('NUGET_API_KEY', nil)
    +api_key = ENV.fetch('NUGET_API_KEY') { raise "NUGET_API_KEY not found in environment" }
     
    Maintainability
    Use a dynamic reference for 'dotnet-version' in the 'DotNet' job to avoid hardcoding.

    Ensure that the 'dotnet-version' used in the 'DotNet' job is dynamically derived from a
    central configuration or input to maintain consistency across workflows and prevent
    hardcoding.

    .github/workflows/nightly.yml [75]

    -dotnet-version: '6.x'
    +dotnet-version: ${{ inputs.dotnet-version }}
     
    Refactor complex conditional logic into a separate method for clarity.

    Refactor the conditional logic in the version update task to a separate method to improve
    readability and maintainability.

    Rakefile [878-893]

    -if bump_nightly && old_version.include?('-nightly')
    -  new_version = old_version.gsub(/\-nightly\d+$/, '') + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
    -elsif bump_nightly
    -  new_version = old_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
    -else
    -  if old_version.include?('-nightly')
    -    new_version = old_version.gsub(/\-nightly\d+$/, '')
    -  else
    -    new_version = updated_version(old_version.gsub(/\-nightly\d+$/, ''), arguments[:version])
    -    new_version = new_version + "-nightly#{Time.now.strftime("%Y%m%d%H%M")}"
    -  end
    +new_version = calculate_new_version(bump_nightly, old_version, arguments[:version])
     
    Security
    Improve security by avoiding storing API keys in clear text.

    Use a more secure method to handle API keys by avoiding storing them in clear text,
    especially when adding NuGet sources.

    Rakefile [823]

    -sh "dotnet nuget add source --username seleniumhq --password #{api_key} --store-password-in-clear-text --name #{push_destination} #{github_push_url}"
    +sh "dotnet nuget add source --username seleniumhq --password #{api_key} --store-password-in-clear-text false --name #{push_destination} #{github_push_url}"
     

    ✨ Improve tool usage guide:

    Overview:
    The improve tool scans the PR code changes, and automatically generates suggestions for improving the PR code. The tool can be triggered automatically every time a new PR is opened, or can be invoked manually by commenting on a PR.

    • When commenting, to edit configurations related to the improve tool (pr_code_suggestions section), use the following template:
    /improve --pr_code_suggestions.some_config1=... --pr_code_suggestions.some_config2=...
    
    [pr_code_suggestions]
    some_config1=...
    some_config2=...
    

    See the improve usage page for a comprehensive guide on using this tool.

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

    Successfully merging this pull request may close these issues.

    1 participant