Skip to content

Commit

Permalink
refactor: add CI/CD. lint with flake8/black
Browse files Browse the repository at this point in the history
  • Loading branch information
lpm0073 committed Nov 14, 2023
1 parent 8e2b25a commit ed41f9f
Show file tree
Hide file tree
Showing 64 changed files with 8,153 additions and 302 deletions.
18 changes: 18 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# http://editorconfig.org
# Source: pydanny cookiecutter-django repo

root = true

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

[*.{py,rst,ini}]
indent_style = space
indent_size = 4

[*.yml]
indent_style = space
indent_size = 2
5 changes: 0 additions & 5 deletions .flake8

This file was deleted.

3 changes: 3 additions & 0 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Contributing

The repository is released under the MIT license, and follows a standard Github development process, using Github tracker for issues and merging pull requests into master.
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**Workflow**
If applicable, provide a workflow file to help explain your problem.

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
1 change: 1 addition & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
blank_issues_enabled: false
17 changes: 17 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
name: Feature request
about: Suggest an idea for this project

---

**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.
19 changes: 19 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# PUll Request Template

## Type of Change

<!-- What type of change does your code introduce? -->
- [ ] New feature
- [ ] Bug fix
- [ ] Documentation
- [ ] Refactor
- [ ] Chore

## Resolves

- Fixes #[Add issue number here.]

## Describe Changes

<!-- Describe your changes in detail, if applicable. -->
_Describe what this Pull Request does_
29 changes: 22 additions & 7 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,33 @@

version: 2
updates:
# Update GitHub actions in workflows
- package-ecosystem: "github-actions"
directory: "/"
# Check for updates to GitHub Actions every weekday
schedule:
interval: "daily"

# Enable version updates for Python/Pip - Production
assignees:
- "lpm0073"
reviewers:
- "lpm0073"
- package-ecosystem: "pip"
# Look for a `requirements.txt` in the `root` directory
# also 'setup.cfg', 'runtime.txt' and 'requirements/*.txt'
directory: "/requirements/"
schedule:
interval: "daily"
labels:
- "dependencies"
- "python"
assignees:
- "lpm0073"
reviewers:
- "lpm0073"
- package-ecosystem: "npm"
directory: "/"
# Check for updates to GitHub Actions every weekday
schedule:
interval: "daily"
labels:
- "dependencies"
- "javascript"
assignees:
- "lpm0073"
reviewers:
- "lpm0073"
25 changes: 25 additions & 0 deletions .github/workflows/checkPullRequest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Check Pull Request

on:
pull_request:
branches:
- main

jobs:
check-pull-request:
name: release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
with:
branch: main
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
dry_run: true
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
39 changes: 39 additions & 0 deletions .github/workflows/mergeMainNext.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#------------------------------------------------------------------------------
# Lawrence McDaniel - https://lawrencemcdaniel.com
# Version Bump Workflow
#
# Used mostly to propagate Dependabot pushed to main to the next branch. Use
# cases:
# - Dependabot pushes to main
# - Manual push to main
# - back propagation of modifications to __version__.py
#------------------------------------------------------------------------------
name: Merge main into next

on:
workflow_dispatch:
push:
branches:
- main

jobs:
merge:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Merge main into next
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout main
git pull
git checkout next
git merge main
git push https://${{ secrets.PAT }}@github.com/${{ github.repository }}.git HEAD:next
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
69 changes: 69 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
#---------------------------------------------------------
# - Create a semantical release
# - Set latest tag
#---------------------------------------------------------
name: Create a new release

on:
workflow_dispatch:
push:
branches:
- main

jobs:
release:
runs-on: ubuntu-latest

steps:
# required antecedent
- uses: actions/checkout@v4
with:
persist-credentials: false

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: '20.9.0'

- name: Install npm dev dependencies
run: npm install --only=dev

- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic
with:
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'next-major',
{
name: 'beta',
prerelease: true
},
{
name: 'alpha',
prerelease: true
}
]
extra_plugins: |
@semantic-release/git
@semantic-release/changelog
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
GIT_COMMITTER_NAME: github-actions[bot]
GIT_COMMITTER_EMAIL: github-actions[bot]@users.noreply.github.com
GIT_AUTHOR_NAME: github-actions[bot]
GIT_AUTHOR_EMAIL: github-actions[bot]@users.noreply.github.com

- name: Publish To GitHub Package Registry
if: steps.semantic.outputs.new_release_published == 'true'
run: echo "new release was published"
shell: bash

- name: Push updates to branch for major version
if: steps.semantic.outputs.new_release_published == 'true'
run: "git push https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git HEAD:refs/heads/v${{steps.semantic.outputs.new_release_major_version}}"
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
33 changes: 33 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Unit Tests

on:
pull_request:
push:

jobs:
tests:
name: tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python 3.x
uses: actions/setup-python@v4
with:
python-version: "3.11"

- name: Install requirements
run: |
python -m pip install --upgrade pip
pip install -r ./requirements/local.txt
- name: secure_logger Unit tests
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)
python -m unittest discover -s secure_logger/tests/
- name: setup.py tests
run: |
export PYTHONPATH=$PYTHONPATH:$(pwd)
python -m unittest setup_test
Loading

0 comments on commit ed41f9f

Please sign in to comment.