Skip to content

Commit

Permalink
Initial Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrovic committed Sep 9, 2024
0 parents commit 1391f06
Show file tree
Hide file tree
Showing 20 changed files with 1,037 additions and 0 deletions.
38 changes: 38 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
name: Bug report
about: Create a report to help us improve
title: "[BUG] - "
labels: bug
assignees: ondrovic

---

**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.template.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Question
url: https://github.com/{REPO}/issues/new?template=question.md
about: Ask a question about this project.
- name: Bug Report
url: https://github.com/{REPO}/issues/new?template=bug_report.md
about: Report a bug or unexpected behavior.
- name: Feature Request
url: https://github.com/{REPO}/issues/new?template=feature_request.md
about: Suggest a new feature or improvement.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: "[Feature Request] - "
labels: enhancement, idea
assignees: ondrovic

---

**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.
16 changes: 16 additions & 0 deletions .github/ISSUE_TEMPLATE/question.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
name: Question
about: Ask a question about this project
title: "[QUESTION] - "
labels: question
assignees: ondrovic

---

**What is your question?**

Please provide a detailed description of your question or confusion.

**Additional context**

Add any other context or screenshots about the question here.
27 changes: 27 additions & 0 deletions .github/scripts/generate_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#!/bin/bash

ISSUE_TEMPLATE_CREATED_FILE=".github/ISSUE_TEMPLATE/issue_template_configured.txt"

# Check if the repository name is provided
if [ -z "$1" ]; then
echo "Usage: $0 <repository-name>"
exit 1
fi

# Check if the script has already run
if [ -f "$FLAG_FILE" ]; then
echo "Config has already been generated."
exit 0
fi

REPO=$1
TEMPLATE_FILE=".github/ISSUE_TEMPLATE/config.template.yml"
OUTPUT_FILE=".github/ISSUE_TEMPLATE/config.yml"

# Replace placeholder with actual repository name
sed "s/{REPO}/$REPO/g" $TEMPLATE_FILE > $OUTPUT_FILE

# Create a file with a timestamp to indicate the script has run
echo "Config generated for repository: $REPO on $(date '+%Y-%m-%d %H:%M:%S')" > "$ISSUE_TEMPLATE_CREATED_FILE"

echo "Generated config.yml for repository: $REPO"
60 changes: 60 additions & 0 deletions .github/workflows/generate-config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Generate Config

on:
workflow_dispatch:
inputs:
repository-name:
description: 'The name of the repository'
required: false
default: ''
type: string

permissions:
contents: write

jobs:
check-config:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.check.outputs.skip }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check if config has been generated
id: check
run: |
if [ -f ".github/ISSUE_TEMPLATE/issue_template_configured.txt" ]; then
echo "Config already generated"
echo "skip=true" >> $GITHUB_OUTPUT
else
echo "Config not generated yet"
echo "skip=false" >> $GITHUB_OUTPUT
fi
generate-config:
needs: check-config
if: needs.check-config.outputs.skip != 'true'
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Git
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Run generate_config.sh
run: |
chmod +x .github/scripts/generate_config.sh
.github/scripts/generate_config.sh ${{ github.event.inputs.repository-name || github.repository }}
- name: Commit and push generated config
run: |
git add .github/ISSUE_TEMPLATE/config.yml
git add .github/ISSUE_TEMPLATE/issue_template_configured.txt
git commit -m "Update generated config.yml and issue_template_configured.txt"
git push
37 changes: 37 additions & 0 deletions .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# .github/workflows/release.yml
name: releaser

on:
push:
tags:
- "*"

permissions:
contents: write
# packages: write
issues: write

jobs:
goreleaser:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable
# More assembly might be required: Docker logins, GPG, etc.
# It all depends on your needs.
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v6
with:
# either 'goreleaser' (default) or 'goreleaser-pro'
distribution: goreleaser
# 'latest', 'nightly', or a semver
version: "~> v2"
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
63 changes: 63 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: testing

on:
pull_request:
push:
branches: [master]
tags-ignore:
- '*' # Ignores all tag names

jobs:
testing:
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: stable

- name: Install dependencies
run: go mod download

- name: Run tests
run: go test -coverprofile=unit.coverage.out ./...
# Uncomment for uploading when setup
# - name: Upload results to Codecov
# uses: codecov/codecov-action@v4
# with:
# files: ./unit.coverage.out
# fail_ci_if_error: false
# flags: unittests
# name: codecov-umbrella
# token: ${{ secrets.CODECOV_TOKEN }}
# verbose: true

# - name: Upload coverage report
# uses: actions/upload-artifact@v2
# with:
# name: coverage-report
# path: unit.coverage.out

# codacy-coverage-reporter:
# needs: testing
# runs-on: ubuntu-latest
# name: codacy-coverage-reporter
# steps:
# - uses: actions/checkout@v2
# - name: Download coverage report
# uses: actions/download-artifact@v2
# with:
# name: coverage-report
# - name: Run codacy-coverage-reporter
# uses: codacy/[email protected]
# with:
# project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
# coverage-reports: unit.coverage.out
# force-coverage-parser: go

28 changes: 28 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Allowlisting gitignore template for GO projects prevents us
# from adding various unwanted local files, such as generated
# files, developer configurations or IDE-specific files etc.
#
# Recommended: Go.AllowList.gitignore

# Ignore everything
*

# But not these files...
!/.gitignore
!.gitkeep

!.github/
!.github/**/*

!*.go
!go.sum
!go.mod

!README.md
!LICENSE

!Makefile
!TODO
!goreleaser.yaml
# ...even if they are in subdirectories
!*/
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2024 Chris Ondrovic

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Loading

0 comments on commit 1391f06

Please sign in to comment.