Add issue templates, contribution guidelines, and code of conduct; update CI/CD workflows and project metadata (#3)
Release / create-tag-and-release (push) Successful in 15s
Release / create-tag-and-release (push) Successful in 15s
Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com> Reviewed-on: #3
This commit was merged in pull request #3.
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
---
|
||||
name: 🐛 Bug Report
|
||||
about: Report a reproducible bug to help us improve the project
|
||||
title: "[bug]: "
|
||||
labels: bug
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!-- 🛑 **Please fill out the information below. Issues missing the required information will be automatically closed** 🛑 -->
|
||||
|
||||
### Checklist
|
||||
|
||||
- [ ] I have searched existing issues to ensure this bug hasn’t been reported yet.
|
||||
- [ ] I have provided enough information for others to reproduce this bug.
|
||||
- [ ] I have encountered this issue at least twice
|
||||
- [ ] I have filled out all the information below
|
||||
|
||||
> ⚠️ Please do not open an issue if you've encountered the undesired behavior only once.
|
||||
> Document your findings and include them in an issue when you can encounter the issue at least a second time
|
||||
|
||||
## Description
|
||||
|
||||
**Type**
|
||||
|
||||
- [ ] 💥 Crash
|
||||
- [ ] ✖️ Build error
|
||||
- [ ] 🫨 Instability
|
||||
- [ ] 🤔 Other (please specify):
|
||||
|
||||
**Encountered Behavior**
|
||||
<!-- What happened? -->
|
||||
|
||||
**Expected Behavior**
|
||||
<!-- What should have happened instead? -->
|
||||
|
||||
**Steps/Code Snippet to Reproduce**
|
||||
<!-- Provide minimal, self-contained code or exact steps -->
|
||||
|
||||
**Git Hash / Commit ID**
|
||||
<!-- Paste the output of `git rev-parse HEAD` -->
|
||||
|
||||
---
|
||||
|
||||
## System Specs
|
||||
|
||||
- **CPU** (model + architecture):
|
||||
- **GPU** (model + driver version):
|
||||
- **Operating System & Version**:
|
||||
- **Compiler / Build Tool Versions** (if relevant):
|
||||
|
||||
---
|
||||
|
||||
## Additional Context
|
||||
|
||||
**Logs / Error Output**
|
||||
<!-- Paste error messages, stack traces, or build logs -->
|
||||
|
||||
**Screenshots/Screencasts (if applicable)**
|
||||
<!-- Add images or videos to help explain the problem -->
|
||||
|
||||
**Workarounds Tried (optional)**
|
||||
<!-- Any temporary fixes you found? -->
|
||||
@@ -0,0 +1,65 @@
|
||||
---
|
||||
name: ✨ Feature Request
|
||||
about: Suggest a new feature or improvement for the project
|
||||
title: "[feature]: "
|
||||
labels: enhancement
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!-- 💡 **Please fill out the information below. Incomplete requests may be closed or moved to Discussions.** 💡 -->
|
||||
|
||||
### Checklist
|
||||
|
||||
- [ ] I have searched existing issues and discussions to ensure this feature hasn’t been suggested yet.
|
||||
- [ ] I have clearly described the problem this feature would solve.
|
||||
- [ ] I have outlined how this feature would improve the project for users or developers.
|
||||
- [ ] I have filled out all the information below.
|
||||
|
||||
## Summary
|
||||
|
||||
**Feature Type**
|
||||
|
||||
- [ ] 🚀 End-user functionality
|
||||
- [ ] 📦 Integration / New API
|
||||
- [ ] 🎨 UI/UX improvement
|
||||
- [ ] ⚡ Performance optimization
|
||||
- [ ] 🧠 Developer experience improvement
|
||||
- [ ] 🤔 Other (please specify):
|
||||
|
||||
**Problem / Motivation**
|
||||
<!-- What problem does this feature solve? Why is it needed? -->
|
||||
|
||||
**Proposed Solution / Feature Description**
|
||||
<!-- Describe your idea in detail. Include how it might work, appear, or behave. -->
|
||||
|
||||
**Alternatives Considered**
|
||||
<!-- What other approaches did you try or think about? Why aren’t they sufficient? -->
|
||||
|
||||
---
|
||||
|
||||
## Impact and Scope
|
||||
|
||||
**Who Benefits**
|
||||
<!-- Which users, teams, or use cases will this feature help? -->
|
||||
|
||||
**Possible Risks or Tradeoffs**
|
||||
<!-- Are there potential downsides, maintenance costs, or compatibility issues? -->
|
||||
|
||||
**Priority Level**
|
||||
|
||||
- [ ] 💚 Nice-to-have
|
||||
- [ ] 💖 Important
|
||||
- [ ] 🔥 Critical / Blocking
|
||||
|
||||
---
|
||||
|
||||
## Additional Context
|
||||
|
||||
**Related Issues / PRs**
|
||||
<!-- Link to related issues or pull requests if any -->
|
||||
|
||||
**Mockups / Diagrams / Examples (optional)**
|
||||
<!-- Add visuals, sketches, or example code to clarify your idea -->
|
||||
|
||||
**Notes or References (optional)**
|
||||
<!-- Links, research, or external references that support your proposal -->
|
||||
@@ -0,0 +1,70 @@
|
||||
---
|
||||
name: 😓 QA Issue
|
||||
about: Report a QA issue you've encountered
|
||||
title: "[qa]: "
|
||||
labels: qa
|
||||
assignees: ""
|
||||
---
|
||||
|
||||
<!-- 🛑 **Please fill out the information below. Issues missing the required information will be automatically closed** 🛑 -->
|
||||
|
||||
### Checklist
|
||||
|
||||
- [ ] I have searched existing issues to ensure this hasn’t been reported yet.
|
||||
- [ ] I have provided enough information for others to identify the issue.
|
||||
- [ ] I have encountered this issue at least twice
|
||||
- [ ] I have filled out all the information below
|
||||
|
||||
> ⚠️ Please do not open an issue if you've encountered the undesired behavior only once.
|
||||
> Document your findings and include them in an issue when you can encounter the issue at least a second time
|
||||
|
||||
## Description
|
||||
|
||||
**Type**
|
||||
|
||||
- [ ] 🔍 Analyzer/Lint/Tidy
|
||||
- [ ] 📏 Formatting
|
||||
- [ ] 🎨 Code style
|
||||
- [ ] 🛠️ Build issue
|
||||
- [ ] 📚 Documentation
|
||||
- [ ] 🧪 Test failure/coverage
|
||||
- [ ] 🔄 CI/CD
|
||||
- [ ] ⚡ Performance (CPU/GPU/Memory usage, latency, etc.)
|
||||
- [ ] 📦 Installation/Setup
|
||||
- [ ] 🔌 API
|
||||
- [ ] 🤔 Other (please specify):
|
||||
|
||||
**Encountered Behavior**
|
||||
<!-- What happened? -->
|
||||
|
||||
**Expected Behavior**
|
||||
<!-- What should have happened instead? -->
|
||||
|
||||
**Steps/Code Snippet to Reproduce**
|
||||
<!-- Provide minimal, self-contained code or exact steps -->
|
||||
|
||||
**Version tag / Git commit**
|
||||
<!-- Paste the output of `git rev-parse HEAD` -->
|
||||
|
||||
---
|
||||
|
||||
## System Specs (if applicable)
|
||||
<!-- If not applicable, delete the list below and write "N/A" -->
|
||||
|
||||
- **CPU** (model + architecture):
|
||||
- **GPU** (model + driver version):
|
||||
- **Operating System & Version**:
|
||||
- **Compiler / Build Tool Versions** (if relevant):
|
||||
|
||||
---
|
||||
|
||||
## Additional Context
|
||||
|
||||
**Logs / Error Output**
|
||||
<!-- Paste error messages, stack traces, or build logs -->
|
||||
|
||||
**Screenshots/Screencasts (if applicable)**
|
||||
<!-- Add images or videos to help explain the problem -->
|
||||
|
||||
**Workarounds Tried (optional)**
|
||||
<!-- Any temporary fixes you found? -->
|
||||
@@ -0,0 +1,27 @@
|
||||
<!--
|
||||
Thanks for contributing! 🩵
|
||||
Please make sure to follow the contribution guidelines outlined in our [CONTRIBUTING.md](CONTRIBUTING.md) file, and adhere to our [Code of Conduct](CODE_OF_CONDUCT.md) to maintain a welcoming and inclusive community for everyone.
|
||||
|
||||
When submitting a pull request, please provide a clear description of your changes, and select the appropriate type of change from the checklist below ✨
|
||||
|
||||
This helps us review and merge your contribution more efficiently 🫶
|
||||
-->
|
||||
|
||||
<!-- 🛑 **Please fill out the information below. Issues missing the required information will be automatically closed** 🛑 -->
|
||||
|
||||
## Related issue(s)
|
||||
<!-- Link to any related issues or pull requests here -->
|
||||
|
||||
## Type of Change
|
||||
<!--- Put an `x` in all the boxes that apply: -->
|
||||
|
||||
- [ ] ✨ Feature (new API/UI/functionality)
|
||||
- [ ] 🐛 Bug fix (fixes an issue)
|
||||
- [ ] ❌ Breaking change (a change that would cause existing functionality to work differently or break)
|
||||
- [ ] 🧹 Code refactor
|
||||
- [ ] ✅ CI/CD/Build configuration change
|
||||
- [ ] 📚 Documentation
|
||||
- [ ] 🧹 Chore
|
||||
|
||||
## Description
|
||||
<!--- Describe your changes in detail -->
|
||||
@@ -0,0 +1,201 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
format:
|
||||
name: format
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Dart
|
||||
uses: dart-lang/setup-dart@v1
|
||||
- name: Install dependencies
|
||||
run: dart pub get
|
||||
- name: Check formatting
|
||||
run: dart format --output=none --set-exit-if-changed .
|
||||
|
||||
analyze:
|
||||
name: analyze
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Dart
|
||||
uses: dart-lang/setup-dart@v1
|
||||
- name: Install dependencies
|
||||
run: dart pub get
|
||||
- name: Run analyzer
|
||||
run: dart analyze --fatal-infos
|
||||
|
||||
test:
|
||||
name: test
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Dart
|
||||
uses: dart-lang/setup-dart@v1
|
||||
- name: Install dependencies
|
||||
run: dart pub get
|
||||
- name: Run tests
|
||||
run: dart test
|
||||
|
||||
pana:
|
||||
name: pana
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Dart
|
||||
uses: dart-lang/setup-dart@v1
|
||||
- name: Install dependencies
|
||||
run: dart pub get
|
||||
- name: Run pana and enforce full score
|
||||
run: |
|
||||
set -euo pipefail
|
||||
dart pub global activate pana
|
||||
export PATH="$PATH:$HOME/.pub-cache/bin"
|
||||
|
||||
pana . | tee /tmp/pana.log
|
||||
|
||||
SCORE_LINE="$(grep -Eo 'Points: [0-9]+/[0-9]+' /tmp/pana.log | tail -n1 || true)"
|
||||
if [ -z "$SCORE_LINE" ]; then
|
||||
echo "Could not parse pana score output."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SCORE="${SCORE_LINE#Points: }"
|
||||
GOT="${SCORE%/*}"
|
||||
MAX="${SCORE#*/}"
|
||||
|
||||
if [ "$GOT" -ne "$MAX" ]; then
|
||||
echo "Pana score must be full. Got $SCORE."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Pana full score confirmed: $SCORE"
|
||||
|
||||
version_and_changelog:
|
||||
name: version-and-changelog
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Validate release metadata for PRs into main
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
if [ "${GITHUB_EVENT_NAME}" != "pull_request" ]; then
|
||||
echo "Not a pull_request event; skipping version/changelog gate."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${GITHUB_BASE_REF:-}" ]; then
|
||||
echo "GITHUB_BASE_REF is not set for pull_request event."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
git fetch origin "${GITHUB_BASE_REF}" --depth=1
|
||||
|
||||
if git diff --quiet "origin/${GITHUB_BASE_REF}...HEAD" -- pubspec.yaml README.md ':(glob)**/*.dart'; then
|
||||
echo "No release-relevant files changed (pubspec.yaml, README.md, *.dart); skipping version/changelog gate."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PACKAGE_NAME="$(sed -nE 's/^name:\s*([^[:space:]]+)\s*$/\1/p' pubspec.yaml | head -n1)"
|
||||
PR_VERSION="$(sed -nE 's/^version:\s*([^[:space:]]+)\s*$/\1/p' pubspec.yaml | head -n1)"
|
||||
BASE_HAS_PUBSPEC="false"
|
||||
BASE_VERSION=""
|
||||
|
||||
if git cat-file -e "origin/${GITHUB_BASE_REF}:pubspec.yaml" 2>/dev/null; then
|
||||
BASE_HAS_PUBSPEC="true"
|
||||
BASE_VERSION="$(git show "origin/${GITHUB_BASE_REF}:pubspec.yaml" | sed -nE 's/^version:\s*([^[:space:]]+)\s*$/\1/p' | head -n1)"
|
||||
fi
|
||||
|
||||
if [ -z "$PACKAGE_NAME" ] || [ -z "$PR_VERSION" ]; then
|
||||
echo "Unable to read package name/version from PR pubspec.yaml."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$BASE_HAS_PUBSPEC" = "true" ]; then
|
||||
if [ -z "$BASE_VERSION" ]; then
|
||||
echo "Unable to read version from base branch pubspec.yaml."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
parse_semver_core() {
|
||||
printf '%s' "$1" | sed -E 's/^([0-9]+\.[0-9]+\.[0-9]+).*/\1/'
|
||||
}
|
||||
|
||||
BASE_CORE="$(parse_semver_core "$BASE_VERSION")"
|
||||
PR_CORE="$(parse_semver_core "$PR_VERSION")"
|
||||
|
||||
if ! printf '%s' "$BASE_CORE" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
echo "Base version is not valid semver: $BASE_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! printf '%s' "$PR_CORE" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
echo "PR version is not valid semver: $PR_VERSION"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BASE_MAJOR="${BASE_CORE%%.*}"
|
||||
BASE_REST="${BASE_CORE#*.}"
|
||||
BASE_MINOR="${BASE_REST%%.*}"
|
||||
BASE_PATCH="${BASE_REST#*.}"
|
||||
|
||||
PR_MAJOR="${PR_CORE%%.*}"
|
||||
PR_REST="${PR_CORE#*.}"
|
||||
PR_MINOR="${PR_REST%%.*}"
|
||||
PR_PATCH="${PR_REST#*.}"
|
||||
|
||||
if [ "$PR_MAJOR" -lt "$BASE_MAJOR" ]; then
|
||||
echo "pubspec.yaml version must be greater than base version ($BASE_VERSION -> $PR_VERSION)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PR_MAJOR" -eq "$BASE_MAJOR" ] && [ "$PR_MINOR" -lt "$BASE_MINOR" ]; then
|
||||
echo "pubspec.yaml version must be greater than base version ($BASE_VERSION -> $PR_VERSION)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PR_MAJOR" -eq "$BASE_MAJOR" ] && [ "$PR_MINOR" -eq "$BASE_MINOR" ] && [ "$PR_PATCH" -lt "$BASE_PATCH" ]; then
|
||||
echo "pubspec.yaml version must be greater than base version ($BASE_VERSION -> $PR_VERSION)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$PR_MAJOR" -eq "$BASE_MAJOR" ] && [ "$PR_MINOR" -eq "$BASE_MINOR" ] && [ "$PR_PATCH" -eq "$BASE_PATCH" ]; then
|
||||
if curl -fsSL "https://pub.dev/api/packages/${PACKAGE_NAME}" | grep -q "\"version\":\"${PR_VERSION}\""; then
|
||||
echo "pubspec.yaml version must be at least 0.0.1 greater than base version ($BASE_VERSION -> $PR_VERSION)."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Version unchanged ($PR_VERSION), but this version is not yet on pub.dev; allowing first publish."
|
||||
fi
|
||||
else
|
||||
echo "Base branch has no pubspec.yaml; treating this as first release."
|
||||
fi
|
||||
|
||||
if git diff --quiet "origin/${GITHUB_BASE_REF}...HEAD" -- CHANGELOG.md; then
|
||||
echo "CHANGELOG.md must be updated in the PR."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -Fq "## $PR_VERSION" CHANGELOG.md && ! grep -Fq "## [$PR_VERSION]" CHANGELOG.md; then
|
||||
echo "CHANGELOG.md must include a heading for version $PR_VERSION."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$BASE_HAS_PUBSPEC" = "true" ]; then
|
||||
echo "Version/changelog gate passed: $BASE_VERSION -> $PR_VERSION"
|
||||
else
|
||||
echo "Version/changelog gate passed for first release: $PR_VERSION"
|
||||
fi
|
||||
@@ -0,0 +1,95 @@
|
||||
name: Release
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
create_tag_and_release:
|
||||
name: create-tag-and-release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
- name: Create version tag and Gitea release
|
||||
env:
|
||||
GITEA_RELEASE_TOKEN: ${{ secrets.GITEA_RELEASE_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
|
||||
BASE_SHA="${GITHUB_EVENT_BEFORE:-}"
|
||||
if [ -z "$BASE_SHA" ] || [ "$BASE_SHA" = "0000000000000000000000000000000000000000" ]; then
|
||||
if git rev-parse --verify HEAD^ >/dev/null 2>&1; then
|
||||
BASE_SHA="$(git rev-parse HEAD^)"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "$BASE_SHA" ] && git diff --quiet "$BASE_SHA...$GITHUB_SHA" -- pubspec.yaml README.md ':(glob)**/*.dart'; then
|
||||
echo "No release-relevant files changed (pubspec.yaml, README.md, *.dart); skipping tag/release creation."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
PACKAGE_VERSION="$(sed -nE 's/^version:\s*([^[:space:]]+)\s*$/\1/p' pubspec.yaml | head -n1)"
|
||||
if [ -z "$PACKAGE_VERSION" ]; then
|
||||
echo "Failed to parse version from pubspec.yaml."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TAG="v${PACKAGE_VERSION}"
|
||||
TOKEN="${GITEA_RELEASE_TOKEN:-}"
|
||||
if [ -z "$TOKEN" ]; then
|
||||
TOKEN="${GITHUB_TOKEN:-}"
|
||||
fi
|
||||
|
||||
if [ -z "$TOKEN" ]; then
|
||||
echo "Missing release token. Provide GITEA_RELEASE_TOKEN or a usable default workflow token."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
SERVER_URL="${GITHUB_SERVER_URL:-${GITEA_SERVER_URL:-}}"
|
||||
REPO_PATH="${GITHUB_REPOSITORY:-${GITEA_REPOSITORY:-}}"
|
||||
SHA="${GITHUB_SHA:-}"
|
||||
|
||||
if [ -z "$SERVER_URL" ] || [ -z "$REPO_PATH" ] || [ -z "$SHA" ]; then
|
||||
echo "Missing repository context required for Gitea API release creation."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
RELEASE_BY_TAG_URL="${SERVER_URL}/api/v1/repos/${REPO_PATH}/releases/tags/${TAG}"
|
||||
LOOKUP_HTTP_CODE="$(curl -sS -o /tmp/gitea-release-lookup.json -w '%{http_code}' \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
"$RELEASE_BY_TAG_URL")"
|
||||
|
||||
if [ "$LOOKUP_HTTP_CODE" = "200" ]; then
|
||||
echo "Release ${TAG} already exists; skipping release creation."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ "$LOOKUP_HTTP_CODE" != "404" ]; then
|
||||
echo "Failed to query release-by-tag endpoint. HTTP ${LOOKUP_HTTP_CODE}."
|
||||
cat /tmp/gitea-release-lookup.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
CREATE_RELEASE_URL="${SERVER_URL}/api/v1/repos/${REPO_PATH}/releases"
|
||||
RELEASE_PAYLOAD="{\"tag_name\":\"${TAG}\",\"target\":\"${SHA}\",\"target_commitish\":\"${SHA}\",\"title\":\"${TAG}\",\"name\":\"${TAG}\",\"note\":\"Release ${TAG}\",\"body\":\"Release ${TAG}\",\"draft\":false,\"prerelease\":false}"
|
||||
|
||||
HTTP_CODE="$(curl -sS -o /tmp/gitea-release-response.json -w '%{http_code}' \
|
||||
-X POST "$CREATE_RELEASE_URL" \
|
||||
-H "Authorization: token ${TOKEN}" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "$RELEASE_PAYLOAD")"
|
||||
|
||||
if [ "$HTTP_CODE" = "201" ]; then
|
||||
echo "Created Gitea release for ${TAG}."
|
||||
elif [ "$HTTP_CODE" = "409" ]; then
|
||||
echo "Release or tag ${TAG} already exists; treating as success."
|
||||
else
|
||||
echo "Failed to create Gitea release. HTTP ${HTTP_CODE}."
|
||||
cat /tmp/gitea-release-response.json
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user