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

feat(ci-cd): nuke setup #73

Merged
merged 27 commits into from
Apr 8, 2023

Conversation

followynne
Copy link
Member

@followynne followynne commented Apr 1, 2023

Content

This PR creates the Nuke Build project to have CI/CD in Serilog.Ui repository.

As soon as it's merged, it will consist of the following:

  • DotNET workflow: build & tests the .NET code
  • JS workflow: build & tests the JS code
  • Release: build & tests the whole repository, then pack + publish on Nuget the selected pkgs

Additional details

The NUKE workflow runs compilation of the project, then running a SonarCloud scan for both types of code.
After the run, a Reporter task will create a test reporting summary directly in the Github Action (and PR, if open).

Release workflow must be run manually.

Inside it, Pack & Publish steps require either a release or main/master branch to actually execute.
To include a pkg in the Pack & Publish operation, the required input parameter must be set to true. All prj set to true will be separately packed and then published, one by one. This way we'll be able to select which pkgs are updated and should be released, from a same run.

Oh, I forgot! NUKE build can also be run on local! You just need to install NUKE and start it - it will only execute the build & tests, without Sonar & packing 😄

What's needed, before proceeding

To use the workflow, on serilog-ui main repo we need:

  • to create on Sonarcloud an organization and 2 projects, one per .NET and one per JS.
    If Sonar analysis is let public, it's all free! 😄
    IMHO we should create serilog-contrib organization and inside it the 2 projects. You can check what I mean with my current test setup, on my profile: https://sonarcloud.io/project/overview?id=followynne_serilog-ui, https://sonarcloud.io/project/overview?id=followynne_serilog-ui_assets
  • create in the repository, under Settings->Secrets and Variables->Actions, 3 Repository secrets:
    • SONAR_TOKEN (value provided by Sonarcloud on project creation)
    • SONAR_TOKEN_UI (value provided by Sonarcloud on project creation)
    • NUGET_API_KEY (value to be created on Nuget)

immagine

After the 3 variables are set (and we update the parts mentioned in the TODO in the end of this comment), everything should work fine!

!! TODO Before merging !!

Update with the correct sonarcloud info (project key - organization), on:

  • serilog-ui\build\Build.CI.GithubActions.cs: ln 83-84
  • serilog-ui\build\CustomGithubActionsAttribute.cs: ln 82-83

@followynne
Copy link
Member Author

followynne commented Apr 1, 2023

Hello @mo-esmp,

finally I completed the CI/CD setup 🛩️

It's based on Nuke, I inserted the details in the PR comments. Right now the workflows will fail, because they'll be missing the required secrets - as soon as those are set, they'll work out 👍

If you want to check, you can see them running on my fork - I tried all 3, expect for the final pack&publish (but we can fix that later, after the merge in the repo otherwise it won't be testable).

I wanted to create a wiki in the repo, to move the whole README in a separate space. Do you mind if I create it? I would add a page about the Nuke build, how to use it, how it's done and any additional useful info 😃
(as an example, I would upload there the NUKE execution plan html file, which is cool if anyone wants to check how's configured...)

Last thing, I'll leave you check if you think Sonarcloud can be achieved - at the end it's free and it would be cool to have it 😄 I think the serilog-contrib org could be interesting even for other prjs that could use it...

@followynne followynne marked this pull request as ready for review April 1, 2023 14:50
@mo-esmp
Copy link
Member

mo-esmp commented Apr 2, 2023

@followynne Thanks for the PR. One question, dontnet-build and js-build failed, I assume it's ok to merge PR without fixing these two?

@followynne
Copy link
Member Author

@mo-esmp

yes, it's completed!

I just made a class (serilog-ui\build\Configuration.cs - class: SonarCloudInfo) to make all the SonarCloud steps conditional.
If/when the SonarCloud will be created etc, it will be just a matter of setting those 3 field values + the Sonar secret keys to enable those steps :) I can send you a PR, as soon as you get those info...

btw, can you try doing this step https://stackoverflow.com/a/75250838/15129749?
If you check the 2 pipelines, they're now failing on the Reporter step, because the workflows miss the ablility to post a comment in the PR...

@mo-esmp
Copy link
Member

mo-esmp commented Apr 3, 2023

@followynne thanks for the clarifications. I will try to share the info ASAP but probably takes a bit of time

@followynne
Copy link
Member Author

@mo-esmp Yep, don't worry, the pipelines will work equally without sonar, you just need to give them the permission and then they'll get green and be mergeable 😁

Sonar can come later on 😊

@mo-esmp
Copy link
Member

mo-esmp commented Apr 3, 2023

For now, we can move forward with your SonarCloud keys until I check with admins if there is any serilog-contrib organization on SonarCloud.

@followynne
Copy link
Member Author

@mo-esmp sure,that's fine - if it's okay for you, I'll send you the api tokens for sonar in pvt? (I don't have access to Secrets)

@mo-esmp mo-esmp merged commit 5f2e7e8 into serilog-contrib:master Apr 8, 2023
@followynne followynne deleted the feat/ci-cd-with-nuke branch April 8, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants