Skip to content

Conversation

@sabderemane
Copy link

Related to #344

Copy link
Member

@ezio-melotti ezio-melotti left a comment

Choose a reason for hiding this comment

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

An early review with a few comments.

path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
Copy link
Member

Choose a reason for hiding this comment

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

Is something missing here?

Copy link
Author

Choose a reason for hiding this comment

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

I update the key but for the rest it should be ok, I use this example

Copy link
Member

Choose a reason for hiding this comment

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

actions/setup-python now natively includes pip caching.

Docs: https://github.com/actions/setup-python#caching-packages-dependencies

So we can remove the uses: actions/cache@v1 step, and update:

-      - uses: actions/setup-python@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: '3.x'
+          cache: pip
+          cache-dependency-path: '*requirements.txt'

And the same in the other workflows.

python-version: '3.9'
- name: Install Dependencies
run: python3 -m pip install coverage -U pip -r dev-requirements.txt
- name: Run code
Copy link
Member

Choose a reason for hiding this comment

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

A more descriptive name would be better.

Copy link
Author

Choose a reason for hiding this comment

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

Just to be sure, do you mean to change the name "Run code" ?

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

@arhadthedev
Copy link
Member

@sabderemane Would you mind to address the reviews, please? It would be great to retire a third party Heroku service of extra maintainance, not-so-transparent deployment, non-public error logs, and a dedicated, actively waiting server loop.

@sabderemane
Copy link
Author

I will, for sure, I just didn't have time to do so yet :)

@sabderemane sabderemane force-pushed the move-to-gh-actions branch 2 times, most recently from c90276d to 375ad52 Compare July 14, 2022 13:06
Copy link
Author

@sabderemane sabderemane left a comment

Choose a reason for hiding this comment

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

Thank you @ezio-melotti for the review 👍🏽

path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
Copy link
Author

Choose a reason for hiding this comment

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

I update the key but for the rest it should be ok, I use this example

python-version: '3.9'
- name: Install Dependencies
run: python3 -m pip install coverage -U pip -r dev-requirements.txt
- name: Run code
Copy link
Author

Choose a reason for hiding this comment

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

Just to be sure, do you mean to change the name "Run code" ?

Copy link
Member

@hugovk hugovk left a comment

Choose a reason for hiding this comment

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

A few workflow suggestions :)

Comment on lines 17 to 26
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v3
with:
python-version: '3.9'
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we use dependabot we could also use the requirements file as the dependency path and skip the whole pip install step. That should speed up all workflows significantly.

Copy link
Member

Choose a reason for hiding this comment

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

(Oops, this posted some outdated suggestions I started before but didn't post! Deleting them, sorry for confusion!)

Copy link
Member

Choose a reason for hiding this comment

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

Dependency path: we install dev-requirements.txt, which includes installing -r requirements.txt

below I suggest using cache-dependency-path: '*requirements.txt', so if either of those files change, it invalidates the cache and downloads the new things.

CONTRIBUTING.rst Outdated
==================================

Bedevere web service is deployed to Heroku, which is managed by The PSF.
Bedevere web service is currently launched with GitHub Actions, which is managed by The PSF.
Copy link
Member

Choose a reason for hiding this comment

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

"currently" is redundant

Suggested change
Bedevere web service is currently launched with GitHub Actions, which is managed by The PSF.
Bedevere web service is launched with GitHub Actions, which is managed by The PSF.

path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
Copy link
Member

Choose a reason for hiding this comment

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

actions/setup-python now natively includes pip caching.

Docs: https://github.com/actions/setup-python#caching-packages-dependencies

So we can remove the uses: actions/cache@v1 step, and update:

-      - uses: actions/setup-python@v3
+      - uses: actions/setup-python@v4
         with:
           python-version: '3.x'
+          cache: pip
+          cache-dependency-path: '*requirements.txt'

And the same in the other workflows.

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

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

Bump:

Suggested change
- uses: actions/checkout@v2
- uses: actions/checkout@v3

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- uses: actions/checkout@v2
- uses: actions/checkout@v3

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

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

Bump version:

Suggested change
- uses: actions/checkout@v2
- uses: actions/checkout@v3

key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- uses: actions/checkout@v2
- uses: actions/checkout@v3

key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4

key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v3
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- uses: actions/setup-python@v3
- uses: actions/setup-python@v4

Comment on lines 17 to 26
- uses: actions/checkout@v2
- uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/setup-python@v3
with:
python-version: '3.9'
Copy link
Contributor

Choose a reason for hiding this comment

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

Since we use dependabot we could also use the requirements file as the dependency path and skip the whole pip install step. That should speed up all workflows significantly.

Copy link
Member

@ezio-melotti ezio-melotti left a comment

Choose a reason for hiding this comment

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

I left some more review comments.

  • It seems that some of the changes applied lately got lost during a merge -- those should be double checked and fixed;
  • there were some formatting problems likely caused by a misconfigured editor (trailing spaces, tabs, changed indentation)

P.S.: you can probably batch merge most of these directly from GitHub.

python-version: '3.9'
- name: Install Dependencies
run: python3 -m pip install coverage -U pip -r dev-requirements.txt
- name: Run code
Copy link
Member

Choose a reason for hiding this comment

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

Yes.

CONTRIBUTING.rst Outdated
Comment on lines 9 to 10
App collaborators and members
''''''''''''''''''''''''''''''''''''
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
App collaborators and members
''''''''''''''''''''''''''''''''''''
App collaborators and members
'''''''''''''''''''''''''''''

router = gidgethub.routing.Router()

TITLE_RE = re.compile(r'\s*\[(?P<branch>\d+\.\d+)\].+\((?:GH-|#)(?P<pr>\d+)\)', re.IGNORECASE)
TITLE_RE = re.compile(r'\s*\[(?P<branch>\d+\.\d+)\].+\((?:GH-|#)(?P<pr>\d+)\)')
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
TITLE_RE = re.compile(r'\s*\[(?P<branch>\d+\.\d+)\].+\((?:GH-|#)(?P<pr>\d+)\)')
TITLE_RE = re.compile(r'\s*\[(?P<branch>\d+\.\d+)\].+\((?:GH-|#)(?P<pr>\d+)\)', re.IGNORECASE)


original_issue = await gh.getitem(event.data['repository']['issues_url'],
{'number': original_pr_number})
Copy link
Member

Choose a reason for hiding this comment

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

I'd recommend to configure your editor to remove trailing spaces and to add newlines at the end of the files automatically. I've also seen some tabs, so you might have to configure your editor to only use spaces too.

base_branch = pull_request["base"]["ref"]

if not is_maintenance_branch(base_branch):
if base_branch == "main":
Copy link
Member

Choose a reason for hiding this comment

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

This should also use not is_maintanance_branch.
You should double check that there aren't other updates that got revert during the merge (or possibly re-do the merge).

@codecov
Copy link

codecov bot commented Oct 3, 2022

Codecov Report

Merging #459 (77a870c) into main (909b536) will decrease coverage by 75.42%.
The diff coverage is 61.25%.

Impacted file tree graph

@@             Coverage Diff              @@
##              main     #459       +/-   ##
============================================
- Coverage   100.00%   24.57%   -75.43%     
============================================
  Files           18       18               
  Lines         1828     1864       +36     
  Branches       211      200       -11     
============================================
- Hits          1828      458     -1370     
- Misses           0     1401     +1401     
- Partials         0        5        +5     
Flag Coverage Δ
Python_3.10 ?
Python_3.11-dev 24.57% <61.25%> (-75.43%) ⬇️
Python_3.8 ?
Python_3.9 ?

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
bedevere/util.py 44.30% <0.00%> (-55.70%) ⬇️
bedevere/backport.py 37.80% <52.77%> (-62.20%) ⬇️
bedevere/close_pr.py 64.28% <71.42%> (-35.72%) ⬇️
bedevere/filepaths.py 60.00% <71.42%> (-40.00%) ⬇️
tests/test_stage.py 9.49% <0.00%> (-90.51%) ⬇️
tests/test___main__.py 12.00% <0.00%> (-88.00%) ⬇️
tests/test_prtype.py 15.04% <0.00%> (-84.96%) ⬇️
tests/test_util.py 17.14% <0.00%> (-82.86%) ⬇️
tests/test_filepaths.py 18.09% <0.00%> (-81.91%) ⬇️
tests/test_backport.py 18.98% <0.00%> (-81.02%) ⬇️
... and 12 more

@sabderemane
Copy link
Author

sabderemane commented Oct 3, 2022

Sorry for the late update, I have address all the issues hopefully, thank you for the review @hugovk, @ezio-melotti and @DanielNoord. I changed my configuration to avoid editor issues 🙏🏽 I will see to continue and update tests.

@arhadthedev
Copy link
Member

From #344 (comment):

One issue with using Actions is that it require maintainers to "approve" the workflow for contributors before it can be run.
The workflows done by bedevere, like checking for skip issue, skip news, applying "type" labels, should just run by itself without needing maintainer approval.

So I think it would be better to convert bedevere into GitHub App instead of Actions. By converting this to GitHub App, we can resolve the issue where 2FA is needed for the bedevere-bot account.

From the following #344 (comment):

To solve the issue where core devs want to be able to re-run workflows/retrigger webhook in case the web app is down, we can grant the "GitHub App manager" access to core devs.

The problem surfaced while working on gh-568 so gh-569 was created instead.

@sabderemane Probably, your PR is a dead-end then. We need to either close it in favor of gh-569 or think on some alterations.

@sabderemane
Copy link
Author

Closing in favor of gh-569, happy to help on other things instead :)

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.

5 participants