Skip to content
Open
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
17 changes: 17 additions & 0 deletions .commitlintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"rules": {
"type-enum": [
2,
"always",
["feat", "fix", "docs", "style", "refactor", "perf", "test", "build", "ci", "chore", "revert"]
],
"type-case": [2, "always", "lower-case"],
"type-empty": [2, "never"],
"scope-case": [2, "always", "lower-case"],
"subject-empty": [2, "never"],
"subject-full-stop": [2, "never", "."],
"header-max-length": [2, "always", 100],
"body-leading-blank": [1, "always"],
"footer-leading-blank": [1, "always"]
}
}
15 changes: 11 additions & 4 deletions .github/workflows/Engine-CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@ on:
branches: [ master, develop, arena-integration ]

jobs:
commitlint:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/job-commitlint.yml

clang-format:
strategy:
matrix:
directories: [ZEngine, Tetragrama]
directories: [ZEngine, Tetragrama, Obelisk]
uses: ./.github/workflows/job-clangformat.yml
with:
srcDirectory: ${{ matrix.directories }}

windows:
needs: clang-format
needs: [commitlint, clang-format]
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/windows-build.yml
with:
targetFramework: net8.0

macOS:
needs: clang-format
needs: [commitlint, clang-format]
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/macOS-build.yml
with:
targetFramework: net8.0

linux:
needs: clang-format
needs: [commitlint, clang-format]
if: ${{ !failure() && !cancelled() }}
uses: ./.github/workflows/linux-build.yml
with:
targetFramework: net8.0
2 changes: 1 addition & 1 deletion .github/workflows/job-clangformat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ jobs:
run: choco upgrade llvm

- name: Checking formatting
run: .\Scripts\ClangFormat.ps1 -SourceDirectory ${{ github.workspace }}/${{ inputs.srcDirectory }} -RunAsCheck 1
run: .\Scripts\ClangFormat.ps1 -SourceDirectory ${{ github.workspace }}/${{ inputs.srcDirectory }} -RunAsCheck
shell: pwsh
19 changes: 19 additions & 0 deletions .github/workflows/job-commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Commit Lint

on:
workflow_call:

jobs:
commitlint:
name: commitlint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Lint commit messages
uses: wagoid/commitlint-github-action@v6
with:
configFile: .commitlintrc.json
failOnWarnings: false
54 changes: 54 additions & 0 deletions .github/workflows/release-please-prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Release Please (Pre-release)

on:
push:
branches: [develop]

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config-prerelease.json
manifest-file: .release-please-manifest-prerelease.json
token: ${{ secrets.GITHUB_TOKEN }}

publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
strategy:
matrix:
include:
- os: windows-2022
artifact: windows
targetFramework: net8.0
- os: macos-latest
artifact: macOS
- os: ubuntu-latest
artifact: linux
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Build (${{ matrix.artifact }})
uses: ./.github/workflows/job-cmakebuild-${{ matrix.artifact }}.yml
with:
targetFramework: ${{ matrix.targetFramework }}

- name: Upload pre-release artifacts
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
prerelease: true
files: |
build/**/*.zip
build/**/*.tar.gz
53 changes: 53 additions & 0 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release Please (Stable)

on:
push:
branches: [main]

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
token: ${{ secrets.GITHUB_TOKEN }}

publish:
needs: release-please
if: ${{ needs.release-please.outputs.release_created }}
strategy:
matrix:
include:
- os: windows-2022
artifact: windows
targetFramework: net8.0
- os: macos-latest
artifact: macOS
- os: ubuntu-latest
artifact: linux
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4

- name: Build (${{ matrix.artifact }})
uses: ./.github/workflows/job-cmakebuild-${{ matrix.artifact }}.yml
with:
targetFramework: ${{ matrix.targetFramework }}

- name: Upload release artifacts
uses: softprops/action-gh-release@v2
with:
tag_name: ${{ needs.release-please.outputs.tag_name }}
files: |
build/**/*.zip
build/**/*.tar.gz
3 changes: 3 additions & 0 deletions .release-please-manifest-prerelease.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.3.0-alpha.0"
}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "0.3.0"
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

All notable changes to ZEngine will be documented in this file.

The format follows [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
Versions are managed automatically via [Release Please](https://github.com/googleapis/release-please)
based on [Conventional Commits](https://www.conventionalcommits.org/).

## [Unreleased]
19 changes: 18 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
cmake_minimum_required (VERSION 3.17 FATAL_ERROR)

file(READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION.txt" ZENGINE_VERSION)
string(STRIP "${ZENGINE_VERSION}" ZENGINE_VERSION)

project (RendererEngine
VERSION 1.0
VERSION ${ZENGINE_VERSION}
DESCRIPTION "Renderer Engine is an open-source 2D - 3D rendering engine written in C/C++"
LANGUAGES CXX C
)

set_property (GLOBAL PROPERTY USE_FOLDERS ON)

# Install git hooks automatically at configure time so contributors don't need
# to run install-hooks.sh manually.
#
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git")
file(GLOB _hook_files "${CMAKE_CURRENT_SOURCE_DIR}/Scripts/hooks/*")
foreach(_hook ${_hook_files})
get_filename_component(_hook_name "${_hook}" NAME)
set(_dst "${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks/${_hook_name}")
file(COPY "${_hook}" DESTINATION "${CMAKE_CURRENT_SOURCE_DIR}/.git/hooks")
file(CHMOD "${_dst}" PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
message(STATUS "Installed git hook: ${_hook_name}")
endforeach()
endif()

# Core invariants
#

Expand Down
116 changes: 112 additions & 4 deletions Contributing.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

# Contributing to ZEngine

When contributing to this repository, please first discuss the change you wish to make via issue.
When contributing to this repository, please first discuss the change you wish to make via issue.

## Rules

Expand All @@ -14,13 +14,121 @@ When contributing to this repository, please first discuss the change you wish t

ZEngine is a 3D rendering engine. So every piece of code has to be scrutinized to look for potential bottlenecks or slow downs. Ultimately the goal is to render more with less resources.

## Commit Message Convention

ZEngine uses [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/). Every commit message is linted on pull requests and drives automatic versioning — the type you choose determines how the version number is bumped.

### Format

```
<type>(<scope>): <subject>

[optional body]

[optional footer(s)]
```

- **type** — required, lowercase (see table below)
- **scope** — optional, lowercase, names the subsystem affected (e.g. `rendering`, `vulkan`, `camera`, `memory`, `ci`)
- **subject** — required, imperative mood, no trailing period, max 100 characters total for the header
- **body** — free prose; wrap at 72 characters; separate from subject with a blank line
- **footer** — key: value pairs; `BREAKING CHANGE: <description>` triggers a major version bump

### Types and version impact

| Type | When to use | Version bump |
|---|---|---|
| `feat` | A new feature visible to users or engine consumers | minor (`0.3.0` → `0.4.0`) |
| `fix` | A bug fix | patch (`0.3.0` → `0.3.1`) |
| `perf` | A performance improvement with no API change | patch |
| `refactor` | Code restructuring with no behaviour or API change | patch |
| `docs` | Documentation only | none |
| `style` | Formatting, whitespace — no logic change | none |
| `test` | Adding or correcting tests | none |
| `build` | Build system or external dependency changes | none |
| `ci` | CI/CD pipeline changes | none |
| `chore` | Maintenance tasks (e.g. release bumps) | none |
| `revert` | Reverts a previous commit | patch |

A `!` suffix on any type (e.g. `feat!:`) or a `BREAKING CHANGE:` footer triggers a **major** bump.

### Examples

```
feat(rendering): add indirect draw support for mesh batches
```

```
fix(vulkan): correct semaphore leak on swapchain recreation
```

```
perf(memory): replace per-frame heap alloc with arena in render loop
```

```
feat!: remove legacy OpenGL backend

BREAKING CHANGE: the OpenGL renderer has been removed. Vulkan is now
the only supported backend. Update your application startup code to
remove any OpenGL-specific initialisation.
```

```
refactor(camera): extract projection logic into CameraUtils

No behaviour change. Simplifies FlyCamera and OrbitCamera by sharing
the common frustum calculation.
```

### What happens if a commit message is wrong

A CI check (`commitlint`) runs on every pull request and will block the build if any commit in the PR branch does not follow the format. Fix the message with `git rebase -i` before requesting review.

## Local Setup

Git hooks are installed automatically the first time you run CMake. No manual steps required.

The `pre-push` hook runs clang-format on `ZEngine` and `Tetragrama` before every push, mirroring the CI check. It requires [PowerShell Core (`pwsh`)](https://github.com/PowerShell/PowerShell/releases) and LLVM `clang-format` (version 20–22). If `pwsh` is not found the hook prints a warning and lets the push through; CI will catch formatting issues instead.

## Release Process

ZEngine has two release tracks, both fully automated from commit messages.

### Stable releases (`main`)

Merges into `main` are picked up by Release Please, which opens a **Release PR** accumulating all changes since the last stable tag. When that PR is merged:

- `VERSION.txt` is bumped (`0.3.0` → `0.3.1` / `0.4.0` / `1.0.0`) based on commit types
- A tag `v0.3.1` is created
- A GitHub Release is published with build artifacts for all platforms

### Pre-releases (`develop`)

Pushes to `develop` follow the same process but produce alpha versions:

- Release Please opens a **Pre-release PR** on `develop`
- When merged: `VERSION.txt` is set to e.g. `0.4.0-alpha.1`, tag `v0.4.0-alpha.1` is created
- A GitHub Pre-release is published (marked as pre-release in the GitHub UI)
- Each subsequent batch of commits increments the alpha counter: `alpha.1` → `alpha.2` → …

### Promoting a pre-release to stable

Once `develop` is stable enough to ship:

1. Open a PR from `develop` → `main`
2. Merge it — Release Please on `main` sees all the accumulated `feat:`/`fix:` commits and opens a stable Release PR
3. Merge the Release PR → `v0.4.0` stable is tagged and published

The `ZENGINE_VERSION_PRERELEASE` macro in the generated `Core/version.h` will be non-empty on alpha builds and empty on stable, so engine code can detect this at compile time.

## Pull Request Process

1. Make sure to transmit that your modification
1. Make sure your modification is covered by the rules above and discussed in an issue first.

2. Update the README.md with details of changes to the interface, this includes new environment
2. Update the README.md with details of changes to the interface, including new environment
variables, exposed ports, useful file locations and container parameters.

4. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
3. You may merge the Pull Request once you have the sign-off of two other developers, or if you
do not have permission to do that, you may request the second reviewer to merge it for you.

4 changes: 3 additions & 1 deletion Scripts/BuildEngine.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,9 @@ if(-Not $LauncherOnly) {
)

foreach ($directory in $srcDirectories) {
& pwsh -File $clangFormatScript -SourceDirectory $directory -RunAsCheck:$VerifyFormatting
[string[]]$clangFormatArgs = @('-File', $clangFormatScript, '-SourceDirectory', $directory)
if ($VerifyFormatting) { $clangFormatArgs += '-RunAsCheck' }
& pwsh @clangFormatArgs

if ($LASTEXITCODE -ne 0) {
Write-Error "Stopped build process..." -ErrorAction Stop
Expand Down
2 changes: 1 addition & 1 deletion Scripts/ClangFormat.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ param (
[string]$SourceDirectory,

[Parameter(HelpMessage = "Whether clang-format should only check if the source code is well-formatted")]
[bool]$RunAsCheck=$False
[switch]$RunAsCheck
)

$ErrorActionPreference = "Stop"
Expand Down
Loading
Loading