-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: CI; Better project structure (#1)
Add CI Add Examples/ folder Add a README Cleaner project structure: - Try to improve compile time with better inl/impl file management
- Loading branch information
Showing
70 changed files
with
2,047 additions
and
1,272 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Examples/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Common | ||
common --enable_platform_specific_config | ||
common --incompatible_strict_action_env | ||
common --toolchain_resolution_debug=all | ||
common --show_timestamps | ||
common --verbose_failures | ||
test --test_output=errors | ||
|
||
# Opts | ||
common:linux --config=default_compiler_opts | ||
common:msvc --config=microsoft_compiler_opts | ||
|
||
common:default_compiler_opts --copt -std=c++20 | ||
common:microsoft_compiler_opts --copt /std:c++20 | ||
|
||
# BuildBuddy | ||
common:linux --workspace_status_command=$(pwd)/.buildbuddy/workspace_status.sh | ||
common:windows --workspace_status_command=.buildbuddy/workspace_status.bat |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
@echo off | ||
call PowerShell -NoProfile -ExecutionPolicy Bypass -Command "%CD%\.buildbuddy\workspace_status.ps1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# This script will be run by Bazel when the building process starts to | ||
# generate key-value information that represents the status of the | ||
# workspace. The output should be like | ||
# | ||
# KEY1 VALUE1 | ||
# KEY2 VALUE2 | ||
# | ||
# If the script exits with a non-zero code, it's considered as a failure | ||
# and the output will be discarded. | ||
|
||
$ErrorActionPreference = "Stop" | ||
|
||
# Get the repository URL without credentials | ||
$repo_url = (git config --get remote.origin.url) -replace '//.*?:.*?@', '//' | ||
$repo_url = $repo_url -replace '^[email protected]:', 'https://github.com/' | ||
$urrepo_urll = $repo_url -replace '\.git$' | ||
Write-Output "REPO_URL $repo_url" | ||
|
||
# Get the commit SHA | ||
$commit_sha = git rev-parse HEAD | ||
Write-Output "COMMIT_SHA $commit_sha" | ||
|
||
# Get the current Git branch | ||
$git_branch = git rev-parse --abbrev-ref HEAD | ||
Write-Output "GIT_BRANCH $git_branch" | ||
|
||
# Check if there are any modified files in the working directory | ||
if (git diff-index --quiet HEAD) { | ||
$git_tree_status = 'Clean' | ||
} else { | ||
$git_tree_status = 'Modified' | ||
} | ||
Write-Output "GIT_TREE_STATUS $git_tree_status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
# This script will be run bazel when building process starts to | ||
# generate key-value information that represents the status of the | ||
# workspace. The output should be like | ||
# | ||
# KEY1 VALUE1 | ||
# KEY2 VALUE2 | ||
# | ||
# If the script exits with non-zero code, it's considered as a failure | ||
# and the output will be discarded. | ||
|
||
set -eo pipefail # exit immediately if any command fails. | ||
|
||
function remove_url_credentials() { | ||
which perl >/dev/null && perl -pe 's#//.*?:.*?@#//#' || cat | ||
} | ||
|
||
repo_url=$(git config --get remote.origin.url | remove_url_credentials) | ||
repo_url=${repo_url/git@github.com:/https://github.com/} | ||
repo_url=${repo_url%.git} | ||
echo "REPO_URL $repo_url" | ||
|
||
commit_sha=$(git rev-parse HEAD) | ||
echo "COMMIT_SHA $commit_sha" | ||
|
||
git_branch=$(git rev-parse --abbrev-ref HEAD) | ||
echo "GIT_BRANCH $git_branch" | ||
|
||
git_tree_status=$(git diff-index --quiet HEAD -- && echo 'Clean' || echo 'Modified') | ||
echo "GIT_TREE_STATUS $git_tree_status" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
agents: | ||
queue: "agent-runners-linux-amd64" | ||
|
||
steps: | ||
- label: ":bazel: Build and Test on gcc" | ||
commands: | ||
- CC=gcc bazelisk build --config=default_compiler_opts //:LittleECSTests | ||
- CC=gcc bazelisk test --config=default_compiler_opts //:LittleECSTests | ||
|
||
- label: ":bazel: Build and Test on Clang" | ||
commands: | ||
- CC=clang bazelisk build --config=default_compiler_opts //:LittleECSTests | ||
- CC=clang bazelisk test --config=default_compiler_opts //:LittleECSTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
steps: | ||
- label: ":pipeline: Launch Windows Pipeline" | ||
command: "buildkite-agent pipeline upload .buildkite/windows_amd64.yml" | ||
- label: ":pipeline: Launch Linux Pipeline" | ||
command: "buildkite-agent pipeline upload .buildkite/linux_amd64.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name: "LittleECS" | ||
steps: | ||
- label: ":pipeline: Launch Embbeded Pipeline" | ||
command: "buildkite-agent pipeline upload .builkite/pipeline.yml" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
agents: | ||
queue: "agent-runners-windows-amd64" | ||
|
||
steps: | ||
- label: ":bazel: Build" | ||
commands: | ||
- bazelisk build --config=microsoft_compiler_opts //:LittleECSTests | ||
- bazelisk test --config=microsoft_compiler_opts //:LittleECSTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: LittleECS | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
pull_request: | ||
branches: | ||
- '**' | ||
|
||
jobs: | ||
windows-latest-msvc: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: bazelbuild/setup-bazelisk@v3 | ||
- name: Mount bazel cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: "~/.cache/bazel" | ||
key: bazel | ||
- name: Building... | ||
run: bazelisk build --config=microsoft_compiler_opts //:LittleECSTests | ||
- name: Testing... | ||
run: bazelisk test --config=microsoft_compiler_opts //:LittleECSTests | ||
|
||
ubuntu-latest-gcc: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: bazelbuild/setup-bazelisk@v3 | ||
- name: Mount bazel cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: "~/.cache/bazel" | ||
key: bazel | ||
- name: Version | ||
run: gcc --version | ||
- name: Building... | ||
run: CC=gcc bazelisk build --config=default_compiler_opts //:LittleECSTests | ||
- name: Testing... | ||
run: CC=gcc bazelisk test --config=default_compiler_opts //:LittleECSTests | ||
|
||
ubuntu-latest-clang: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: bazelbuild/setup-bazelisk@v3 | ||
- name: Mount bazel cache | ||
uses: actions/cache@v4 | ||
with: | ||
path: "~/.cache/bazel" | ||
key: bazel | ||
- name: Install clang | ||
run: | | ||
wget https://apt.llvm.org/llvm.sh | ||
chmod +x ./llvm.sh | ||
sudo ./llvm.sh 17 | ||
- name: Version | ||
run: clang --version | ||
- name: Building... | ||
run: CC=clang++-17 bazelisk build --config=default_compiler_opts //:LittleECSTests | ||
- name: Testing... | ||
run: CC=clang++-17 bazelisk test --config=default_compiler_opts //:LittleECSTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{ | ||
"configurations": [ | ||
{ | ||
"name": "Default Windows", | ||
"includePath": [ | ||
"src/", | ||
"bazel-littleecs/external/_main~_repo_rules~ProjectCore/src/" | ||
], | ||
"cStandard": "c17", | ||
"cppStandard": "c++20", | ||
"compilerPath": "cl.exe", | ||
"intelliSenseMode": "windows-msvc-x64" | ||
} | ||
], | ||
"version": 4 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
{ | ||
"files.associations": { | ||
"*.tpl": "starlark", | ||
".bazelrc": "bat", | ||
"algorithm": "cpp", | ||
"charconv": "cpp", | ||
"chrono": "cpp", | ||
"compare": "cpp", | ||
"concepts": "cpp", | ||
"exception": "cpp", | ||
"filesystem": "cpp", | ||
"format": "cpp", | ||
"iomanip": "cpp", | ||
"istream": "cpp", | ||
"iterator": "cpp", | ||
"limits": "cpp", | ||
"list": "cpp", | ||
"memory": "cpp", | ||
"new": "cpp", | ||
"optional": "cpp", | ||
"ostream": "cpp", | ||
"system_error": "cpp", | ||
"tuple": "cpp", | ||
"type_traits": "cpp", | ||
"utility": "cpp", | ||
"vector": "cpp", | ||
"xhash": "cpp", | ||
"xlocnum": "cpp", | ||
"xmemory": "cpp", | ||
"xstring": "cpp", | ||
"xtr1common": "cpp", | ||
"xutility": "cpp", | ||
"future": "cpp", | ||
"xlocale": "cpp", | ||
"any": "cpp", | ||
"array": "cpp", | ||
"atomic": "cpp", | ||
"bit": "cpp", | ||
"cctype": "cpp", | ||
"cinttypes": "cpp", | ||
"clocale": "cpp", | ||
"cmath": "cpp", | ||
"condition_variable": "cpp", | ||
"csignal": "cpp", | ||
"cstddef": "cpp", | ||
"cstdint": "cpp", | ||
"cstdio": "cpp", | ||
"cstdlib": "cpp", | ||
"cstring": "cpp", | ||
"ctime": "cpp", | ||
"cwchar": "cpp", | ||
"deque": "cpp", | ||
"coroutine": "cpp", | ||
"resumable": "cpp", | ||
"forward_list": "cpp", | ||
"fstream": "cpp", | ||
"functional": "cpp", | ||
"initializer_list": "cpp", | ||
"ios": "cpp", | ||
"iosfwd": "cpp", | ||
"iostream": "cpp", | ||
"locale": "cpp", | ||
"map": "cpp", | ||
"mutex": "cpp", | ||
"queue": "cpp", | ||
"ranges": "cpp", | ||
"ratio": "cpp", | ||
"set": "cpp", | ||
"span": "cpp", | ||
"sstream": "cpp", | ||
"stack": "cpp", | ||
"stdexcept": "cpp", | ||
"stop_token": "cpp", | ||
"streambuf": "cpp", | ||
"string": "cpp", | ||
"thread": "cpp", | ||
"typeinfo": "cpp", | ||
"unordered_map": "cpp", | ||
"unordered_set": "cpp", | ||
"xfacet": "cpp", | ||
"xiosbase": "cpp", | ||
"xlocbuf": "cpp", | ||
"xlocinfo": "cpp", | ||
"xlocmes": "cpp", | ||
"xlocmon": "cpp", | ||
"xloctime": "cpp", | ||
"xtree": "cpp" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
"" | ||
|
||
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_test") | ||
|
||
cc_library( | ||
name = "LittleECS", | ||
srcs = glob([ "src/**/*.h" ]), | ||
hdrs = glob([ "src/**/*.h" ]), | ||
includes = [ "src/" ], | ||
strip_include_prefix = "src", | ||
include_prefix = "LittleECS", | ||
linkstatic = True, | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_test( | ||
name = "LittleECSTests", | ||
includes = [ "src/" ], | ||
srcs = glob([ "Tests/**/*.h", "Tests/**/*.cpp" ], exclude=["Tests/Perf/**"]), | ||
defines = [ "LECS_USE_PROJECTCORE" ], | ||
deps = [ "@ProjectCore//:ProjectCore", ":LittleECS" ], | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
cc_test( | ||
name = "LittleECSTestsPerf", | ||
includes = [ "src/" ], | ||
srcs = glob([ "Tests/**/*.h", "Tests/**/*.cpp" ]), | ||
defines = [ "LECS_USE_PROJECTCORE" ], | ||
deps = [ "@ProjectCore//:ProjectCore", ":LittleECS" ], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# LittleECS Workflow | ||
|
||
This doc is tigtelly related to the [Workflow example](../Examples/Workflow/main.cpp) | ||
|
||
To launch it, you can set your working directory to Examples/ and run: | ||
- On Windows, using msvc: | ||
``` | ||
bazelisk run --config=msvc //Workflow:Workflow | ||
``` | ||
- On Linux: (This `--config=linux` is not mandatory) | ||
``` | ||
bazelisk run --config=linux //Workflow:Workflow | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Common | ||
common --enable_platform_specific_config | ||
common --incompatible_strict_action_env | ||
common --show_timestamps | ||
common --verbose_failures | ||
test --test_output=errors | ||
|
||
# Opts | ||
common:linux --config=default_compiler_opts | ||
common:msvc --config=microsoft_compiler_opts | ||
|
||
common:default_compiler_opts --copt -std=c++20 | ||
common:microsoft_compiler_opts --copt /std:c++20 |
Oops, something went wrong.