Skip to content
Merged
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
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Suggest owner review for high-risk engine, persistence, shader, and CI paths.
modules/engine-graphics/** @OpenStaticFish
modules/world-persistence/** @OpenStaticFish
.github/workflows/** @OpenStaticFish
assets/shaders/** @OpenStaticFish
16 changes: 8 additions & 8 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ on:
duration:
description: Benchmark duration per preset (seconds)
required: false
default: '30'
default: '5'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -25,7 +25,7 @@ jobs:
contents: read
statuses: write
runs-on: blacksmith-2vcpu-ubuntu-2404
timeout-minutes: 90
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

Expand All @@ -48,14 +48,16 @@ jobs:
uses: ./.github/actions/run-with-log
with:
name: Benchmark
timeout: 75m
timeout: 20m
log-file: benchmark.log
command: nix develop .#ci-graphics --command bash scripts/run_benchmark.sh --duration "$BENCHMARK_DURATION" --presets low,medium,high --output-dir benchmark-results
command: mkdir -p "$MESA_SHADER_CACHE_DIR" && nix develop .#ci-graphics --command bash scripts/run_benchmark.sh --duration "$BENCHMARK_DURATION" --presets low,medium,high --output-dir benchmark-results --per-preset-timeout 600
env:
XDG_RUNTIME_DIR: /tmp/runtime-runner
WAYLAND_DISPLAY: headless
MESA_SHADER_CACHE_DIR: /tmp/mesa_shader_cache
SDL_AUDIODRIVER: dummy
ZIGCRAFT_SAFE_MODE: '1'
BENCHMARK_DURATION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.duration || '30' }}
BENCHMARK_DURATION: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.duration || '5' }}

- name: Stop headless Wayland compositor
if: always()
Expand Down Expand Up @@ -92,9 +94,7 @@ jobs:
const failed = runOutcome === 'failure' || compareOutcome === 'failure';
const description = failed
? 'Benchmark regression or runtime failure'
: compareOutcome === 'skipped'
? 'Benchmark completed (baseline placeholder)'
: 'Benchmark completed';
: 'Benchmark completed';

await github.rest.repos.createCommitStatus({
owner: context.repo.owner,
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Stale Issues and PRs

on:
schedule:
- cron: '17 3 * * *'
workflow_dispatch:
inputs:
dry-run:
description: Log stale decisions without labeling or closing issues/PRs
required: false
default: 'false'
type: choice
options:
- 'false'
- 'true'

permissions:
issues: write
pull-requests: write

concurrency:
group: ${{ github.workflow }}
cancel-in-progress: false

jobs:
stale:
runs-on: ubuntu-latest
steps:
- name: Mark and close stale issues and PRs
uses: actions/stale@v10
with:
days-before-stale: 60
days-before-close: 14
stale-issue-label: stale
stale-pr-label: stale
exempt-issue-labels: pinned,roadmap,production-readiness,audit-b1,audit-b2,audit-b3,audit-b4,audit-b5,audit-b6,security,help wanted
exempt-pr-labels: pinned,roadmap,production-readiness,audit-b1,audit-b2,audit-b3,audit-b4,audit-b5,audit-b6,security,help wanted
stale-issue-message: This issue has had no activity for 60 days. It will be closed in 14 days unless there is new activity or an exemption label is added.
stale-pr-message: This pull request has had no activity for 60 days. It will be closed in 14 days unless there is new activity or an exemption label is added.
close-issue-message: Closing this issue because it remained stale for 14 days without new activity.
close-pr-message: Closing this pull request because it remained stale for 14 days without new activity.
operations-per-run: 100
enable-statistics: true
debug-only: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.dry-run == 'true' }}
12 changes: 11 additions & 1 deletion .github/workflows/workflow-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ on:
- '.github/workflows/**'
- '.github/actions/**'
- 'scripts/*.sh'
- '.shellcheckrc'
- 'flake.nix'
pull_request:
branches: [ dev ]
paths:
- '.github/workflows/**'
- '.github/actions/**'
- 'scripts/*.sh'
- '.shellcheckrc'
- 'flake.nix'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -38,6 +42,9 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Setup Nix
uses: ./.github/actions/setup-nix

- name: Parse workflow YAML
run: |
ruby -e 'require "yaml"; Dir[".github/workflows/*.{yml,yaml}"].sort.each { |f| YAML.load_file(f); puts "OK #{f}" }'
Expand All @@ -47,4 +54,7 @@ jobs:
ruby -e 'require "yaml"; Dir[".github/actions/**/action.{yml,yaml}"].sort.each { |f| YAML.load_file(f); puts "OK #{f}" }'

- name: Check shell script syntax
run: bash -n scripts/*.sh
run: nix develop .#ci-unit --command bash -n scripts/*.sh

- name: Run ShellCheck
run: nix develop .#ci-unit --command shellcheck scripts/*.sh
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
enable=add-default-case,deprecate-which,quote-safe-variables
severity=warning
73 changes: 73 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Contributor Covenant Code of Conduct

## Our Pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our Standards

Examples of behavior that contributes to a positive environment include:
- Demonstrating empathy and kindness toward other people.
- Being respectful of differing opinions, viewpoints, and experiences.
- Giving and gracefully accepting constructive feedback.
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience.
- Focusing on what is best not just for us as individuals, but for the overall community.

Examples of unacceptable behavior include:
- The use of sexualized language or imagery, and sexual attention or advances of any kind.
- Trolling, insulting or derogatory comments, and personal or political attacks.
- Public or private harassment.
- Publishing others' private information, such as a physical or email address, without their explicit permission.
- Other conduct which could reasonably be considered inappropriate in a professional setting.

## Enforcement Responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces, and also applies when an individual is officially representing the community in public spaces.

Examples of representing our community include using an official email address, posting through an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the repository owner through the contact paths listed in `SECURITY.md` or GitHub repository moderation tools. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement Guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

Community Impact: Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

Consequence: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

Community Impact: A violation through a single incident or series of actions.

Consequence: A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary Ban

Community Impact: A serious violation of community standards, including sustained inappropriate behavior.

Consequence: A temporary ban from any sort of interaction or public communication with the community for a specified period of time. Violating these terms may lead to a permanent ban.

### 4. Permanent Ban

Community Impact: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

Consequence: A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 2.1, available at https://www.contributor-covenant.org/version/2/1/code_of_conduct.html.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ nix develop # glslang is included in the dev shell
|----------|----------|
| **Discussions** | [GitHub Discussions](https://github.com/OpenStaticFish/ZigCraft/discussions) |
| **Issues** | [GitHub Issues](https://github.com/OpenStaticFish/ZigCraft/issues) |
| **Security** | [Security Policy](SECURITY.md) |
| **License** | [MIT License](LICENSE) |

---
Expand Down
40 changes: 40 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Security Policy

## Supported Versions

ZigCraft is pre-1.0 software. Security fixes are provided for the current `dev` branch and the latest `main` release branch when one exists.

| Version | Supported |
| ------- | --------- |
| `dev` | Yes |
| latest `main` | Yes |
| older branches | No |

## Reporting a Vulnerability

Please report suspected vulnerabilities privately through GitHub Security Advisories for this repository. If private advisories are unavailable, contact the repository owner directly and do not open a public issue with exploit details.

Include:
- Affected commit, branch, or release.
- Steps to reproduce or proof-of-concept details.
- Impact assessment and any known mitigations.
- Whether the issue is already public.

## Response SLA

- Initial acknowledgement: within 7 calendar days.
- Triage update: within 14 calendar days after acknowledgement.
- Fix or mitigation target: as soon as practical based on severity and exploitability.

## Scope

In scope:
- Engine code, build scripts, CI workflows, release artifacts, and bundled assets in this repository.
- Vulnerabilities that can cause code execution, data loss, unsafe file access, dependency compromise, or CI credential exposure.

Out of scope:
- Vulnerabilities requiring local administrative access before exploitation.
- Issues in third-party tools unless ZigCraft pins or packages them insecurely.
- Denial-of-service reports without a practical security impact beyond normal development instability.

Coordinated disclosure is expected. Please allow maintainers time to investigate and prepare fixes before public disclosure.
41 changes: 41 additions & 0 deletions docs/benchmarks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Benchmark Baselines

ZigCraft benchmark gating compares every `dev` benchmark run against `baseline.json`.

## Reference Hardware

Baselines are captured on the GitHub Actions benchmark job runner:

- Runner label: `blacksmith-2vcpu-ubuntu-2404`
- Workflow: `.github/workflows/benchmark.yml`
- Graphics backend: Mesa Lavapipe via `.github/actions/setup-lavapipe`
- Zig version: `0.16.0`, provided by the Nix flake
- Build mode: `ReleaseFast`
- Presets: `low`, `medium`, `high`
- Duration: 5 seconds per preset for the CI canary gate

Lavapipe and Zig versions are pinned by the Nix inputs used by the workflow. If the flake lock changes, refresh this baseline so performance drift is tied to a known toolchain.

## Capture Procedure

Run the benchmark workflow on the baseline branch or on `dev`:

```bash
gh workflow run benchmark.yml --repo OpenStaticFish/ZigCraft --ref <branch> -f duration=5
```

After the run finishes, download the `benchmark-results` artifact and replace the corresponding `low`, `medium`, and `high` entries in `baseline.json` with the captured JSON payloads. Keep `generated` set to `true`.

This gate is intentionally a short canary so every `dev` push gets a bounded performance signal without consuming long runner time. Longer profiling runs should use the manual workflow input with a larger duration and should not replace the CI canary baseline unless that policy changes deliberately.

## Tolerance Policy

`scripts/compare_benchmarks.sh` applies an explicit tolerance per metric:

- Warning threshold: 5% regression.
- Failure threshold: 10% regression.
- Lower `fps.p1` is a regression.
- Higher `gpu_ms.total_avg` is a regression.
- Higher `draw_calls_avg` is a regression.

The p1 FPS metric is the primary user-visible smoothness guard. GPU time and draw calls catch rendering-cost regressions even when FPS is noisy on virtualized runners.
3 changes: 3 additions & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@
pkgs.zls
pkgs.pkg-config
pkgs.glslang
pkgs.shellcheck
pkgs.weston
];

Expand All @@ -353,6 +354,7 @@
zig
pkgs.pkg-config
pkgs.glslang
pkgs.shellcheck
];

buildInputs = [
Expand All @@ -373,6 +375,7 @@
zig
pkgs.pkg-config
pkgs.glslang
pkgs.shellcheck
pkgs.weston
];

Expand Down
Loading
Loading