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

Add typechecks, typescript coverage GH action #3136

Merged
merged 14 commits into from
Nov 11, 2021

Conversation

askvortsov1
Copy link
Member

@askvortsov1 askvortsov1 commented Oct 27, 2021

Fixes #3106
Fixes #3154

Changes proposed in this pull request:

  • Add GH action for typecheck, type check coverage
  • Fix a very large amount of type issues.

Reviewers should focus on:
How do we feel about the script names and github actions layouts?

I considered including https://github.com/codechecks/typecov but since that needs a token + additional setup, I decided not to.

Screenshot
image

Necessity

  • Has the problem that is being solved here been clearly explained?
  • If applicable, have various options for solving this problem been considered?
  • For core PRs, does this need to be in core, or could it be in an extension?
  • Are we willing to maintain this for years / potentially forever?

Confirmed

  • Frontend changes: tested on a local Flarum installation.
  • Backend changes: tests are green (run composer test).
  • Core developer confirmed locally this works as intended.
  • Tests have been added, or are not appropriate here.

Required changes:

  • Related documentation PR: (Remove if irrelevant)
  • Related core extension PRs: (Remove if irrelevant)


jobs:
typecheck:
name: Typecheck
Copy link
Member

Choose a reason for hiding this comment

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

Might it be worth specifying that these are Typscript typings? Just in case we opt to do some form of PHP type checking in the future.

Copy link
Member

@davwheat davwheat left a comment

Choose a reason for hiding this comment

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

Think this is good overall.

We might want to consider implementing what you linked above. It looks quite cool and helpful!

We do want to sort those failing tests, if possible. Might be worth not actually validating typings yet, as they're always going to fail for the moment.

Is there a reason that js files show as typed? Is it JSDoc comments? I don't think we want that, do we?

@dsevillamartin
Copy link
Member

Would be nice if we could have the actions under "JS" as well so it shows something like JS / Typescript Checks and JS / Typescript Coverage - not sure if this is possible without having to add it to the js workflow file? That'd be very messy.

@askvortsov1
Copy link
Member Author

askvortsov1 commented Oct 28, 2021

We might want to consider implementing what you linked above. It looks quite cool and helpful!

Probably, but let's start with this.

We do want to sort those failing tests, if possible. Might be worth not actually validating typings yet, as they're always going to fail for the moment.

We could just use || true in the bash command to ignore errors for now?

Is there a reason that js files show as typed? Is it JSDoc comments? I don't think we want that, do we?

Probably type inference, mostly. I don't think there's a good/easy option to turn that off without breaking builds unfortunately.

Would be nice if we could have the actions under "JS" as well so it shows something like JS / Typescript Checks and JS / Typescript Coverage - not sure if this is possible without having to add it to the js workflow file? That'd be very messy.

Agreed that the GitHub actions could use standardization and cleanup. Only reason I haven't done this yet is that ideally the flarum-cli commands should allow building without TS / prettier and vice versa, so those need to be separated out into multiple files, and we can't quote have dependencies. Maybe if we use a yaml parser we can build up multiple different types of actions into a single file, but dependencies would be pretty complicated to implement.

@askvortsov1 askvortsov1 force-pushed the as/typescript-analysis branch 2 times, most recently from 761c190 to d261840 Compare November 9, 2021 04:16
@askvortsov1
Copy link
Member Author

askvortsov1 commented Nov 9, 2021

I set it to fail silently for now as we work to roll it out. Currently, the remaining issues are:

@askvortsov1 askvortsov1 merged commit bac0e59 into master Nov 11, 2021
@askvortsov1 askvortsov1 deleted the as/typescript-analysis branch November 11, 2021 19:17
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.

Error handling logic is flawed Typecheck TypeScript via GH Action (+ possibly before build)
4 participants