diff --git a/.github/workflows/packaging.yml b/.github/workflows/packaging.yml new file mode 100644 index 0000000..198d9bb --- /dev/null +++ b/.github/workflows/packaging.yml @@ -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 diff --git a/.github/workflows/python-poetry-ci.yml b/.github/workflows/python-poetry-ci.yml new file mode 100644 index 0000000..3c99517 --- /dev/null +++ b/.github/workflows/python-poetry-ci.yml @@ -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 + + 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 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..485dee6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.idea diff --git a/README.md b/README.md new file mode 100644 index 0000000..73c18cc --- /dev/null +++ b/README.md @@ -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. \ No newline at end of file