Skip to content

fix!: github action #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 27, 2024
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
32 changes: 32 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.py]
indent_size = 4
continuation_indent_size = 8
indent_style = space
max_line_length = 120

[*.{html,js,css,scss,json}]
indent_style = space
indent_size = 4

[*.cfg]
indent_size = 4
indent_style = space

[*.md]
trim_trailing_whitespace = false

[Makefile]
indent_style = tab
indent_size = 4

[*.{yml,yaml}]
indent_style = space
indent_size = 2
37 changes: 37 additions & 0 deletions .github/workflows/linters.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---

name: Linters

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions:
contents: read

jobs:
pre-commit-linter:
name: pre-commit-linter
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.base_ref }}
- name: Checkout
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.11'
- run: python -m pip install pre-commit
- name: linter
run: >-
pre-commit run --color always --all-files
-s ${GITHUB_BASE_REF_SHA} -o HEAD
env:
GITHUB_BASE_REF_SHA: ${{ github.event.pull_request.base.sha }}
62 changes: 62 additions & 0 deletions .github/workflows/semantic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
name: Version

on:
push:
branches:
- main
- develop

jobs:
versioning_pipeline:
environment:
name: ${{ github.ref_name }}
runs-on: ubuntu-latest
outputs:
version: ${{ steps.set_output.outputs.version }}
steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Setup package.json
run: |
echo '{"name":"demo", "devDependencies":{"@semantic-release/github":"9.0.4","@semantic-release/exec":"6.0.3","semantic-release":"21.0.7"}}' > package.json

- name: Install semantic-release
run: |
npm install

- name: Run semantic-release
id: semantic
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npx semantic-release
# Extract the version from the new git tag
NEW_TAG=$(git describe --tags `git rev-list --tags --max-count=1`)
echo "NEW_TAG=$NEW_TAG" >> $GITHUB_ENV

- name: Set version output
id: set_output
run: echo "::set-output name=version::$NEW_TAG"


- name: Update package version
run: sed -i "s/__version__ = \"1.0.0\"/__version__ = \"${{ steps.semantic.outputs.NEW_TAG }}\"/g" azbankgateways/__init__.py
- name: Build package
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install build
run: python -m pip install build
- name: Build dist
run: python -m build

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@v1.4.2
with:
password: ${{ secrets.PYPI_API_TOKEN }}
59 changes: 51 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,61 @@
---

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: check-ast
- id: check-case-conflict
- id: check-merge-conflict
- id: debug-statements
- id: end-of-file-fixer
exclude_types: [svg, plain-text]
- id: trailing-whitespace
exclude_types: [svg]
- id: check-added-large-files
- id: check-shebang-scripts-are-executable
- id: check-yaml
- id: mixed-line-ending
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.7.0
hooks:
- id: black
exclude: ^(.*/)?(migrations|load_geojson_data)/
args: ['--config=pyproject.toml']
- repo: https://github.com/adamchainz/blacken-docs
rev: 1.13.0
hooks:
- id: black
exclude: \.py-tpl$
- id: blacken-docs
additional_dependencies:
- black==23.7.0
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
rev: 5.12.0
hooks:
- id: isort
types: [python]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
rev: 6.1.0
hooks:
- id: flake8
- repo: https://github.com/pre-commit/mirrors-eslint
rev: v8.24.0
language: python
language_version: python3.11
types: [python]
additional_dependencies:
- flake8-black>=0.2.2
- flake8-mutable
- flake8-gl-codeclimate
- flake8-bugbear
- flake8-comprehensions
- flake8-print
- flake8-simplify
- flake8-django
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.16.0
hooks:
- id: django-upgrade
args: [--target-version, "5.0"]
types: [python]
- repo: https://github.com/adrienverge/yamllint
rev: v1.32.0
hooks:
- id: eslint
- id: yamllint
30 changes: 30 additions & 0 deletions .releaserc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---

{
"plugins": [
"@semantic-release/commit-analyzer",
[
"@semantic-release/exec",
{
"verifyReleaseCmd": "echo ${nextRelease.version} > VERSION.txt",
"prepareCmd": "echo ${nextRelease.version} > VERSION.txt"
}
],
"@semantic-release/github"
],
"branches": [
"main",
{
"name": "develop",
"prerelease": "beta"
},
{
"name": "alpha",
"prerelease": "alpha"
},
{
"name": "rc",
"prerelease": "rc"
}
]
}
6 changes: 6 additions & 0 deletions .yamllint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
extends: default

rules:
line-length:
# TODO: fix it!
max: 500
23 changes: 21 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,24 @@ requires = ['setuptools>=40.8.0']
build-backend = 'setuptools.build_meta'

[tool.black]
target-version = ['py38']
line-length = 119
indent = 4
line-length = 110
skip-string-normalization=1
max_attribute_length = 10
profile = 'django'
exclude = '''
/(
migrations
| __pycache__
| \.git
)/
'''

[tool.isort]
profile = "black"
combine_as_imports = true
include_trailing_comma = true
lines_after_imports = 2
multi_line_output = 3
skip = ["migrations", "__pycache__", ".git", "env", ".env", "venv", ".venv", ".direnv"]
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"]
37 changes: 37 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
[tox]
envlist = py311,lint

[flake8]
max-line-length = 110
max-complexity = 10
ignore = C901,E203,W503
exclude =
.git,
__pycache__,
*/migrations/*,
static,
staticfiles,
media,
docs,
env,
.env,
venv,
.venv,
.direnv
per-file-ignores =
# Ignore line length for migrations (E501)
*/migrations/*:E501,
# Ignore import but unused violations in __init__ files
*/__init__.py:F401,


[testenv]
deps =
pytest
commands = pytest

[testenv:lint]
basepython = python3.11
deps =
pre-commit
commands = pre-commit run --all-files