Skip to content

Poor Man's MiMa #471

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 11 commits into from
Aug 12, 2021
Merged

Poor Man's MiMa #471

merged 11 commits into from
Aug 12, 2021

Conversation

japgolly
Copy link
Contributor

Generates API reports so that when we review PRs we can see a list of API changes. This covers the annoying case where a method is moved from one trait to another and it's hard to see which subtypes are affected.

@japgolly japgolly requested a review from armanbilge August 11, 2021 00:45
@armanbilge
Copy link
Member

Screen Shot 2021-08-10 at 17 48 14

😮

@japgolly
Copy link
Contributor Author

Hehe, yeah I typed that all out manually but it will be automated from here on. Hahaha 😆

Seriously though, once this is merged we should only see small (and clear) changes per PR.

@armanbilge
Copy link
Member

Yeah this is amazing!! Great iteration on last nights preview :D

@armanbilge
Copy link
Member

Sorry to rain on the parade ... does this support type aliases? I tried commenting out https://github.com/scala-js/scala-js-dom/blob/master/src/main/scala/org/scalajs/dom/package.scala#L7 and the entire API report vanished, except for the header :(

@japgolly
Copy link
Contributor Author

Hehe, rain away! Better now than post-merge. It does support aliases but it seems the dom package object is missing. It was there before, I'll look into it.

Also the reason it would've come out empty is cos I presume you did an incremental build? That's on my list of things to test and I think you just handed me a sad result.

@armanbilge
Copy link
Member

Ahh, oops! It was an incremental build. That must have been it, makes sense. It was working when I changed a return type though 🤔

@japgolly
Copy link
Contributor Author

@armanbilge Oh crap, something just came up that I need to do over the next few days. Can't believe it's the 11th already. If there's anything that I'm blocking you on just ping me and I'll prioritise that in the little sploshes of free time I get.

@armanbilge
Copy link
Member

Ok, I did a clean and re-compile, everything came back :) which unfortunately means no indication of the missing type alias :(

@armanbilge
Copy link
Member

Oh, no worries! Take the time you need. I'll go through the list of issues and triage :)

@japgolly
Copy link
Contributor Author

Thanks! Also I just fixed the package object problem, thanks for catching it so fast

@japgolly
Copy link
Contributor Author

Apparently package objects aren't considered public. 😕

@armanbilge
Copy link
Member

Oh yeah, package objects are weird ... even if they extend a trait, you can't pass them as an instance of that trait :(

@armanbilge
Copy link
Member

Yup that seems to have fixed it!! Awesome!

@japgolly
Copy link
Contributor Author

Hey @armanbilge , so in order for us to enforce that these are up to date, given current limitations this is what I'm thinking:

  1. Add an sbt task/alias like prepareForPR that will regenerate the API reports for each valid Scala version, and also ensure that it's a full build (in the event that we can't get this working as expected on incremental builds). Maybe we can even automate committing the reports.
  2. Add a PR template (like this) that tells anyone about to raise a PR, "hey make sure you run sbt prepareForPR and check in the reports"
  3. CI validates that all API reports are up-to-date and rejects otherwise.

Sound good?

@armanbilge
Copy link
Member

👍 a few projects I contribute to have a prePR alias exactly for this sort of thing (also runs formatting, etc.)

@japgolly
Copy link
Contributor Author

Fantastic! In that case I'll go ahead with this and use prePR as the same name. Thanks!

@japgolly japgolly marked this pull request as draft August 12, 2021 00:41
Comment on lines +1 to +6
#!/bin/bash
set -euo pipefail
cd "$(dirname "$0")"

sed -i -e '/delete if Scala 2.10/d' *.sbt project/*.sbt
rm scalafix.sbt
Copy link
Member

Choose a reason for hiding this comment

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

So terrible!! Do we even need to publish for 2.10 other than to be nice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nah just being nice and preserving compat across the 1.x series. Really looking forward to the 2.x branch 😩

@japgolly japgolly marked this pull request as ready for review August 12, 2021 02:53
@japgolly japgolly marked this pull request as draft August 12, 2021 02:53
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.

Looking good to me! What's left?

Comment on lines +47 to +49
- name: Validate api report
if: matrix.scalajsversion == '1.x' && matrix.scalaversion != '2.11.12'
run: ./api-reports/validate "${{ matrix.scalaversion }}"
Copy link
Member

Choose a reason for hiding this comment

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

This is gonna be great!! :D

@japgolly
Copy link
Contributor Author

Looking good to me! What's left?

I wanna test it locally against some of the open PRs to confirm it's gonna work as expected, before we merge. You did a lot of work updating all of those PRs and I don't want us to have to do it again more than once :)

@japgolly japgolly requested a review from armanbilge August 12, 2021 23:24
@japgolly japgolly marked this pull request as ready for review August 12, 2021 23:32
@japgolly
Copy link
Contributor Author

@armanbilge oh awesome, you're online. This is ready when you are :)

@armanbilge
Copy link
Member

Yep, I'm just taking it for a quick spin in #445!

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.

Magic!!! Never would have dreamt this up in a million years :)

@japgolly
Copy link
Contributor Author

Hahaha it's a gaffe-tape solution but it should make our lives easier. Ok cool thanks for the approval, merging! Let's goooooooooooo

@japgolly japgolly merged commit b9cf7f2 into series/1.x Aug 12, 2021
@japgolly japgolly deleted the topic/mima branch August 12, 2021 23:46
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.

2 participants