Skip to content

Commit 8a159e1

Browse files
committed
Add .github files
1 parent 09c5070 commit 8a159e1

11 files changed

Lines changed: 537 additions & 1 deletion

.github/FUNDING.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# These are supported funding model platforms
2+
github:
3+
- Alia5
4+
custom:
5+
- https://www.buymeacoffee.com/flatspotso7
6+
- https://paypal.me/flatspotpics
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug Report
3+
about: Create a report to help improve VIIPER
4+
title: '[BUG] '
5+
labels: bug
6+
assignees: ''
7+
---
8+
9+
## Bug Description
10+
<!-- A clear and concise description of the bug -->
11+
12+
## To Reproduce
13+
14+
Steps to reproduce the behavior:
15+
16+
1. Connect hardware as '...'
17+
2. Run command '...'
18+
3. See error
19+
20+
## Expected Behavior
21+
<!-- What you expected to happen -->
22+
23+
## Actual Behavior
24+
<!-- What actually happened -->
25+
26+
## Screenshots/Logs
27+
<!-- If applicable, add screenshots or logs to help explain your problem -->
28+
29+
## Environment
30+
31+
- OS: [e.g., Windows 10, Ubuntu 20.04]
32+
- VIIPER Version: [e.g., v1.0.0]
33+
- USB-IP Version: [e.g., v2.0.0]
34+
35+
## Additional Context
36+
<!-- Add any other context about the problem here -->
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
2+
---
3+
name: Documentation Request
4+
about: Request improvements or additions to the documentation
5+
title: '[DOCS] '
6+
labels: documentation
7+
assignees: ''
8+
---
9+
10+
## What part of the documentation needs improvement?
11+
<!-- Describe which part of the documentation needs to be improved or created -->
12+
13+
## What information is missing or unclear?
14+
<!-- Describe what information should be added or clarified -->
15+
16+
## Additional context
17+
<!-- Add any other context or examples about the documentation request here -->
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
name: Feature Request
3+
about: Suggest an idea for VIIPER
4+
title: '[FEATURE] '
5+
labels: enhancement
6+
assignees: ''
7+
---
8+
9+
## Is your feature request related to a problem? Please describe
10+
<!-- A clear and concise description of the problem. Ex. I'm always frustrated when [...] -->
11+
12+
## Describe the solution you'd like
13+
<!-- A clear and concise description of what you want to happen -->
14+
15+
## Describe alternatives you've considered
16+
<!-- A clear and concise description of any alternative solutions or features you've considered -->
17+
18+
## Additional context
19+
<!-- Add any other context or screenshots about the feature request here -->

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Description
2+
<!-- Describe your changes in detail -->
3+
4+
## Related Issue
5+
<!-- Please link to the issue here if applicable -->
6+
Fixes #
7+
8+
## Motivation and Context
9+
<!-- Why is this change required? What problem does it solve? -->
10+
11+
## How Has This Been Tested?
12+
<!-- Please describe how you tested your changes -->
13+
- [ ] Tested with hardware (specify configuration)
14+
- [ ] Unit tests
15+
- [ ] Code review only
16+
17+
## Type of Change
18+
<!-- What types of changes does your code introduce? Put an `x` in all boxes that apply -->
19+
- [ ] Bug fix (non-breaking change addressing an issue)
20+
- [ ] New feature (non-breaking change adding functionality)
21+
- [ ] Breaking change (fix or feature causing existing functionality to change)
22+
- [ ] Documentation update
23+
24+
## Checklist
25+
<!-- Put an `x` in all the boxes that apply -->
26+
- [ ] My code follows the code style of this project
27+
- [ ] I have updated the documentation accordingly
28+
- [ ] I have added tests to cover my changes
29+
- [ ] All new and existing tests passed

.github/workflows/PR_check.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: PR-Check
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- '**'
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
build:
13+
uses: ./.github/workflows/build_base.yml
14+
with:
15+
upload_artifacts: false

.github/workflows/build_base.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: VIIPER Build Base
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
artifact_suffix:
7+
required: false
8+
type: string
9+
default: ""
10+
description: "Suffix to add to artifact names"
11+
upload_artifacts:
12+
required: false
13+
type: boolean
14+
default: false
15+
description: "Whether to upload build artifacts"
16+
17+
jobs:
18+
test:
19+
name: Test on ubuntu-latest
20+
runs-on: ubuntu-latest
21+
defaults:
22+
run:
23+
working-directory: viiper
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
- name: Set up Go
29+
uses: actions/setup-go@v5
30+
with:
31+
go-version: stable
32+
cache: true
33+
cache-dependency-path: |
34+
viiper/go.sum
35+
36+
- name: Show Go version
37+
run: go version
38+
39+
- name: Download dependencies
40+
run: go mod download
41+
42+
- name: Vet
43+
run: go vet ./...
44+
45+
- name: Build (sanity)
46+
run: go build ./...
47+
48+
- name: Test
49+
run: go test -count=1 -v ./...
50+
51+
52+
build:
53+
name: Build binaries (${{ matrix.target.goos }}/${{ matrix.target.goarch }})
54+
runs-on: ubuntu-latest
55+
needs: test
56+
strategy:
57+
fail-fast: false
58+
matrix:
59+
target:
60+
- { goos: linux, goarch: amd64, ext: "" }
61+
- { goos: linux, goarch: arm64, ext: "" }
62+
- { goos: windows, goarch: amd64, ext: ".exe" }
63+
- { goos: windows, goarch: arm64, ext: ".exe" }
64+
defaults:
65+
run:
66+
working-directory: viiper
67+
steps:
68+
- name: Checkout code
69+
uses: actions/checkout@v4
70+
71+
- name: Set up Go
72+
uses: actions/setup-go@v5
73+
with:
74+
go-version: stable
75+
cache: true
76+
cache-dependency-path: |
77+
viiper/go.sum
78+
79+
- name: Prepare dist directory
80+
run: |
81+
mkdir -p ../dist
82+
83+
- name: Build CLI
84+
env:
85+
GOOS: ${{ matrix.target.goos }}
86+
GOARCH: ${{ matrix.target.goarch }}
87+
CGO_ENABLED: "0"
88+
run: |
89+
echo Building for $GOOS/$GOARCH
90+
OUT="../dist/viiper-${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ matrix.target.ext }}"
91+
go build -trimpath -ldflags "-s -w" -o "$OUT" ./cmd/viiper
92+
ls -la ../dist
93+
94+
- name: Upload artifact
95+
if: ${{ inputs.upload_artifacts }}
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: VIIPER-${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ inputs.artifact_suffix }}
99+
path: dist/viiper-${{ matrix.target.goos }}-${{ matrix.target.goarch }}${{ matrix.target.ext }}
100+
if-no-files-found: error
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
name: Generate Changelog
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
mode:
7+
required: true
8+
type: string
9+
description: 'Mode of operation: "release" or "snapshot"'
10+
tag_name:
11+
required: false
12+
type: string
13+
description: 'Current tag name (required for release mode)'
14+
outputs:
15+
changelog:
16+
description: "Generated changelog"
17+
value: ${{ jobs.generate.outputs.changelog }}
18+
19+
jobs:
20+
generate:
21+
runs-on: ubuntu-latest
22+
outputs:
23+
changelog: ${{ steps.generate_changelog.outputs.changelog }}
24+
steps:
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 0
29+
30+
- name: Generate Changelog
31+
id: generate_changelog
32+
shell: bash
33+
run: |
34+
set -euo pipefail
35+
echo "Generating changelog from commits..."
36+
37+
MODE="${{ inputs.mode }}"
38+
if [[ "$MODE" == "release" ]]; then
39+
PREVIOUS_TAG=$(git describe --tags --abbrev=0 --match "v*.*.*" HEAD^ 2>/dev/null || echo "")
40+
CURRENT_TAG="${{ inputs.tag_name }}"
41+
if [[ -z "$PREVIOUS_TAG" ]]; then
42+
LOG_RANGE="$CURRENT_TAG"
43+
CONTEXT_MSG="All changes in this release:"
44+
else
45+
LOG_RANGE="$PREVIOUS_TAG..$CURRENT_TAG"
46+
CONTEXT_MSG="Changes since $PREVIOUS_TAG:"
47+
fi
48+
else
49+
LATEST_TAG=$(git describe --tags --abbrev=0 --match "v*.*.*" 2>/dev/null || echo "")
50+
if [[ -z "$LATEST_TAG" ]]; then
51+
LOG_RANGE=""
52+
CONTEXT_MSG="All changes:"
53+
else
54+
LOG_RANGE="$LATEST_TAG..HEAD"
55+
CONTEXT_MSG="since $LATEST_TAG:"
56+
fi
57+
fi
58+
59+
mapfile -t COMMITS < <(git log --pretty=format:'%H' $LOG_RANGE)
60+
CHANGELOG=""
61+
for commit_hash in "${COMMITS[@]}"; do
62+
commit_msg=$(git log -1 --pretty=format:'%s' "$commit_hash")
63+
commit_body=$(git log -1 --pretty=format:'%b' "$commit_hash")
64+
if echo "$commit_body" | grep -qiE "Changelog: (feature|fix|misc)"; then
65+
changelog_type=$(echo "$commit_body" | grep -oiE "Changelog: (feature|fix|misc)" | head -n1 | cut -d ' ' -f 2 | tr '[:upper:]' '[:lower:]')
66+
entry="- **$changelog_type**: $commit_msg"
67+
body_content=$(echo "$commit_body" | grep -v -i "^Changelog: " | sed '/^$/d' || true)
68+
if [[ -n "$body_content" ]]; then
69+
entry="$entry\n $(echo "$body_content" | sed 's/^/ /')"
70+
fi
71+
CHANGELOG="$CHANGELOG\n$entry"
72+
fi
73+
done
74+
75+
FEATURES=$(echo "$CHANGELOG" | grep "**feature**" || true)
76+
FIXES=$(echo "$CHANGELOG" | grep "**fix**" || true)
77+
MISC=$(echo "$CHANGELOG" | grep "**misc**" || true)
78+
79+
{
80+
echo "changelog<<CHANGELOG_EOF"
81+
if [[ -n "$CONTEXT_MSG" ]]; then
82+
echo "$CONTEXT_MSG"
83+
echo ""
84+
fi
85+
if [[ -n "$FEATURES" ]]; then
86+
echo "### ✨ New Features"
87+
echo ""
88+
echo "$FEATURES" | sed 's/\\n/\n/g' | sed 's/**feature**: //g'
89+
echo ""
90+
fi
91+
if [[ -n "$FIXES" ]]; then
92+
echo "### 🐛 Fixes"
93+
echo ""
94+
echo "$FIXES" | sed 's/\\n/\n/g' | sed 's/**fix**: //g'
95+
echo ""
96+
fi
97+
if [[ -n "$MISC" ]]; then
98+
echo "### 🔧 Miscellaneous"
99+
echo ""
100+
echo "$MISC" | sed 's/\\n/\n/g' | sed 's/**misc**: //g'
101+
echo ""
102+
fi
103+
echo "CHANGELOG_EOF"
104+
} >> "$GITHUB_OUTPUT"
105+
echo "Changelog generated."

0 commit comments

Comments
 (0)