Skip to content

Commit d11899a

Browse files
committed
github: Add workflows.
Signed-off-by: iabdalkader <[email protected]>
0 parents  commit d11899a

File tree

6 files changed

+157
-0
lines changed

6 files changed

+157
-0
lines changed

.github/dependabot.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Set update schedule for GitHub Actions
2+
version: 2
3+
updates:
4+
- package-ecosystem: "github-actions"
5+
directory: "/"
6+
schedule:
7+
# Check for updates to GitHub Actions every weekday
8+
interval: "daily"

.github/workflows/changelog.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"transformers": [
3+
{
4+
"pattern": "^(.*)\/(.+:.*)",
5+
"target": "- $2"
6+
}
7+
],
8+
"sort": "DESC",
9+
"template": "🪄 Changelog:\n\n${{UNCATEGORIZED}}\n",
10+
"pr_template": "- ${{TITLE}}",
11+
"empty_template": "- no changes",
12+
"max_tags_to_fetch": 100,
13+
"max_pull_requests": 100,
14+
"max_back_track_time_days": 100
15+
}

.github/workflows/commit.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: '📜 Check Commit Messages'
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- edited
8+
- reopened
9+
- synchronize
10+
branches:
11+
- 'master'
12+
13+
jobs:
14+
check-commit-messages:
15+
runs-on: ubuntu-24.04
16+
steps:
17+
- name: '📜 Check commit messages format'
18+
uses: gsactions/commit-message-checker@v2
19+
with:
20+
pattern: '^[^!]+: [A-Za-z]+.+ .+$'
21+
flags: 'gm'
22+
error: 'Commit subject line must match the following pattern: <scope>: <description>'
23+
excludeTitle: 'false'
24+
excludeDescription: 'true'
25+
checkAllCommitMessages: 'true'
26+
accessToken: ${{ secrets.GITHUB_TOKEN }}
27+
- name: '📜 Check commit messages length'
28+
uses: gsactions/commit-message-checker@v2
29+
with:
30+
pattern: '^[^#].{10,78}$'
31+
error: 'Commit subject line maximum line length of 78 characters is exceeded.'
32+
excludeTitle: 'false'
33+
excludeDescription: 'true'
34+
checkAllCommitMessages: 'true'
35+
accessToken: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/linter.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: '🔎 Python Linter'
2+
3+
on:
4+
pull_request:
5+
types:
6+
- opened
7+
- reopened
8+
- synchronize
9+
branches:
10+
- 'master'
11+
paths:
12+
- '*.py'
13+
14+
jobs:
15+
formatting-check:
16+
runs-on: ubuntu-24.04
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
python-version: ["3.12"]
21+
22+
steps:
23+
- name: '⏳ Checkout repository'
24+
uses: actions/checkout@v6
25+
26+
- name: '🐍 Set up Python ${{ matrix.python-version }}'
27+
uses: actions/setup-python@v6
28+
with:
29+
cache: 'pip'
30+
python-version: ${{ matrix.python-version }}
31+
32+
- name: '🛠 Install dependencies'
33+
run: |
34+
pip install -r .github/workflows/requirements.txt
35+
flake8 --version
36+
pytest --version
37+
38+
- name: '😾 Lint with flake8'
39+
run: |
40+
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
41+
flake8 . --count --ignore=C901 --max-complexity=15 --max-line-length=120 --statistics

.github/workflows/package.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: '📦 Python Package'
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*.*'
7+
branches:
8+
- "!*"
9+
paths:
10+
- '*.py'
11+
- '.github/workflows/*.yml'
12+
- '.github/workflows/*.json'
13+
- '!**/README.md'
14+
15+
permissions:
16+
contents: write
17+
pull-requests: read
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
23+
steps:
24+
- name: '⏳ Checkout repository'
25+
uses: actions/checkout@v3
26+
27+
- name: '🐍 Set up Python 3'
28+
uses: actions/setup-python@v6
29+
with:
30+
cache: 'pip'
31+
python-version: "3.12"
32+
33+
- name: '🛠 Install dependencies'
34+
run: |
35+
python -m pip install --upgrade pip
36+
python -m pip install build
37+
38+
- name: '📦 Build package'
39+
run: python3 -m build
40+
41+
- name: "✏️ Generate changelog"
42+
id: changelog
43+
uses: mikepenz/release-changelog-builder-action@v3
44+
with:
45+
configuration: '.github/workflows/changelog.json'
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
49+
- name: '🔥 Create release'
50+
uses: softprops/action-gh-release@6da8fa9354ddfdc4aeace5fc48d7f679b5214090
51+
with:
52+
draft: false
53+
files: dist/*
54+
body: ${{steps.changelog.outputs.changelog}}
55+
env:
56+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/requirements.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
flake8==6.0.0
2+
pytest==7.4.0

0 commit comments

Comments
 (0)