Skip to content
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

Feat/check-v2 common packages under open cepk #2

Merged
merged 69 commits into from
Jul 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
4363bb4
feat/check-v check v
hminaee-tc Jun 26, 2024
2b4efee
feat/check-v add git flow for now
hminaee-tc Jun 26, 2024
e7becfd
feat/check-v update on the single hook file
hminaee-tc Jun 28, 2024
805b676
feat/check-v update on the single hook file
hminaee-tc Jun 28, 2024
5c890c9
feat/check-v add find string package
hminaee-tc Jun 28, 2024
e8b2477
feat/check-v working on github flow and tests
hminaee-tc Jul 2, 2024
a552144
feat/check-v working on github flow and tests
hminaee-tc Jul 2, 2024
d6ba2bb
feat/check-v adding test precommit
hminaee-tc Jul 2, 2024
0727440
feat/check-v add commit test
hminaee-tc Jul 2, 2024
4d3112b
feat/check-v add commit test
hminaee-tc Jul 2, 2024
1272a42
feat/check-v clean up
hminaee-tc Jul 2, 2024
398a4a7
feat/check-v clean up
hminaee-tc Jul 2, 2024
25b89d4
feat/check-v update path
hminaee-tc Jul 2, 2024
a4d193d
feat/check-v update path
hminaee-tc Jul 2, 2024
b1de09e
feat/check-v2 clean up structure for find and replace string
hminaee-tc Jul 2, 2024
cf636e2
feat/check-v2 clean up pwd
hminaee-tc Jul 2, 2024
d2ca643
feat/check-v2 clean up pwd
hminaee-tc Jul 2, 2024
bb667d7
feat/check-v2 structure the pypi
hminaee-tc Jul 2, 2024
b99db70
feat/check-v2 clean up
hminaee-tc Jul 2, 2024
fcc7516
feat/check-v2 clean up
hminaee-tc Jul 2, 2024
4a141af
feat/check-v2 rename folder hooks
hminaee-tc Jul 2, 2024
5e41959
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
8172263
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
e1e6aa7
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
f559455
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
1edab69
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
caabac8
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
a2a85b1
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
e0d03a3
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
c696038
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
cfad413
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
f0a341a
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
26114fa
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
a133184
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
14d43f7
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
56f9dd0
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
a93b653
feat/check-v2 add e2e for check v
hminaee-tc Jul 2, 2024
409fea3
feat/check-v2 add e2e for check v
hminaee-tc Jul 3, 2024
d8b9ea7
feat/check-v2 add e2e for check v
hminaee-tc Jul 3, 2024
f08f44f
feat/check-v2 add e2e for check v
hminaee-tc Jul 3, 2024
0fdc7fd
feat/check-v2 add e2e for check v
hminaee-tc Jul 3, 2024
6c29b1c
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
eb52ea3
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
4b4bcd3
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
cf4fd19
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
e75775e
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
a9f9cb2
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
9f767d4
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
2e9d977
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
d99e28b
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
1509d83
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
47a1ad9
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
d06ce3a
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
01d19c4
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
1f4f0a3
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
2ea0498
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
6106fa3
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
d66772b
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
6772d8f
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
b40582e
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
7c72d3b
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
23b06cc
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
e21f4f1
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
a907cf4
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
392e728
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
9ea90ec
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
40af6ca
feat/check-v2 clean up
hminaee-tc Jul 3, 2024
5fa24c1
feat/check-v2 review feedback
hminaee-tc Jul 3, 2024
a125796
feat/check-v2 review feedback
hminaee-tc Jul 3, 2024
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
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* @opencepk/opencepk-admins
22 changes: 22 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
name: pre-commit

on:
pull_request:

permissions: read-all

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v3
- name: setup-python
uses: actions/setup-python@v4
with:
python-version: '3.11'
# - name: install-dependencies
# run: pip install -r opencepk_lib_python_common/pypi_bumpversion_check_package/pypi_bumpversion_check/requirements.txt
- name: pre-commit-run
uses: pre-commit/action@v3.0.0
60 changes: 60 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
name: publish-to-pypi

on:
workflow_run:
workflows: ["pre-commit"]
types:
- completed
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
name: build-pip-package
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: 3.11

- name: run pip install
run: |
pip3 install .
pip3 install ".[dep]"
build-n-publish:
needs: build
name: build-n-publish
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: 3.11

- name: Install pip packages
run: pip install twine build setuptools

- name: Build the package
run: python -m build

- name: Publish package to PyPI
if: ${{ github.event_name == 'pull_request' && github.head_ref == '/refs/heads/main' && github.event.action == 'closed' && github.event.pull_request.merged == true }}
uses: pypa/gh-action-pypi-publish@release/v1
with:
skip-existing: true
93 changes: 93 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
name: tests

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
# ----------------------
# JOB 1: Run unit tests
# ----------------------
tests-unit:
name: tests-unit
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: 3.11

- name: Run tests
run: python3 -m unittest opencepk_lib_python_common.find_and_replace_strings_package.tests.test_main
# ----------------------
# JOB 2: Run python package end to end test
# ----------------------
test-package-e2e:
name: test-package-e2e
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install toml requests

- name: Run test-package-e2e.sh for find-replace-strings package
run: |
cd opencepk_lib_python_common/find_and_replace_strings_package/tests-package-e2e
./test-package-e2e.sh

- name: Run test-package-e2e.sh for check version package
run: |
cd opencepk_lib_python_common/pypi_bumpversion_check_package/tests-package-e2e
./test-package-e2e.sh
# ----------------------
# JOB 3: Run pre-commit hook test
# ----------------------
test-pre-commit-hook:
name: test-pre-commit-hook
runs-on: ubuntu-latest
permissions:
id-token: write

steps:
- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v5.1.0
with:
python-version: 3.11

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pre-commit

- name: Run test-pre-commit-hook.sh for find-replace-strings package
run: |
cd opencepk_lib_python_common/find_and_replace_strings_package/tests-pre-commit-hook
./test-pre-commit-hook.sh

- name: Run test-pre-commit-hook.sh for check version package
run: |
cd opencepk_lib_python_common/pypi_bumpversion_check_package/tests-pre-commit-hook
./test-pre-commit-hook.sh
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Byte-compiled / optimized / DLL files
__pycache__/
**/__pycache__/
*.py[cod]
*$py.class

.DS_Store
**/.DS_Store

**/precommit-e2e.test

# C extensions
*.so

**/*.egg-info

# Distribution / packaging
.Python
build/
Expand Down Expand Up @@ -85,7 +93,7 @@ ipython_config.py
# pyenv
# For a library or package, you might want to ignore these files since the code is
# intended to run in multiple environments; otherwise, check them in:
# .python-version
.python-version

# pipenv
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
Expand Down
104 changes: 104 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
---
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
- id: check-merge-conflict
- id: check-added-large-files
args: [--maxkb=500]
- id: trailing-whitespace
- id: detect-private-key
- id: end-of-file-fixer
- id: fix-encoding-pragma
- id: file-contents-sorter
- id: check-case-conflict
- id: mixed-line-ending
args: [--fix=lf]
# -----------------------------
# Checkov is a static code analysis tool for scanning infrastructure as code (IaC) files for misconfigurations
# that may lead to security or compliance problems.
# -----------------------------
# Checkov includes more than 750 predefined policies to check for common misconfiguration issues.
# Checkov also supports the creation and contribution of custom policies.
# -----------------------------
- repo: https://github.com/bridgecrewio/checkov.git
rev: 3.2.171
hooks:
- id: checkov
# -----------------------------
# Gitleaks SAST tool for detecting and preventing hardcoded secrets like passwords, api keys, and tokens in git repos
# -----------------------------
# If you are knowingly committing something that is not a secret and gitleaks is catching it,
# you can add an inline comment of '# gitleaks:allow' to the end of that line in your file.
# This will instructs gitleaks to ignore that secret - example:
# some_non_secret_value = a1b2c3d4e5f6g7h8i9j0 # gitleaks:allow
# -----------------------------
- repo: https://github.com/gitleaks/gitleaks
rev: v8.18.4
hooks:
- id: gitleaks
# -----------------------------
# # Generates Table of Contents in Markdown files
# # -----------------------------
- repo: https://github.com/frnmst/md-toc
rev: 9.0.0
hooks:
- id: md-toc
args: [-p, github] # CLI options
# -----------------------------
# YAML Linting on yaml files for pre-commit and github actions
# -----------------------------
- repo: https://github.com/adrienverge/yamllint
rev: v1.35.1
hooks:
- id: yamllint
name: Check YAML syntax with yamllint
args: [--strict, -c=.yamllint.yaml, '.']
always_run: true
pass_filenames: true

# -----------------------------
# PYPI bumpversion check
# -----------------------------
# - repo: local
# hooks:
# - id: install-pypi_bumpversion_check-requirements
# name: Install PYPI bumpversion check requirements
# entry: sh -c 'pip3 install -r ./opencepk_lib_python_common/pypi_bumpversion_check_package/pypi_bumpversion_check/requirements.txt && exit 0'
# language: system
# always_run: true

# -----------------------------
# PYPI bumpversion check
# -----------------------------
- repo: local
hooks:
- id: pypi_bumpversion_check
name: Check version
args: ['./pyproject.toml']
entry: python3 -m opencepk_lib_python_common.pypi_bumpversion_check_package.pypi_bumpversion_check
language: python
pass_filenames: false # Do not pass filenames to the hook (this is important to keep)
additional_dependencies:
- toml
- requests


- repo: local
hooks:
- id: unittest
name: Run unit tests
entry: python3 -m unittest opencepk_lib_python_common.find_and_replace_strings_package.tests.test_main
language: system
pass_filenames: false
always_run: true

- repo: local
hooks:
- id: toml build
name: test the .toml package health
entry: pip3 install .
language: system
pass_filenames: false
always_run: true
17 changes: 17 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- id: python-pypi-version-check
name: python-pypi-version-check
description: Check if Python package already exists on PYPI.
# entry: hooks/pypi_bumpversion_check-check
entry: python-pypi-version-check
language: python

- id: find-and-replace-strings
name: find-and-replace-strings
description: Check if Python package already exists on PYPI.
entry: find-and-replace-strings
# entry: hooks/find_and_replace_strings
language: python


# python-pypi-version-check-test /Users/hamed/Desktop/tucows-code/find-and-replace-strings/pyproject.toml
35 changes: 35 additions & 0 deletions .yamllint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
yaml-files:
- '*.yaml'
- '*.yml'
- '.yamllint'

rules:
anchors: enable
braces: enable
brackets: enable
colons: enable
commas: enable
comments:
level: warning
comments-indentation:
level: warning
document-end: disable
document-start:
level: warning
empty-lines: enable
empty-values: disable
float-values: disable
hyphens: enable
indentation: enable
key-duplicates: enable
key-ordering: disable
# line-length:
# max: 150
# level: warning
new-line-at-end-of-file: enable
new-lines: enable
octal-values: disable
quoted-strings: disable
trailing-spaces: enable
truthy: disable
Loading
Loading