Skip to content

Commit

Permalink
Merge pull request #204 from wlach/scaffolding-github-build-tests-ci
Browse files Browse the repository at this point in the history
Add basic GitHub scaffolding + CI
  • Loading branch information
aenglander authored May 20, 2024
2 parents 5cc9a26 + 5c05ff8 commit 7711ca1
Show file tree
Hide file tree
Showing 16 changed files with 353 additions and 13 deletions.
29 changes: 29 additions & 0 deletions .github/ISSUE_TEMPLATE/bug-report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
name: Bug report
about: Report a bug in Flask-Mail (not other projects which depend on Flask-Mail)
---

<!--
This issue tracker is a tool to address bugs in Flask-Mail itself.
Please use GitHub Discussions or the Pallets Discord for questions about your
own code.
Replace this comment with a clear outline of what the bug is.
-->

<!--
Describe how to replicate the bug.
Include a minimal reproducible example that demonstrates the bug.
Include the full traceback if there was an exception.
-->

<!--
Describe the expected behavior that should have happened but didn't.
-->

Environment:

- Python version:
- Flask-Mail version:
- Flask version:
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Questions on Discussions
url: https://github.com/pallets-eco/flask-mail/discussions/
about: Ask questions about your own code on the Discussions tab.
- name: Questions on Chat
url: https://discord.gg/pallets
about: Ask questions about your own code on our Discord chat.
15 changes: 15 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
name: Feature request
about: Suggest a new feature for Flask-Mail
---

<!--
Replace this comment with a description of what the feature should do.
Include details such as links to relevant specs or previous discussions.
-->

<!--
Replace this comment with an example of the problem which this feature
would resolve. Is this problem solvable without changes to Flask-Mail,
such as by subclassing or using an extension?
-->
18 changes: 18 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: monthly
groups:
github-actions:
patterns:
- '*'
- package-ecosystem: pip
directory: /requirements/
schedule:
interval: monthly
groups:
python-requirements:
patterns:
- '*'
25 changes: 25 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<!--
Before opening a PR, open a ticket describing the issue or feature the
PR will address. An issue is not required for fixing typos in
documentation, or other simple non-code changes.
Replace this comment with a description of the change. Describe how it
addresses the linked ticket.
-->

<!--
Link to relevant issues or previous PRs, one per line. Use "fixes" to
automatically close an issue.
fixes #<issue number>
-->

<!--
Ensure each step in the contributing guide is complete, especially the following:
- Add tests that demonstrate the correct behavior of the change. Tests
should fail without the change.
- Add or update relevant docs, in the docs folder and in code.
- Add an entry in CHANGES.rst summarizing the change and linking to the issue.
- Add `.. versionchanged::` entries in any relevant code docs.
-->
23 changes: 23 additions & 0 deletions .github/workflows/lock.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Lock inactive closed issues
# Lock closed issues that have not received any further activity for two weeks.
# This does not close open issues, only humans may do that. It is easier to
# respond to new issues with fresh examples rather than continuing discussions
# on old issues.

on:
schedule:
- cron: '0 0 * * *'
permissions:
issues: write
pull-requests: write
concurrency:
group: lock
jobs:
lock:
runs-on: ubuntu-latest
steps:
- uses: dessant/lock-threads@1bf7ec25051fe7c00bdd17e6a7cf3d7bfb7dc771 # v5.0.1
with:
issue-inactive-days: 14
pr-inactive-days: 14
discussion-inactive-days: 14
73 changes: 73 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: Publish
on:
push:
tags:
- "*"
jobs:
build:
runs-on: ubuntu-latest
outputs:
hash: ${{ steps.hash.outputs.hash }}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: "3.x"
cache: pip
cache-dependency-path: requirements*/*.txt
- run: pip install -r requirements/build.txt
# Use the commit date instead of the current date during the build.
- run: echo "SOURCE_DATE_EPOCH=$(git log -1 --pretty=%ct)" >> $GITHUB_ENV
- run: python -m build
# Generate hashes used for provenance.
- name: generate hash
id: hash
run: cd dist && echo "hash=$(sha256sum * | base64 -w0)" >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: ./dist
provenance:
needs: [build]
permissions:
actions: read
id-token: write
contents: write
# Can't pin with hash due to how this workflow works.
uses: slsa-framework/slsa-github-generator/.github/workflows/generator_generic_slsa3.yml@v2.0.0
with:
base64-subjects: ${{ needs.build.outputs.hash }}
create-release:
# Upload the sdist, wheels, and provenance to a GitHub release. They remain
# available as build artifacts for a while as well.
needs: [provenance]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- name: create release
run: >
gh release create --draft --repo ${{ github.repository }}
${{ github.ref_name }}
*.intoto.jsonl/* artifact/*
env:
GH_TOKEN: ${{ github.token }}
publish-pypi:
needs: [provenance]
# Wait for approval before attempting to upload to PyPI. This allows reviewing the
# files in the draft release.
environment:
name: publish
url: https://pypi.org/project/Flask-Mail/${{ github.ref_name }}
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
- uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
repository-url: https://test.pypi.org/legacy/
packages-dir: artifact/
- uses: pypa/gh-action-pypi-publish@81e9d935c883d0b210363ab89cf05f3894778450 # v1.8.14
with:
packages-dir: artifact/
39 changes: 39 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Tests
on:
push:
branches:
- main
- '*.x'
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
pull_request:
paths-ignore:
- 'docs/**'
- '*.md'
- '*.rst'
jobs:
tests:
name: ${{ matrix.name || matrix.python }}
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
strategy:
fail-fast: false
matrix:
include:
- {python: '3.12'}
- {python: '3.11'}
- {python: '3.10'}
- {python: '3.9'}
- {python: '3.8'}
- {name: Minimal, python: '3.12', tox: minimal}
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
- uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: ${{ matrix.python }}
allow-prereleases: true
cache: pip
cache-dependency-path: requirements*/*.txt
- run: pip install tox
- run: tox run -e ${{ matrix.tox || format('py{0}', matrix.python) }}
1 change: 1 addition & 0 deletions requirements/build.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build
18 changes: 18 additions & 0 deletions requirements/build.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile build.in
#
build==1.2.1
# via -r build.in
importlib-metadata==7.1.0
# via build
packaging==24.0
# via build
pyproject-hooks==1.1.0
# via build
tomli==2.0.1
# via build
zipp==3.18.2
# via importlib-metadata
2 changes: 2 additions & 0 deletions requirements/dev.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-r tests.txt
tox
59 changes: 59 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile dev.in
#
cachetools==5.3.3
# via tox
chardet==5.2.0
# via tox
colorama==0.4.6
# via tox
distlib==0.3.8
# via virtualenv
exceptiongroup==1.2.1
# via
# -r tests.txt
# pytest
filelock==3.14.0
# via
# tox
# virtualenv
iniconfig==2.0.0
# via
# -r tests.txt
# pytest
mock==5.1.0
# via -r tests.txt
packaging==24.0
# via
# -r tests.txt
# pyproject-api
# pytest
# tox
platformdirs==4.2.2
# via
# tox
# virtualenv
pluggy==1.5.0
# via
# -r tests.txt
# pytest
# tox
pyproject-api==1.6.1
# via tox
pytest==8.2.1
# via -r tests.txt
speaklater==1.3
# via -r tests.txt
tomli==2.0.1
# via
# -r tests.txt
# pyproject-api
# pytest
# tox
tox==4.15.0
# via -r dev.in
virtualenv==20.26.2
# via tox
3 changes: 3 additions & 0 deletions requirements/tests.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mock
pytest
speaklater
22 changes: 22 additions & 0 deletions requirements/tests.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# This file is autogenerated by pip-compile with Python 3.8
# by the following command:
#
# pip-compile tests.in
#
exceptiongroup==1.2.1
# via pytest
iniconfig==2.0.0
# via pytest
mock==5.1.0
# via -r tests.in
packaging==24.0
# via pytest
pluggy==1.5.0
# via pytest
pytest==8.2.1
# via -r tests.in
speaklater==1.3
# via -r tests.in
tomli==2.0.1
# via pytest
7 changes: 0 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,12 @@
py_modules=[
'flask_mail'
],
test_suite='nose.collector',
zip_safe=False,
platforms='any',
install_requires=[
'Flask',
'blinker',
],
tests_require=[
'nose',
'blinker',
'speaklater',
'mock',
],
classifiers=[
'Development Status :: 4 - Beta',
'Environment :: Web Environment',
Expand Down
24 changes: 18 additions & 6 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
[tox]
envlist = py26, py27, pypy, py33
envlist = py3{12,11,10,9,8}

[testenv]
deps =
mock
nose
speaklater
package = wheel
wheel_build_env = .pkg
constrain_package_deps = true
use_frozen_constraints = true
deps = -r requirements/tests.txt

commands = nosetests []
commands = pytest -v --tb=short --basetemp={envtmpdir} tests.py

[testenv:update-requirements]
base_python = 3.8
labels = update
deps = pip-tools
skip_install = true
change_dir = requirements
commands =
pip-compile build.in -q {posargs:-U}
pip-compile dev.in -q {posargs:-U}
pip-compile tests.in -q {posargs:-U}

0 comments on commit 7711ca1

Please sign in to comment.