-
Notifications
You must be signed in to change notification settings - Fork 4
Reusable workflows for packaging and Poetry-CI #1
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
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Uses PyPA's build tool to build a wheel and sdist. | ||
| # See https://packaging.python.org/en/latest/guides/distributing-packages-using-setuptools/#packaging-your-project | ||
|
|
||
| name: Build packages for distribution | ||
| on: | ||
| workflow_call: | ||
|
|
||
|
|
||
| jobs: | ||
| packaging: | ||
| runs-on: ubuntu-latest | ||
| name: Packaging | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v2 | ||
|
|
||
| - name: Install tools | ||
| run: python -m pip install build twine | ||
|
|
||
| - name: Build wheel and sdist | ||
| run: python -m build | ||
|
|
||
| # This checks that the "long description" fields renders correctly on PyPI. | ||
| # We don't upload to PyPI, but the two steps below only upload artifacts to GitHub. | ||
| - name: Run twine check | ||
| run: python -m twine check dist/* | ||
|
|
||
| - uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: Wheel | ||
| path: dist/*.whl | ||
|
|
||
| - uses: actions/upload-artifact@v2 | ||
| with: | ||
| name: Sdist | ||
| path: dist/*.tar.gz | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,41 @@ | ||||||||||||||||||||||||||||||||||||||||
| name: Linting | ||||||||||||||||||||||||||||||||||||||||
| on: | ||||||||||||||||||||||||||||||||||||||||
| workflow_call: | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| jobs: | ||||||||||||||||||||||||||||||||||||||||
| style: | ||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| name: Style checks | ||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v2 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Setup Poetry | ||||||||||||||||||||||||||||||||||||||||
| uses: matrix-org/setup-python-poetry@v1 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Import order (isort) | ||||||||||||||||||||||||||||||||||||||||
| run: poetry run isort --check --diff . | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Code style (black) | ||||||||||||||||||||||||||||||||||||||||
| run: poetry run black --check . | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Semantic checks (flake8) | ||||||||||||||||||||||||||||||||||||||||
| run: poetry run flake8 | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+12
to
+25
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not to bikeshed (don't block on this) but I've found GitHub renders steps quite reasonably when names are omitted... wonder if we'd be better / equally served by pervasively doing:
Suggested change
|
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| mypy: | ||||||||||||||||||||||||||||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||||||||||||||||||||||||||||
| name: Typechecking | ||||||||||||||||||||||||||||||||||||||||
| steps: | ||||||||||||||||||||||||||||||||||||||||
| - name: Checkout repository | ||||||||||||||||||||||||||||||||||||||||
| uses: actions/checkout@v2 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Setup Poetry | ||||||||||||||||||||||||||||||||||||||||
| uses: matrix-org/setup-python-poetry@v1 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Restore/persist mypy's cache | ||||||||||||||||||||||||||||||||||||||||
| uses: AustinScola/mypy-cache-github-action@v1 | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| - name: Run mypy | ||||||||||||||||||||||||||||||||||||||||
| run: poetry run mypy | ||||||||||||||||||||||||||||||||||||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| .idea |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| This repository contains [reusable workflows](https://docs.github.com/en/actions/using-workflows/reusing-workflows) for use by the [Synapse team](https://github.com/orgs/matrix-org/teams/synapse-core). | ||
|
|
||
| The intent is to keep our various projects' CI configuration consistent without having to update N yaml files across N repositories. |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are we going to use this pipeline for Synapse eventually? Do we want this automatic upload for Synapse (it would change the current procedure).I'm actually fairly happy to have it done automatically, but I guess it's something that could be checked with the team.
Depending on the answer, we might want this to be gated behind a condition / input flag.Edit: this also applies to the wheelEdit 2: Wait — is this uploading to GitHub or to PyPI? I now think this is GitHub, right? Installing twine beforehand confused me; if it's not just me being stupid, would it be OK to add a comment saying that this uploads to GitHub... 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just to github. Twine is there as a "check we could upload this wheel to PyPI if we wanted to".
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does d38fe95 suit you?