Skip to content

Commit

Permalink
feat: first import
Browse files Browse the repository at this point in the history
  • Loading branch information
quertenmont committed Oct 4, 2024
0 parents commit 7896bae
Show file tree
Hide file tree
Showing 40 changed files with 1,779 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
github: [quertenmont]
buy_me_a_coffee: loicquerten
custom: ["https://www.paypal.com/donate/?business=JQ7Y92B9BTCGE&no_recurring=0&currency_code=EUR"]
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: Bug
assignees: fabiocaccamo

---

**Python version**
?

**Django version**
?

**Package version**
?

**Current behavior (bug description)**
?

**Expected behavior**
?
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: Feature
assignees: fabiocaccamo

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
14 changes: 14 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 2
updates:

- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 100

- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 100
17 changes: 17 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Pull request
about: Submit a pull request for this project
assignees: fabiocaccamo

---

**Describe your changes**
?

**Related issue**
?

**Checklist before requesting a review**
- [ ] I have performed a self-review of my code.
- [ ] I have added tests for the proposed changes.
- [ ] I have run the tests and there are not errors.
71 changes: 71 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ main ]
schedule:
- cron: '25 23 * * 0'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'javascript', 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
46 changes: 46 additions & 0 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Create release

on:
push:
tags:
- '*.*.*'

jobs:
build:
runs-on: ubuntu-latest
# environment: release
permissions:
id-token: write
contents: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v2

- name: Create release
uses: ncipollo/release-action@v1
with:
body: ${{ steps.extract-release-notes.outputs.release_notes }}
# token: ${{ secrets.WORKFLOWS_CREATE_RELEASE_TOKEN }}

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'

- name: Build Package
run: |
pip install pip --upgrade
pip install build
python -m build
- name: Publish on PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
# password: ${{ secrets.WORKFLOWS_PUBLISH_TO_PYPI_TOKEN }}
25 changes: 25 additions & 0 deletions .github/workflows/pre-commit-autoupdate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Pre-commit auto-update

on:
# every month
schedule:
- cron: "0 0 1 * *"
# on demand
workflow_dispatch:

jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.x'
- uses: browniebroke/pre-commit-autoupdate-action@main
- uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: update/pre-commit-hooks
title: Update pre-commit hooks
commit-message: "Update pre-commit hooks."
body: Update versions of pre-commit hooks to latest version.
144 changes: 144 additions & 0 deletions .github/workflows/test-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
name: Test package

on:
push:
pull_request:
workflow_dispatch:

jobs:

prepare:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create matrix
uses: fabiocaccamo/create-matrix-action@v4
id: create_matrix
with:
matrix: |
python-version {3.11}, django-version {5.0, 5.1}
# python-version {3.12}, django-version {5.0, 5.1}
outputs:
matrix: ${{ steps.create_matrix.outputs.matrix }}

lint:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

env:
POSTGRES_DATABASE: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRES_SERVICE_PORT: 5432 #${{ job.services.postgres.ports[5432] }}

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'

- name: Install tools needed
run: |
sudo apt install gettext
python -m pip install --upgrade pip
pip install tox
- name: Check migrations
run: |
tox -e migrations
test:

needs: prepare
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{fromJson(needs.prepare.outputs.matrix)}}
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
POSTGRES_USER: postgres
POSTGRES_DB: postgres

options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432


env:
POSTGRES_DATABASE: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_SERVICE_HOST: localhost
POSTGRES_SERVICE_PORT: 5432 #${{ job.services.postgres.ports[5432] }}

steps:

- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'

- name: Upgrade pip version
run: |
python -m pip install --upgrade pip
- name: Install django
run: |
pip install "Django == ${{ matrix.django-version }}.*"
- name: Install requirements
run: |
pip install -r requirements.txt
pip install -r requirements-test.txt
- name: Run pre-commit
run: |
pre-commit run --all-files --show-diff-on-failure --verbose
- name: Run tests
run: |
coverage run --append --source=django_mail_analytics runtests.py
coverage report --show-missing
coverage xml -o ./coverage.xml
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
files: ./coverage.xml
flags: unittests
verbose: true
Loading

0 comments on commit 7896bae

Please sign in to comment.