Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/packaging.yml
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
Comment on lines +36 to +39
Copy link
Contributor

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 wheel

Edit 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... 😅

Copy link
Contributor Author

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".

Copy link
Contributor Author

@DMRobertson DMRobertson Feb 8, 2022

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?

41 changes: 41 additions & 0 deletions .github/workflows/python-poetry-ci.yml
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
Copy link

Choose a reason for hiding this comment

The 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
- 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
- uses: actions/checkout@v2
- uses: matrix-org/setup-python-poetry@v1
- run: poetry run isort --check --diff .
- run: poetry run black --check .
- run: poetry run flake8


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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.idea
3 changes: 3 additions & 0 deletions README.md
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.