Initial commit
Some checks failed
Commit Checks / Test (push) Failing after 9s
Commit Checks / Check coverage (push) Failing after 8s

This commit is contained in:
judas
2025-08-27 19:14:54 +00:00
committed by Artur Borecki
commit 2558c8896a
13 changed files with 1473 additions and 0 deletions

94
.github/ISSUE_TEMPLATE/BUG.yaml vendored Normal file
View File

@@ -0,0 +1,94 @@
name: Bug Report
description: Create a bug report to help improve simulat.
title: "[BUG] "
labels:
- bug
- triage
assignees:
- 'pufereq'
body:
- type: markdown
attributes:
value: |
Hey! Thanks for taking the time to report a bug. Please fill out the form below to help us fix it.
- type: checkboxes
id: checked_existing_issues
attributes:
label: Have you checked the existing issues?
description: Before submitting a new issue, please check if there is an existing issue that reports the same bug.
options:
- label: I have checked the existing issues.
required: true
- type: input
id: bug_title
attributes:
label: Bug Title
description: A clear and concise title that describes the bug.
placeholder: "Ex. Game crashes when I open the inventory"
validations:
required: true
- type: textarea
id: current_behavior
attributes:
label: Current Behavior
description: Describe what is currently happening.
placeholder: "Ex. When I open the inventory, the game crashes."
validations:
required: true
- type: textarea
id: expected_behavior
attributes:
label: Expected Behavior
description: Describe what you expected to happen.
placeholder: "Ex. When I open the inventory, I should see my items."
validations:
required: true
- type: textarea
id: steps_to_reproduce
attributes:
label: Steps to Reproduce
description: Provide detailed steps to reproduce the bug.
placeholder: |
1. Open the game
2. Click on the inventory button
3. Observe the crash
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: Provide information about your environment.
placeholder: |
- OS: Windows 10
- Python Version: 3.12.3
- simulat Version: 0.17.1
value: |
- "OS: "
- "Python Version: "
- "simulat Version: "
validations:
required: true
- type: textarea
id: logs
attributes:
label: Logs
description: If you have any logs, paste them here.
placeholder: "Ex. Error message, stack trace, etc."
render: shell
validations:
required: false
- type: textarea
id: additional_information
attributes:
label: Additional Information
description: |
Add any other information that might be helpful, such as links, screenshots etc.
Tip: You can attach files by dragging and dropping them here.
**Note: Please do not include any sensitive information.**
placeholder: "Ex. I have tried restarting the game and it still crashes."
render: markdown
validations:
required: false

55
.github/ISSUE_TEMPLATE/FEAT.yaml vendored Normal file
View File

@@ -0,0 +1,55 @@
name: Feature request
description: Suggest an idea for this project.
title: "[FEAT] "
labels:
- enhancement
assignees:
- 'pufereq'
body:
- type: markdown
attributes:
value: |
Hey! Thanks for taking the time to suggest a feature. Please fill out the form below to help us understand it better.
- type: input
id: feature_title
attributes:
label: Feature Title
description: A clear and concise title that describes the feature.
placeholder: "Ex. Add a new tile type: Water"
validations:
required: true
- type: textarea
id: feature_description
attributes:
label: Feature Description
description: Describe the feature you are suggesting.
placeholder: "Ex. Add a new tile type that can be placed on water."
validations:
required: true
- type: textarea
id: feature_usage
attributes:
label: Feature Usage
description: Describe how the feature should be used.
placeholder: |
Add a Water tile. This tile should have collision.
validations:
required: true
- type: textarea
id: feature_reason
attributes:
label: Feature Reason
description: Why should this feature be added?
placeholder: |
Water tiles are a common feature in games and can be used to create interesting worlds.
validations:
required: true
- type: textarea
id: feature_additional_info
attributes:
label: Additional Information
description: Provide any additional information that may be helpful.
placeholder: |
The Water tile should have a blue texture.
validations:
required: false

27
.github/PULL_REQUEST_TEMPLATE.md vendored Normal file
View File

@@ -0,0 +1,27 @@
## PR type (check all applicable)
- [ ] ` feat ` :sparkles: features
- [ ] ` fix ` :bug: bugfixes
- [ ] ` chore ` :ticket: chores
- [ ] `refactor` :package: code refactoring
- [ ] ` style ` :gem: style
- [ ] ` docs ` :book: documentation changes
- [ ] ` perf ` :rocket: performance improvements
- [ ] ` test ` :rotating_light: tests
- [ ] ` build ` :construction_worker: build
- [ ] ` ci ` :robot: continuous integration
- [ ] ` revert ` :back: reverts
## PR description
This PR:
-
## Related Tickets
- related issue #
- closes #
## Instructions, Screenshots
_replace this line with instructions (screenshots) on how to test, use your changes_

104
.github/workflows/commit_checks.yaml vendored Normal file
View File

@@ -0,0 +1,104 @@
name: Commit Checks
on:
push:
branches:
- '*'
workflow_call:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: 🔀 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.GITHUB_TOKEN }}"
submodules: 'recursive'
- name: 📦 install uv
uses: astral-sh/setup-uv@v5
- name: 🐍 python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: 📦 sync depedencies
run: |
uv sync
uv sync --group test
- name: 🧪 run tests
id: test
run: |
uv run pytest -v
coverage:
name: Check coverage
runs-on: ubuntu-latest
steps:
- name: 🔀 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.GITHUB_TOKEN }}"
submodules: 'recursive'
- name: 📦 install uv
uses: astral-sh/setup-uv@v5
- name: 🐍 python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: 📦 sync depedencies
run: |
uv sync
uv sync --group test
- name: 🧪 run tests
id: test
run: |
uv run pytest -v --cov
- name: 📊 generate coverage report
if: always()
run: |
uv run coverage json
cov_percent=$(jq '.totals.percent_covered' coverage.json)
cov_percent_rounded=$(python3 -c "print(round(${cov_percent}, 2))")
cov_lines=$(jq '.totals.covered_lines' coverage.json)
cov_missing=$(jq '.totals.missing_lines' coverage.json)
cov_total=$(jq '.totals.num_statements' coverage.json)
cov_excluded=$(jq '.totals.excluded_lines' coverage.json)
report_success=$(python3 -c "print(str(${cov_percent} == 100).lower())")
if (( $(echo "$cov_percent >= 100" | bc -l) )); then
badge_color="brightgreen"
elif (( $(echo "$cov_percent >= 90" | bc -l) )); then
badge_color="yellow"
else
badge_color="red"
fi
echo "## 📊 Coverage Report" >> $GITHUB_STEP_SUMMARY
echo "![Coverage: $cov_percent_rounded%](https://img.shields.io/badge/Coverage-$cov_percent_rounded%25-$badge_color)" >> $GITHUB_STEP_SUMMARY
echo "| Total Lines | Covered | Missing | Excluded |" >> $GITHUB_STEP_SUMMARY
echo "|-------------|---------|---------|----------|" >> $GITHUB_STEP_SUMMARY
echo "| $cov_total | $cov_lines | $cov_missing | $cov_excluded |" >> $GITHUB_STEP_SUMMARY
echo "<details>" >> $GITHUB_STEP_SUMMARY
echo "<summary>Details</summary>" >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
uv run coverage report >> $GITHUB_STEP_SUMMARY
echo '```' >> $GITHUB_STEP_SUMMARY
echo '' >> $GITHUB_STEP_SUMMARY
echo "</details>" >> $GITHUB_STEP_SUMMARY

48
.github/workflows/pr_checks.yaml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: PR Checks
on:
pull_request:
branches:
- '*'
jobs:
comment_coverage:
name: Comment coverage on PR
runs-on: ubuntu-latest
steps:
- name: 🔀 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.GITHUB_TOKEN }}"
submodules: 'recursive'
- name: 📦 install uv
uses: astral-sh/setup-uv@v5
- name: 🐍 python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: 📦 sync depedencies
run: |
uv sync
uv sync --group test
- name: configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: 🧪 run coverage
run: |
uv run pytest --cov --junitxml=pytest.xml --cov-report=term-missing | tee pytest-coverage.txt
continue-on-error: true
- name: 📊 comment coverage
uses: MishaKav/pytest-coverage-comment@main
with:
pytest-coverage-path: pytest-coverage.txt
junitxml-path: pytest.xml

125
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,125 @@
name: Bump version
on:
workflow_dispatch:
inputs:
short_description:
type: string
description: "Short description of the release"
required: false
auto_bump:
type: boolean
description: "Auto bump version?"
required: true
bump_type:
type: choice
description: "Bump type"
required: true
options:
- "major"
- "minor"
- "patch"
- "prerelease"
as_pre_release:
type: boolean
description: "As pre-release?"
required: true
prerelease_type:
type: choice
description: "Pre-release label"
required: true
options:
- "dev"
- "alpha"
- "beta"
- "rc"
- "post"
jobs:
bump_version:
runs-on: ubuntu-latest
name: Bump version and create release
steps:
- name: 🔀 checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
token: "${{ secrets.GITHUB_TOKEN }}"
submodules: "recursive"
- name: 📦 install uv
uses: astral-sh/setup-uv@v5
- name: 🐍 python
uses: actions/setup-python@v5
with:
python-version-file: "pyproject.toml"
- name: 📦 sync depedencies
run: |
uv sync
uv sync --group bump
- name: configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: 📦 bump version (auto)
if: ${{ github.event.inputs.auto_bump == 'true' }}
run: |
if [ "${{ github.event.inputs.as_pre_release }}" == "true" ]; then
uv run semantic-release version --no-changelog --no-commit --no-push --as-prerelease --prerelease-token ${{ github.event.inputs.prerelease_type }}
else
uv run semantic-release version --no-changelog --no-commit --no-push
fi
- name: 📦 bump version (manual)
if: ${{ github.event.inputs.auto_bump == 'false' }}
run: |
if [ "${{ github.event.inputs.as_pre_release }}" == "true" ]; then
uv run semantic-release version --no-changelog --no-commit --no-push --${{ github.event.inputs.bump_type }} --as-prerelease --prerelease-token ${{ github.event.inputs.prerelease_type }}
else
uv run semantic-release version --no-changelog --no-commit --no-push --${{ github.event.inputs.bump_type }}
fi
- name: 📦 get new version
id: get_version
run: echo "BUMPED_VERSION=$(cat pyproject.toml | grep -e "^version = " | cut -d '"' -f 2)" >> $GITHUB_OUTPUT
- name: 📝 create changelog
run: |
uv run git-cliff -s header -l > release_body.md
echo "Changes:" && cat release_body.md
uv run git-cliff > CHANGELOG.md
- name: 📦 update lockfile (re-sync)
run: uv sync
- name: 📤 push changes
run: |
git add CHANGELOG.md pyproject.toml src/*/__init__.py uv.lock
git commit -m "chore(release): ${{ steps.get_version.outputs.BUMPED_VERSION }}"
git push origin main
- name: create release
uses: softprops/action-gh-release@v2
with:
name: ${{ github.event.repository.name }} ${{ steps.get_version.outputs.BUMPED_VERSION }} - ${{ github.event.inputs.short_description }}
tag_name: ${{ steps.get_version.outputs.BUMPED_VERSION }}
body_path: release_body.md
prerelease: ${{ github.event.inputs.as_pre_release }}
discussion_category_name: "Announcements"
- name: 🧹 cleanup
run: |
rm release_body.md
- name: 📤 merge into develop
continue-on-error: true
run: |
git checkout develop
git merge main
git push origin develop
- name: ✅ done
run: echo "done"