Skip to content

Commit

Permalink
feat(core): added cicd flows
Browse files Browse the repository at this point in the history
  • Loading branch information
JuanVilla424 committed Oct 23, 2024
1 parent ad8229a commit fc3c5e9
Show file tree
Hide file tree
Showing 30 changed files with 2,476 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[bumpversion]
current_version = 1.0.0
commit = True
tag = False

[bumpversion:file:pyproject.toml]
15 changes: 15 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# These are supported funding model platforms

#github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
#patreon: # Replace with a single Patreon username
#open_collective: # Replace with a single Open Collective username
#ko_fi: # Replace with a single Ko-fi username
#tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
#community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
#liberapay: # Replace with a single Liberapay username
#issuehunt: # Replace with a single IssueHunt username
#lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
#polar: # Replace with a single Polar username
#buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
#thanks_dev: # Replace with a single thanks.dev username
#custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: Bug report
about: Create a report to help us improve
title: ""
labels: ""
assignees: ""
---

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

**To Reproduce**
Steps to reproduce the behavior:

1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

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

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**

- OS: [e.g. iOS]
- Browser [e.g. chrome, safari]
- Version [e.g. 22]

**Smartphone (please complete the following information):**

- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
11 changes: 11 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# .github/ISSUE_TEMPLATE/config.yml

blank_issues_enabled: false
contact_links:
- name: GitHub CICD Template Community Support
url: https://github.com/JuanVilla424/github-cicd-template/discussions
about: Please ask and answer questions here.
- name: GitHub CICD Template Security Reports
url: https://juanvilla424.github.io/github-cicd-template/SECURITY
about: Please report security vulnerabilities here.
19 changes: 19 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
name: Feature request
about: Suggest an idea for this project
title: ""
labels: ""
assignees: ""
---

**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.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
# .github/dependabot.yml

version: 2
updates:
- package-ecosystem: "pip"
directory: "."
schedule:
interval: "weekly"
commit-message:
prefix: "deps"
open-pull-requests-limit: 5
80 changes: 80 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
# .github/workflows/ci.yml

name: CI

on:
push:
branches:
- main

permissions:
contents: read
id-token: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install poetry
poetry lock
poetry install
- name: Format check with Black
run: |
source venv/bin/activate
black --check scripts/
- name: Lint with Pylint
run: |
source venv/bin/activate
pylint $(git ls-files '*.py')
- name: Run tests
run: |
source venv/bin/activate
pytest --cov=app --cov-report=xml:coverage.xml || [$? -eq 5]
continue-on-error: true
- name: List files to verify coverage.xml
run: |
ls -la *.xml
cat *.xml
continue-on-error: true
- name: Upload coverage to Codecov
if: success()
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
flags: unittests
name: codecov-umbrella
continue-on-error: true
- name: OSSF Scorecard action
uses: ossf/[email protected]
with:
results_file: scoreboard-results.json
results_format: json
#publish_results: true
continue-on-error: true
- name: List files to verify scoreboard-results.json
run: |
ls -la scoreboard-results.json
cat scoreboard-results.json
continue-on-error: true
- name: Upload Scorecard Results to Security Scorecards API
if: always()
run: |
curl -X POST \
"" \
-H "Authorization: Bearer ${{ secrets.SCORECARD_TOKEN }}" \
-H "Content-Type: application/json" \
-d @scoreboard-results.json
continue-on-error: true
18 changes: 18 additions & 0 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---

name: Greetings

on: [pull_request_target, issues]

jobs:
greeting:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
issue-message: "Hooray! That was your first issue, be welcome to pages, thanks for contribute!!"
pr-message: "Mmm, right, may a god can review this one... Lets take a rest, gods working!"
31 changes: 31 additions & 0 deletions .github/workflows/node.yml.disabled
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# .github/workflows/node.yml

name: Node CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: ["22.x"]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- name: Install frontend dependencies
run: |
npm install
npm ci
working-directory: frontend
- name: Format frontend project
run: npm run format
working-directory: frontend
- name: Lint frontend project
run: npm run lint
working-directory: frontend
- name: Build Frontend project
run: npm run build --if-present
working-directory: frontend
34 changes: 34 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
# .github/workflows/python.yml

name: Python CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install poetry
poetry lock
poetry install
- name: Format check with Black
run: |
source venv/bin/activate
black --check scripts/
- name: Lint with Pylint
run: |
source venv/bin/activate
pylint $(git ls-files '*.py')
continue-on-error: true
77 changes: 77 additions & 0 deletions .github/workflows/release-controller.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# .github/workflows/release-controller.yml

name: Release Controller

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
- 'v*.*.*'

permissions:
contents: write
id-token: write

jobs:
release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
env:
REPO_NAME: ${{ github.event.repository.name }}
# set folder repository var \
# (settings->security->secrets-variables->actions->variables->repository) \
# or set default
FOLDER_TO_COMPRESS: 'docs'
steps:
- name: Checkout repository
id: checkout_repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.12
id: setup_python
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install dependencies
id: install_dependencies
run: |
python -m venv venv
source venv/bin/activate
pip install --upgrade pip
pip install poetry
poetry lock
poetry install
- name: Package Version
id: package_version
run: |
zip -r "${REPO_NAME}-${GITHUB_REF_NAME}.zip" \
{INSTALL,SECURITY,README,ICONS,CONTRIBUTING,CODE_OF_CONDUCT}.md \
requirements.txt .github scripts *adm* smtp-relay elastalert \
pyproject.toml
# "${FOLDER_TO_COMPRESS}"
env:
REPO_NAME: ${{ env.REPO_NAME }}
GITHUB_REF_NAME: ${{ github.ref_name }}
FOLDER_TO_COMPRESS: ${{ env.FOLDER_TO_COMPRESS }}
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ github.ref_name }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload_release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "${{ env.REPO_NAME }}-${{ github.ref_name }}.zip"
asset_name: "${{ env.REPO_NAME }}-${{ github.ref_name }}.zip"
asset_content_type: application/zip
28 changes: 28 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
---
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests

on:
schedule:
- cron: '23 0 * * *'

jobs:
stale:

runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write

steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'Mmm, I ll save this one, but no important at moment, thanks!'
stale-pr-message: 'Looks like gods abandoned us... Damn!'
stale-issue-label: 'no-issue-activity'
stale-pr-label: 'no-pr-activity'
Loading

0 comments on commit fc3c5e9

Please sign in to comment.