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

setup github actions, linting, code checking, makefile, semantic-release #9

Merged
merged 3 commits into from
Dec 12, 2023
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
23 changes: 23 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
module.exports = {
env: {
browser: true,
es2021: true,
},
extends: "google",
overrides: [
{
env: {
node: true,
},
files: [".eslintrc.{js,cjs}"],
parserOptions: {
sourceType: "script",
},
},
],
parserOptions: {
ecmaVersion: "latest",
sourceType: "module",
},
rules: {},
};
5 changes: 5 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[flake8]
ignore = E203, E266, E501, W503, F403, F401
max-line-length = 120
max-complexity = 18
select = B,C,E,F,W,T4,B9
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 GNU AFFERO GENERAL PUBLIC LICENSE license, and follows a standard Github development process, using Github tracker for issues and merging pull requests into master.
4 changes: 4 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# These are supported funding model platforms

github: FullStackWithLawrence
patreon: FullStackWithLawrence
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
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
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
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 @@
### 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_
59 changes: 59 additions & 0 deletions .github/actions/merge-branch/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
#------------------------------------------------------------------------------
# Run pre-commit
#------------------------------------------------------------------------------
name: Merge
branding:
icon: "git-pull-request"
color: "orange"
inputs:
github-token:
description: "The GitHub token to use for authentication"
required: true
type: string
source-branch:
description: "The branch to merge from"
required: false
type: string
default: "main"
target-branch:
description: "The branch to merge to"
required: true
type: string

python-version:
description: "The version of Python to use, such as 3.11.0"
required: true
type: string

runs:
using: "composite"
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false

- name: Remember current branch
shell: bash
run: |
echo "CURRENT_BRANCH=$(git branch --show-current)" >> $GITHUB_ENV

- name: Merge
id: merge
shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git checkout ${{ inputs.source-branch }}
git pull
git checkout ${{ inputs.target-branch }}
git merge -Xtheirs ${{ inputs.source-branch }}
git push https://${{ inputs.github-token }}@github.com/${{ github.repository }}.git HEAD:${{ inputs.target-branch }}

- name: Checkout current branch
shell: bash
run: |
git checkout ${{ env.CURRENT_BRANCH }}
65 changes: 65 additions & 0 deletions .github/actions/tests/python/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
#------------------------------------------------------------------------------
# Run Python unit tests
#------------------------------------------------------------------------------
name: Test Python
branding:
icon: "git-pull-request"
color: "orange"
inputs:
python-version:
description: "The version of Python to use, such as 3.11.0"
required: true
type: string

env:
REQUIREMENTS_PATH: "requirements.txt"

runs:
using: "composite"
steps:
- name: Checkout code
id: checkout
uses: actions/checkout@v4

- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ inputs.python-version }}

- name: locate site-packages path
shell: bash
run: |
echo "SITE_PACKAGES_PATH=$(python -c 'import site; print(site.getsitepackages()[0])')" >> $GITHUB_ENV

- name: Install pip
shell: bash
run: |
python -m pip install --upgrade pip

- name: Install dependencies
shell: bash
run: |
pip install -r ./requirements.txt
env:
SITE_PACKAGES_PATH: ${{ env.SITE_PACKAGES_PATH }}

- name: Create .env
shell: bash
run: |
touch ./.env
env:

- name: Run Tests
shell: bash
run: |
cd models && pytest -v -s tests/
python -m setup_test
36 changes: 35 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,41 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
assignees:
- "lpm0073"
reviewers:
- "lpm0073"
- package-ecosystem: terraform
directory: "/terraform"
schedule:
interval: daily
interval: weekly
open-pull-requests-limit: 10
assignees:
- "lpm0073"
reviewers:
- "lpm0073"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "javascript"
assignees:
- "FullStackWithLawrence"
reviewers:
- "FullStackWithLawrence"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
labels:
- "dependencies"
- "python"
assignees:
- "lpm0073"
reviewers:
- "lpm0073"
19 changes: 19 additions & 0 deletions .github/workflows/auto-assign.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Auto Assign
on:
issues:
types: [opened]
pull_request:
types: [opened]
jobs:
run:
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- name: "Auto-assign issue"
uses: pozil/auto-assign-issue@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
assignees: lpm0073
numOfAssignee: 1
102 changes: 102 additions & 0 deletions .github/workflows/precommitVersionBumps.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
---
#------------------------------------------------------------------------------
# Lawrence McDaniel - https://lawrencemcdaniel.com
# Version Bump Workflow for .pre-commit-config.yaml
#
# This workflow runs on a cron schedule and checks for updates to the
# .pre-commit-config.yaml file. If updates are found, the workflow
# commits the changes to the next branch and pushes the changes to GitHub.
#
# This is a workaround for the fact that the pre-commit autoupdate command
# is not supported by Dependabot.
#------------------------------------------------------------------------------
name: pre-commit Version Bumps

on:
schedule:
- cron: "0 0 * * 3"
workflow_dispatch:

jobs:
evaluate_precommit_config:
runs-on: ubuntu-latest

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

- name: Checkout next branch
run: |
git fetch
git checkout next
git pull origin next

- name: Cache NPM dependencies
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node

- name: Cache Python dependencies
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip

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

- name: locate site-packages path
shell: bash
run: |
echo "SITE_PACKAGES_PATH=$(python -c 'import site; print(site.getsitepackages()[0])')" >> $GITHUB_ENV

- name: Install pip
shell: bash
run: |
python -m pip install --upgrade pip

- name: Install dependencies
shell: bash
run: |
pip install -r ./requirements.txt
env:
SITE_PACKAGES_PATH: ${{ env.SITE_PACKAGES_PATH }}

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

- name: Install npm dev dependencies
run: npm install

- name: Update .pre-commit-config.yaml
run: |
pre-commit autoupdate

- name: Check for unstaged changes
id: check_changes
run: |
if [[ -n "$(git status --porcelain .pre-commit-config.yaml)" ]]; then
echo "::set-output name=changes::true"
else
echo "::set-output name=changes::false"
fi

- name: Commit and push changes
if: steps.check_changes.outputs.changes == 'true'
shell: bash
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .pre-commit-config.yaml
git commit -m "chore: [gh] version bumps in .pre-commit-config.yaml [skip ci]"
git push https://${{ secrets.PAT }}@github.com/${{ github.repository }}.git HEAD:next
Loading
Loading