Skip to content

Commit

Permalink
ImGUI Test Engine, new zig-gamedev, cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraVoves committed Mar 27, 2024
1 parent 063e5fd commit 3f9d5f6
Show file tree
Hide file tree
Showing 230 changed files with 14,802 additions and 6,459 deletions.
4 changes: 2 additions & 2 deletions .ci/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ set -e
ZIG_ARCH=$1
OPTIMIZE=$2

./zig/lfs_pull.sh ${ZIG_ARCH}
#./zig/get_zig.sh ${ZIG_ARCH}
./lfs_pull.sh

function build() {
WITH_TRACY=$1
WITH_NFD=$2
zig/bin/${ZIG_ARCH}/zig build --verbose -Doptimize=${OPTIMIZE} -Dwith-tracy=${WITH_TRACY} -Dwith-nfd=${WITH_NFD}
zig/bin/${ZIG_ARCH}/zig build -Doptimize=${OPTIMIZE} -Dwith-tracy=${WITH_TRACY} -Dwith-nfd=${WITH_NFD}
}

build false true
Expand Down
2 changes: 1 addition & 1 deletion .ci/gen-docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ set -e

ZIG_ARCH=$1

./zig/lfs_pull.sh ${ZIG_ARCH}
./zig/get_zig.sh ${ZIG_ARCH}

function build() {
zig/${ZIG_ARCH}/zig build docs
Expand Down
4 changes: 2 additions & 2 deletions .ci/init_zig.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ set -e
ZIG_ARCH=$1
OPTIMIZE=$2

./zig/lfs_pull.sh ${ZIG_ARCH}
./lfs_pull.sh
./zig/get_zig.sh ${ZIG_ARCH}
#./lfs_pull.sh
2 changes: 1 addition & 1 deletion .ci/xbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ZIG_ARCH=$1
TARGET_ZIG_ARCH=$2
OPTIMIZE=$3

./zig/lfs_pull.sh ${ZIG_ARCH}
./zig/get_zig.sh ${ZIG_ARCH}
./lfs_pull.sh

mkdir -p build/${OPTIMIZE}
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci.yaml → .ci/xbuild.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:
with:
sparse-checkout: |
.ci/x86_64-macos-test.sh
tests/
fixtures/
- name: Download build
uses: actions/cache@v3
with:
Expand All @@ -86,7 +86,7 @@ jobs:
# with:
# sparse-checkout: |
# .ci/x86_64-macos-linux.sh
# tests/
# fixtures/
# - name: Download build
# uses: actions/cache@v3
# with:
Expand All @@ -108,7 +108,7 @@ jobs:
with:
sparse-checkout: |
.ci/x86_64-windows-test.ps1
tests/
fixtures/
- name: Download build
uses: actions/cache@v3
with:
Expand Down
7 changes: 5 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build and publish docs
name: Docs

on:
push:
Expand All @@ -17,7 +17,7 @@ permissions:
env:
INSTANCE: Writerside/cetech1
ARTIFACT: webHelpCETECH12-all.zip
DOCKER_VERSION: 233.14389
DOCKER_VERSION: 233.14938

jobs:
build:
Expand All @@ -30,6 +30,9 @@ jobs:
- name: Pull LFS
run: git lfs pull --include "Writerside/**/*"

# - name: Install d2
# run: curl -fsSL https://d2lang.com/install.sh | sh -s --

- name: Build Writerside docs using Docker
uses: JetBrains/writerside-github-action@v4
with:
Expand Down
130 changes: 118 additions & 12 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: "Build & Test"
name: Test

permissions:
checks: write

on:
pull_request:
Expand All @@ -9,6 +12,7 @@ on:
- "include/**"
- "externals/**"
- "build.zig"
- "build.zig.zon"

concurrency:
group: ${{ github.head_ref || github.run_id }}-${{ github.actor }}
Expand All @@ -18,14 +22,28 @@ jobs:
validation:
name: Validation
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 1
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
- name: Prepare

- name: Read .zig-version
id: zigversion
uses: juliangruber/read-file-action@v1
with:
path: ./.zigversion
- name: Cache zig binary
id: cache-zig
uses: actions/cache@v4
with:
path: zig/bin/x86_64-linux/zig
key: ${{ runner.arch }}-${{ runner.os }}-zig-${{ steps.zigversion.outputs.content }}
- name: Init zig
if: steps.cache-zig.outputs.cache-hit != 'true'
run: .ci/init_zig.sh x86_64-linux

- name: Lint
run: zig/bin/x86_64-linux/zig fmt --check . --exclude externals/

Expand All @@ -41,7 +59,22 @@ jobs:
submodules: true

- name: Prepare
run: sudo apt-get update && sudo apt-get install libgtk-3-dev kcov
run: sudo apt-get update && sudo apt-get install kcov libdbus-1-dev

- name: Read .zig-version
id: zigversion
uses: juliangruber/read-file-action@v1
with:
path: ./.zigversion
- name: Cache zig binary
id: cache-zig
uses: actions/cache@v4
with:
path: zig/bin/x86_64-linux/zig
key: ${{ runner.arch }}-${{ runner.os }}-zig-${{ steps.zigversion.outputs.content }}
- name: Init zig
if: steps.cache-zig.outputs.cache-hit != 'true'
run: .ci/init_zig.sh x86_64-linux

- name: Build
run: .ci/build.sh x86_64-linux Debug
Expand All @@ -54,7 +87,7 @@ jobs:
overwrite: true
retention-days: 1

- name: Run test
- name: Test unit
run: kcov --include-pattern=cetech1/src/ kcov-output zig-out/bin/cetech1_test

- name: Upload code coverage report to Codecov
Expand All @@ -65,12 +98,25 @@ jobs:
slug: cyberegoorg/cetech1
fail_ci_if_error: true
verbose: true
flags: unittests

- name: Test headless standalone
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5

- name: Test headless standalone with asset root
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5 --asset-root tests/test_asset/
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5 --asset-root fixtures/test_asset/

# TODO: make linux work in CI
# - name: Test UI headless
# run: zig-out/bin/cetech1 --headless --test-ui --test-ui-junit ./result.xml
#
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v4
# if: success() || failure() # always run even if the previous step fails
# with:
# report_paths: "./result.xml"
# fail_on_failure: true
# detailed_summary: true

x86-64-macos:
needs: ["validation"]
Expand All @@ -88,6 +134,21 @@ jobs:
brew update
brew install kcov
- name: Read .zig-version
id: zigversion
uses: juliangruber/read-file-action@v1
with:
path: ./.zigversion
- name: Cache zig binary
id: cache-zig
uses: actions/cache@v4
with:
path: zig/bin/x86_64-macos/zig
key: ${{ runner.arch }}-${{ runner.os }}-zig-${{ steps.zigversion.outputs.content }}
- name: Init zig
if: steps.cache-zig.outputs.cache-hit != 'true'
run: .ci/init_zig.sh x86_64-macos

- name: Build
run: .ci/build.sh x86_64-macos Debug

Expand All @@ -99,14 +160,27 @@ jobs:
overwrite: true
retention-days: 1

- name: Run test
- name: Test unit
run: zig-out/bin/cetech1_test
#run: kcov --include-pattern=cetech1/src/ kcov-output zig-out/bin/cetech1_test

- name: Test headless standalone
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5

- name: Test headless standalone with asset root
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5 --asset-root tests/test_asset/
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5 --asset-root fixtures/test_asset/

- name: Test UI headless
run: zig-out/bin/cetech1 --headless --test-ui --test-ui-junit ./result.xml

- name: Publish Test Report
uses: mikepenz/action-junit-report@v4
if: success() || failure() # always run even if the previous step fails
with:
report_paths: "./result.xml"
fail_on_failure: true
detailed_summary: true
require_tests: true

x86-64-windows:
needs: ["validation"]
Expand All @@ -119,6 +193,22 @@ jobs:
with:
submodules: true

- name: Read .zig-version
id: zigversion
uses: juliangruber/read-file-action@v1
with:
path: ./.zigversion
- name: Cache zig binary
id: cache-zig
uses: actions/cache@v4
with:
path: zig/bin/x86_64-windows/zig.exe
key: ${{ runner.arch }}-${{ runner.os }}-zig-${{ steps.zigversion.outputs.content }}
- name: Init zig
if: steps.cache-zig.outputs.cache-hit != 'true'
shell: bash
run: .ci/init_zig.sh x86_64-windows

- name: Build
shell: bash
run: .ci/build.sh x86_64-windows Debug
Expand All @@ -138,11 +228,27 @@ jobs:
maximum-size: 16GB
disk-root: "C:"

- name: Run test
run: zig-out/bin/cetech1_test.exe
- name: Test unit
shell: bash
run: zig-out/bin/cetech1_test

- name: Test headless standalone
run: zig-out/bin/cetech1.exe --headless --max-kernel-tick 5
shell: bash
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5

- name: Test headless standalone with asset root
run: zig-out/bin/cetech1.exe --headless --max-kernel-tick 5 --asset-root tests/test_asset/
shell: bash
run: zig-out/bin/cetech1 --headless --max-kernel-tick 5 --asset-root fixtures/test_asset/

- name: Test UI headless
shell: bash
run: zig-out/bin/cetech1 --headless --test-ui

# TODO: error on save
# - name: Publish Test Report
# uses: mikepenz/action-junit-report@v4
# if: success() || failure() # always run even if the previous step fails
# with:
# report_paths: "./result.xml"
# fail_on_failure: true
# detailed_summary: true
8 changes: 7 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ zig-out
kcov-output/

imgui.ini
!**/default/imgui.ini

_static.zig

# temp folder for tests
/tests/tmp
/fixtures/tmp

# folder for generated tmp data, cache and debug purpose files
.ct_temp

result.xml
*.tracy
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
[submodule "externals/shared/tools/zls"]
path = externals/shared/tools/zls
url = https://github.com/zigtools/zls.git
[submodule "zig"]
path = zig
url = https://github.com/cyberegoorg/cetech1-zig.git
[submodule "externals/shared/lib/mach-gamemode"]
path = externals/shared/lib/mach-gamemode
url = https://github.com/hexops/mach-gamemode.git
[submodule "externals/shared/lib/SDL_GameControllerDB"]
path = externals/shared/lib/SDL_GameControllerDB
url = https://github.com/mdqinc/SDL_GameControllerDB.git
[submodule "zig"]
path = zig
url = https://github.com/cyberegoorg/cetech1-zig.git
3 changes: 1 addition & 2 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"ziglang.vscode-zig", // ZIG support.
"vadimcn.vscode-lldb", // Debugging support.
"Gruntfuggly.todo-tree", // Todo viewer.
"tintinweb.graphviz-interactive-preview", // DOT preview (asset_graph, etc...)
"bierner.markdown-mermaid", // mermaid preview
"kdheepak.d2-markdown-preview" // D2 preview
]
}
Loading

0 comments on commit 3f9d5f6

Please sign in to comment.