Skip to content

Populating Job summary with tests results and publish report #451

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

Merged
merged 18 commits into from
Feb 10, 2023
Merged

Populating Job summary with tests results and publish report #451

merged 18 commits into from
Feb 10, 2023

Conversation

TonioGela
Copy link
Member

This should address #450, or at least begin to address it.
The content that will appear in the file can be discussed (and made fancier than the mere version number)
It's the first time I'm contributing to an sbt plugin, so I'm not sure if eventual IO (the sbt one's ofc :D) errors should be handled safely and more precisely logged for example.

@TonioGela TonioGela changed the title Adding tlCreateJobSummary command Adding tlCreateJobSummary task Jan 18, 2023
@armanbilge armanbilge linked an issue Jan 18, 2023 that may be closed by this pull request
@TonioGela
Copy link
Member Author

😎
picture

@TonioGela
Copy link
Member Author

TonioGela commented Jan 18, 2023

How about this @armanbilge?
I added a tlCiReleaseStepSummaryTableInfo setting and a render method. The table below was produced using these settings

ThisBuild / tlCiReleaseStepSummaryTableInfo += (
  "Scala Versions" -> crossScalaVersions.value.toString
)

immagine

@TonioGela TonioGela marked this pull request as draft January 18, 2023 16:24
@TonioGela
Copy link
Member Author

I dedrafted the PR, since I implemented what me and @armanbilge discussed in these days. As it's possible to see in this CI run I embedded a test summary rendering in the TypelevelCiPlugin 👇

immagine

The TypelevelSonatypeCiReleasePlugin now exposes a setting called tlCiReleaseStepSummaryTableInfo that pilots the rendering of a "Build Results" table like this (w/o the "Job Summary" header):

immagine

by default it's value is

Map("**Release version**" -> (ThisBuild / version).value)

Now writing on the summary file is a noop if the variable is not defined and it appends to the file without overriding the content, meaning that every plugin can now decide to append other info to the summary if desired. Speaking of this, the "appending" functionality is now directly exposed by the GitHubActionsPlugin, since it's required by almost all the other ones.

  def appendtoStepSummary(summaryText: String) =
    Option(System.getenv("GITHUB_STEP_SUMMARY")).map { summaryFile =>
      IO.write(new File(summaryFile), summaryText, append = true)
    }

@TonioGela TonioGela marked this pull request as ready for review February 3, 2023 21:01
@TonioGela
Copy link
Member Author

Also, I still haven't added any documentation since features might be reworked according to PR feedback but I will do once the PR will be considered ready ofc

@TonioGela TonioGela requested a review from armanbilge February 3, 2023 21:05
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Overall looks great! Just a few thoughts :)

Comment on lines +86 to +89
(ThisBuild / publishTo).value.collect {
case x: MavenRepo => (x.name, x.root)
case x: MavenRepository => (x.name, x.root)
}
Copy link
Member Author

@TonioGela TonioGela Feb 5, 2023

Choose a reason for hiding this comment

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

@armanbilge I tried this impl to get the resolver URL just in the cases the resolver is a maven repo with a URL, but it should be definitively tested, as with publishLocal the publishTo doesn't get populated

Copy link
Member Author

@TonioGela TonioGela Feb 5, 2023

Choose a reason for hiding this comment

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

For the moment these settings are producing a bunch of tables like 👇

sbt-typelevel-github-actions Publication Summary

Build Result Value
Release version 0.4.18-24-5fe499e-20230205T100148Z-SNAPSHOT
Api URL https://oss.sonatype.org/service/local/repositories/snapshots/archive/org/typelevel/sbt-typelevel-docs_2.12/0.4.18-24-5fe499e-20230205T100148Z-SNAPSHOT/sbt-typelevel-docs_2.12-0.4.18-24-5fe499e-20230205T100148Z-SNAPSHOT-javadoc.jar/!/index.html
Scala Versions 2.12.17

Copy link
Member

@armanbilge armanbilge Feb 6, 2023

Choose a reason for hiding this comment

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

as with publishLocal the publishTo doesn't get populated

I mean, that's fine, since running publishLocal in CI doesn't put it anywhere you can use it anyway :)

I am also pretty sure it won't work on tagged releases which go to maven central. But that's also fine because everybody knows where to find those.

It's the snapshots that seem to have a lot of confusion, and this works perfectly for those.

Copy link
Member Author

Choose a reason for hiding this comment

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

as with publishLocal the publishTo doesn't get populated

I mean, that's fine, since running publishLocal in CI doesn't put it anywhere you can use it anyway :)

Not sure I follow. What I meant is that "on my laptop" the publishing fails before the command completes, and the only thing I had the chance to test is publishLocal overridden in the same way this publish is. To REALLY test with publish we should... well... publish :D

I am also pretty sure it won't work on tagged releases which go to maven central. But that's also fine because everybody knows where to find those.

Hmm, where's the configuration for tagged releases? I might take a look to try to make it compatible.

Copy link
Member

Choose a reason for hiding this comment

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

Hmm, where's the configuration for tagged releases? I might take a look to try to make it compatible.

Somewhere in https://github.com/xerial/sbt-sonatype

The reason I suspect it won't work is because sbt-sonatype does a "bundle release" when deploying to maven. So instead of setting publishTo to a sonatype resolver, IIUC it sets publishTo to your local file system, and then atomically uploads that as a bundle to Sonatype.

Anyway, I wouldn't worry about it. We can land this, and futz with that in a follow-up :)

Copy link
Member Author

Choose a reason for hiding this comment

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

Anyway, I wouldn't worry about it. We can land this, and futz with that in a follow-up :)

Sounds good, we can handle these improvements atomically. Also, I saw that there are a bunch of enhancement proposals for this plugin that might deserve some attention now that the shade curtain between me and sbt plugins is getting thinner :D

I don't think I have nothing else to develop in this PR, I'll wait for the definitive review.

@TonioGela TonioGela changed the title Adding tlCreateJobSummary task Populating Job summary with tests results and publish report Feb 5, 2023
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Nice job with the resolver stuff!

One last round of thoughts, this is where I start sweating nervously about compatibility guarantees 😅 basically lets think hard about what we want to expose yet—the less we expose, the more opportunity we have to iterate on this without breaking anyone.

Comment on lines +86 to +89
(ThisBuild / publishTo).value.collect {
case x: MavenRepo => (x.name, x.root)
case x: MavenRepository => (x.name, x.root)
}
Copy link
Member

@armanbilge armanbilge Feb 6, 2023

Choose a reason for hiding this comment

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

as with publishLocal the publishTo doesn't get populated

I mean, that's fine, since running publishLocal in CI doesn't put it anywhere you can use it anyway :)

I am also pretty sure it won't work on tagged releases which go to maven central. But that's also fine because everybody knows where to find those.

It's the snapshots that seem to have a lot of confusion, and this works perfectly for those.

@TonioGela TonioGela requested a review from armanbilge February 8, 2023 14:58
Comment on lines 31 to 33

ThisBuild / libraryDependencySchemes ++= Seq(
"org.scala-lang.modules" %% "scala-xml" % VersionScheme.Always)
Copy link
Member

@armanbilge armanbilge Feb 10, 2023

Choose a reason for hiding this comment

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

Huh, what changed that causes us to need this now? Edit: oh sorry, you removed it in the next commit :)

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Aight it's go time 😃

Update: https://github.com/typelevel/sbt-typelevel/actions/runs/4141308116/attempts/1#summary-11245005824 😎

Ok the *** thing is annoying, because we switched the org to s01.oss.sonatype.org via a secret, so GH is helpfully ***ing that 🤔

@armanbilge armanbilge merged commit abc217d into typelevel:series/0.4 Feb 10, 2023
@TonioGela
Copy link
Member Author

🎉 🎉 🎉 I'm so glad we merged it :)

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.

Show published version in prominent location
2 participants