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

Maintenance: Improve CI for PRs #120

Closed
dreamorosi opened this issue Jul 20, 2021 · 13 comments
Closed

Maintenance: Improve CI for PRs #120

dreamorosi opened this issue Jul 20, 2021 · 13 comments
Assignees
Labels
automation This item relates to automation completed This item is complete and has been merged/shipped internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Milestone

Comments

@dreamorosi
Copy link
Contributor

Description of the improvement

Summary of the proposal

At the moment merging PRs requires maintainers to clone the branch locally, run tests, and then go back to GitHub to approve the PR.

To make it inclusive and accessible for contributors from different seniority, background and experience, this area should be be more detailed to make sure that ambiguity is reduced and most importantly, in case of PR's, expectations are communicated early on in the PR progress.

How, where did you look for information

Closed PRs, especially the ones from dependabot.

Missing or unclear documentation

N/A

Improvement

As discussed internally it would be beneficial to have an automation based on GitHub Actions that runs tests so that maintainers can see the results in the PR screen and make a decision.

Scripts like npm run lerna-ci to install the dependencies and npm run lerna-test in all the packages are already there.

Related existing documentation

NO

Related issues, RFCs

@dreamorosi dreamorosi added the documentation Improvements or additions to documentation label Jul 20, 2021
@dreamorosi dreamorosi added automation This item relates to automation and removed documentation Improvements or additions to documentation labels Jul 20, 2021
@dreamorosi dreamorosi added this to Needs triage / RFC / clarification in Issues via automation Jul 20, 2021
@dreamorosi dreamorosi added this to the beta-release milestone Jul 20, 2021
@dreamorosi
Copy link
Contributor Author

The action used to setup node actions/setup-node@v2 recently released support for package caching but at this time it only works with package-lock.json and not npm-shrinkwrap.json which we are using.

There's an open issue on the action's repo saying that support for npm-shrinkwrap.json should be released in the coming months.

When this will be released we'll be able to add a key like this:

- uses: actions/setup-node@v2
  with:
    node-version: '14'
    cache: npm

Alternatively we could move back to package-lock.json but not sure it's worth it.

@saragerion thoughts?

@alan-churley
Copy link
Contributor

I don't fully understand the ask here, the tests are already run against each PR automatically, and the results are shown on the PR page?

For example,
Screenshot 2021-07-20 at 11 12 59
You can see here that the chore has passed all tests, and the feat:add tracer has not

If you go into the PR you can see more details, here the on-push-event runs all of our test suite
Screenshot 2021-07-20 at 11 14 47

And if you click on details, in this example https://github.com/awslabs/aws-lambda-powertools-typescript/pull/107/checks?check_run_id=2973962167 you can see that this PR has for example failed linting

@dreamorosi
Copy link
Contributor Author

dreamorosi commented Jul 20, 2021

Correct and apologies for not explaining it better, I was referring to PRs opened by Dependabot, like this one, that don't originate from a push but from a pull_request event.

It could be as simple as adding an event at after L3 of the current .workflows/on-push.yml file or having a dedicated workflow only for PRs, which I am open for discussion.

@alan-churley
Copy link
Contributor

Ah I understand, thanks for explaining.

I think a separate workflow would be better personally, as we may want to do more on PR than on every push?

We will have to add some logic for dependabot PRs as they won't be able to push coverage reports for example, which we would still want for normal PRs. (https://github.blog/changelog/2021-02-19-github-actions-workflows-triggered-by-dependabot-prs-will-run-with-read-only-permissions/)

@dreamorosi dreamorosi moved this from Issues - Needs clarification or refinement (untriaged) to Issues - In progress (triaged) in Issues Jul 20, 2021
Issues automation moved this from Issues - In progress (triaged) to Issues - Done (closed) Jul 20, 2021
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@dreamorosi
Copy link
Contributor Author

@alan-churley so it seems that my statement about Dependabot PRs was wrong and even though the results of checks didn't appear under the "Conversation" tab the the workflow still ran:
image
I think they didn't appear in the overview because I was looking at a closed PR, in the PR that was opened today (while still open)
image

A new PR #124 opened today had both on-push and on-pull-request workflows run.

If we want to avoid both running we could consider changing the on-push.yml to something like:

on:
  push:
    branches-ignore:
      - 'dependabot/**'

@dreamorosi dreamorosi reopened this Jul 21, 2021
Issues automation moved this from Issues - Done (closed) to Issues - Needs clarification or refinement (untriaged) Jul 21, 2021
@alan-churley
Copy link
Contributor

Personally I prefer having a separate on PR and on Push workflow, as it gives us more possibility going forward.

I think we need to fix the logic that prevents the On Push workflow running on PR as we currently stand as most of the logic is the same?

@dreamorosi
Copy link
Contributor Author

Totally agree that they should be separate, and currently they are as one runs on: pull_request while the other on: push.

The problem is that my original assumption about Dependabot was wrong and what happens is that the bot pushes and opens the PR I rapid succession which causes the two workflows to run in the same batch/check.

I've been investigating but so far the easiest way to avoid this is to ignore all branches that start with dependabot/* in the push workflow.

@alan-churley what do you think?

@heitorlessa
Copy link
Contributor

heitorlessa commented Jul 22, 2021 via email

@alan-churley
Copy link
Contributor

@dreamorosi what I am actually suggesting is that we don't want the On Push to run on any PRs, not just the Dependant, as they are essentially running the same tests

@dreamorosi
Copy link
Contributor Author

@alan-churley I see and I misunderstood the way these events/workflow work. As you suggested in our conversation offline we need to look into it more & it's not the end of the world if both run.

We might also explore what the Python repo is doing and/or look into Mergify as Heitor suggests.

@alan-churley alan-churley moved this from Issues - Needs clarification or refinement (untriaged) to Issues - TODO & ready to be picked up (triaged) in Issues Jul 23, 2021
@alan-churley alan-churley moved this from Issues - TODO & ready to be picked up (triaged) to Issues - In progress (triaged) in Issues Jul 23, 2021
@saragerion saragerion moved this from Issues - In progress (triaged) to Issues - TODO & ready to be picked up (triaged) in Issues Jul 27, 2021
@flochaz flochaz self-assigned this Nov 30, 2021
@dreamorosi
Copy link
Contributor Author

Going to close this issue as CI for PRs has already been addressed, Dependabot's PR can be addressed with a separate issue at a later time.

Issues automation moved this from Issues - TODO & ready to be picked up (triaged) to Issues - Done (closed) Dec 28, 2021
@github-actions
Copy link
Contributor

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@saragerion saragerion moved this from Issues - Done (closed) to Issues - Done (released) in Issues Jan 5, 2022
@dreamorosi dreamorosi removed this from Issues - Done (released) in Issues Nov 13, 2022
@dreamorosi dreamorosi added the internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.) label Nov 14, 2022
@dreamorosi dreamorosi changed the title all: Improve CI for PRs Maintenance: Improve CI for PRs Nov 14, 2022
@dreamorosi dreamorosi added the completed This item is complete and has been merged/shipped label Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automation This item relates to automation completed This item is complete and has been merged/shipped internal PRs that introduce changes in governance, tech debt and chores (linting setup, baseline, etc.)
Projects
None yet
Development

No branches or pull requests

5 participants