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

#2034 More rapid CircleCI builds (Part 1) #2045

Merged
merged 33 commits into from
Apr 12, 2024
Merged

#2034 More rapid CircleCI builds (Part 1) #2045

merged 33 commits into from
Apr 12, 2024

Conversation

raman-m
Copy link
Member

@raman-m raman-m commented Apr 12, 2024

Fixes #2034

1st Part

This is the 1st part, the most substantial, of changes aimed at accelerating CI builds.
The overall duration for PR workflows has been reduced by 3-4 times, from 12-13 minutes to 3-4 minutes. The actual duration varies based on CircleCI server load (daytime, working hours, nighttime).

View the latest CI builds here: raman-m/2034 and note the Duration column❗

2nd Part

The 2nd part will address aspects of:

  • Test parallelism. Currently, only unit tests run in parallel.
  • Workflow parallelism. This could shave off a few seconds.
  • A review of the unit tests' "waiting" logic: thread blocks, wait times, timeout durations, etc. This is optional but could save some seconds.
  • Docker architecture and images. We currently use a heavy Docker image with 3 pre-installed SDKs, which takes 15-20 seconds to download from Docker Hub. Enabling caching could save 10-15 seconds. Additionally, Docker images could be split into two (PR image and Release image), or three (one for each .NET SDK with specific workflows or Cake targets).
  • CircleCI's native features for building .NET software. Our existing Docker build process is resource-intensive and time-consuming. Transitioning to CircleCI's native jobs/orbs could be a significant improvement.

The 2nd part is slated for delivery in the next release. The current objective of #2034 has been met, and there is no time for further in-depth improvements. Delivery is anticipated for May/June '24, in the subsequent release.

Proposed Changes

  • Resolved the outdated 90-second acceptance test Should_timeout_per_default_after_90_seconds introduced in #1833 Default timeout(90s) of downstream requests is broken #1834. Refer to ae085c4
  • The primary beneficial proposal is the SDK filtering using the dotnet test --framework net8.0 command for PR workflows, enabling builds with the .NET 8 SDK only for pull requests (including all commits for feature & develop branches). Refer to c8bbbd2, bb244eb
  • Conducted a review, testing, and update of all NuGet packages in the build.cake script. Refer to e008bb7, db3de59, ae3f238, 8bc9907.
  • In the course of the package review, I prepared a new PR Bump the Cake.Core package to 4.0.0 cake-contrib/Cake.Coveralls#124 to address the issue reported in Outdated version 1.0.0 of referenced Cake.Core package cake-contrib/Cake.Coveralls#123, aiming to upgrade the Cake.Coveralls package. I'm optimistic about finding the repository Maintainer or team lead. 😁
  • Opted to remove Samples projects from Ocelot.sln and instead created a new Ocelot.Release.sln (which includes all projects) and Ocelot.Samples.sln (which contains only sample projects). This modification shaved off 1-5 seconds, although the exact duration change is subtle. It appears to be beneficial. Refer to 8dab1c0, 6ecc11f, 32da44f, 524b753, 6983f2a, e7c02b9, bdb2847, 5592ad9, 8ccfecd, d0d2eec, 0f382e0
  • Reviewed and updated .circleci/config.yml. Switched off block_workflow job (see 88dd110) and it's strange that this job was ran for PR workflow, I found commit fd7c6d7 in git history in which Tom wanted to block multiple concurrent releases a few years ago. So it is not required, and now we have only one workflow running for PR commits, see raman-m/2034 build GitHub checks. So we have only one ci/circleci: build check now. This is a little but awesome improvement.
    image
  • Added new resource_class job option with medium+ value for build job. The old default value was medium implicitly for Docker executor. So, this change won extra 3-5 seconds when doing Compile task. But in future it will give more benefits when tests will be parallelized. So, medium+ means 3 vCPU and medium means 2 vCPU. See commit f0c38f8
  • Reviewed StyleCop and standard Code Analyzers settings. Our .editorconfig was outdated due to multiple Visual Studio releases since its addition (see commit 6469e44 on GitHub). Addressed most critical warnings. Refer to commits 94ce8c9 and dd2f27b for disabled C# 12 features, which were incorrectly flagged for C# 11 net7.0 and C# 10 net6.0. The absence of such warnings previously may be attributed to the outdated .editorconfig not aligning with the latest VS version. The Editor Config has been updated, activating and resolving these warnings.
  • Disabled CS0618 warning for testing projects, as warnings about Obsolete definitions are unnecessary there. However, for the src folder projects, this warning will remain until code refactoring is completed. See commit fa29b63 and e5b5c5f for details.
  • Removed restore and build step flags from the dotnet test command for the unit testing project, as they were redundant given the Compile task precedes the testing one. This modification saved approximately 10 seconds (see commit fa7e1ec).
  • Addressed the issue of lengthy console logs on CircleCI during unit testing with the BDDfy framework, which produced logs of 10-15 thousand lines. By forcibly disabling BDDfy console reports, log length was reduced by about 5 thousand lines. See a03e74a, ba7d50f, a01fe6b with key changes in UnitTest class.

Feature 'primary constructors' is available in C# 12.0 or greater. But we use `net6.0` and `net7.0`
CS8936: Feature 'primary constructors' is not available in C# 10, 11.
xUnit1013 Public method 'GivenThereIsAnIdentityServerOn' on test class 'AuthenticationTests' should be marked as a Theory. Reduce the visibility of the method, or add a Theory attribute to the method.

CS0618 'FileAuthenticationOptions.AuthenticationProviderKey' is obsolete: 'Use the AuthenticationProviderKeys property!'.
@raman-m raman-m added bug Identified as a potential bug proposal Proposal for a new functionality in Ocelot Spring'24 Spring 2024 release CircleCI CI-CD subsystem labels Apr 12, 2024
@raman-m raman-m added this to the March-April'24 milestone Apr 12, 2024
@raman-m raman-m self-assigned this Apr 12, 2024
@raman-m raman-m added the highest Highest priority label Apr 12, 2024
@raman-m raman-m merged commit 59b63ea into develop Apr 12, 2024
1 check passed
@raman-m raman-m deleted the raman-m/2034 branch April 12, 2024 15:33
@raman-m
Copy link
Member Author

raman-m commented Apr 12, 2024

TODO

2nd Part

The 2nd part will address aspects of:

  • Test parallelism. Currently, only unit tests run in parallel.
  • Workflow parallelism. This could shave off a few seconds.
  • A review of the unit tests' "waiting" logic: thread blocks, wait times, timeout durations, etc. This is optional but could save some seconds.
  • Docker architecture and images. We currently use a heavy Docker image with 3 pre-installed SDKs, which takes 15-20 seconds to download from Docker Hub. Enabling caching could save 10-15 seconds. Additionally, Docker images could be split into two (PR image and Release image), or three (one for each .NET SDK with specific workflows or Cake targets).
  • CircleCI's native features for building .NET software. Our existing Docker build process is resource-intensive and time-consuming. Transitioning to CircleCI's native jobs/orbs could be a significant improvement.

The 2nd part is slated for delivery in the next release. The current objective of #2034 has been met, and there is no time for further in-depth improvements. Delivery is anticipated for May/June '24, in the subsequent release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Identified as a potential bug CircleCI CI-CD subsystem highest Highest priority proposal Proposal for a new functionality in Ocelot Spring'24 Spring 2024 release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Long duration of CircleCI builds
3 participants