Skip to content

Commit 37d96d6

Browse files
authored
The first revision #4
2 parents f92a92c + 00bd063 commit 37d96d6

35 files changed

+2043
-291
lines changed

.editorconfig

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,25 @@
1-
# Top-most EditorConfig file
21
root = true
32

4-
# Global settings (applicable to all files unless overridden)
53
[*]
6-
charset = utf-8 # Default character encoding
7-
end_of_line = lf # Use LF for line endings (Unix-style)
8-
indent_style = space # Use spaces for indentation
9-
indent_size = 4 # Default indentation size
10-
insert_final_newline = true # Make sure files end with a newline
11-
trim_trailing_whitespace = true # Remove trailing whitespace
4+
charset = utf-8
5+
end_of_line = lf
6+
indent_style = space
7+
indent_size = 4
8+
insert_final_newline = true
9+
trim_trailing_whitespace = true
1210

13-
# Zig files
1411
[*.zig]
1512
max_line_length = 100
1613

17-
# Markdown files
1814
[*.md]
1915
max_line_length = 120
20-
trim_trailing_whitespace = false # Don't remove trailing whitespace in Markdown files
16+
trim_trailing_whitespace = false
2117

22-
# Bash scripts
2318
[*.sh]
2419
indent_size = 2
2520

26-
# YAML files
2721
[*.{yml,yaml}]
2822
indent_size = 2
2923

30-
# Python files
3124
[*.py]
3225
max_line_length = 100

.github/workflows/benches.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Run Benchmarks
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
tags:
9+
- 'v*'
10+
pull_request:
11+
branches:
12+
- main
13+
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
benchmarks:
19+
runs-on: ubuntu-latest
20+
21+
steps:
22+
- name: Checkout Repository
23+
uses: actions/checkout@v4
24+
25+
- name: Install Zig
26+
uses: goto-bus-stop/setup-zig@v2
27+
with:
28+
version: '0.15.1'
29+
30+
- name: Install Dependencies
31+
run: |
32+
sudo apt-get update
33+
sudo apt-get install -y make
34+
35+
- name: Run the Benchmarks
36+
run: make bench

.github/workflows/docs.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
name: Publish API Documentation
22

33
on:
4+
workflow_dispatch:
45
push:
56
tags:
67
- 'v*'
78

8-
workflow_dispatch:
9-
109
permissions:
1110
contents: write
1211

@@ -20,7 +19,7 @@ jobs:
2019
- name: Install Zig
2120
uses: goto-bus-stop/setup-zig@v2
2221
with:
23-
version: '0.14.1'
22+
version: '0.15.1'
2423

2524
- name: Install System Dependencies
2625
run: |

.github/workflows/lints.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
name: Run Linter Checks
22

33
on:
4+
workflow_dispatch:
45
push:
5-
branches:
6-
- main
76
tags:
87
- 'v*'
9-
108
pull_request:
119
branches:
1210
- main
1311

14-
workflow_dispatch:
15-
1612
permissions:
1713
contents: read
1814

@@ -27,7 +23,7 @@ jobs:
2723
- name: Install Zig
2824
uses: goto-bus-stop/setup-zig@v2
2925
with:
30-
version: '0.14.1'
26+
version: '0.15.1'
3127

3228
- name: Install Dependencies
3329
run: |

.github/workflows/tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
name: Run Tests
22

33
on:
4+
workflow_dispatch:
45
push:
56
branches:
67
- main
78
tags:
89
- 'v*'
9-
1010
pull_request:
1111
branches:
1212
- main
1313

14-
workflow_dispatch:
15-
1614
permissions:
1715
contents: read
1816

@@ -27,7 +25,7 @@ jobs:
2725
- name: Install Zig
2826
uses: goto-bus-stop/setup-zig@v2
2927
with:
30-
version: '0.14.1'
28+
version: '0.15.1'
3129

3230
- name: Install Dependencies
3331
run: |

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ repos:
2222
- repo: local
2323
hooks:
2424
- id: format
25-
name: Format the code
25+
name: Format Code
2626
entry: make format
2727
language: system
2828
pass_filenames: false
2929
stages: [ pre-commit ]
3030

3131
- id: lint
32-
name: Check code style
32+
name: Check Code Style
3333
entry: make lint
3434
language: system
3535
pass_filenames: false
3636
stages: [ pre-commit ]
3737

3838
- id: test
39-
name: Run the tests
39+
name: Run Test
4040
entry: make test
4141
language: system
4242
pass_filenames: false

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
# Code of Conduct
1+
## Code of Conduct
22

33
We adhere to the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) version 2.1.

CONTRIBUTING.md

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
# Contribution Guidelines
1+
## Contribution Guidelines
22

33
Thank you for considering contributing to this project!
44
Contributions are always welcome and appreciated.
55

6-
## How to Contribute
6+
### How to Contribute
77

8-
Please check the [issue tracker](https://github.com/habedi/ordered/issues) to see if there is an issue you
8+
Please check the [issue tracker](https://github.com/CogitatorTech/ordered/issues) to see if there is an issue you
99
would like to work on or if it has already been resolved.
1010

11-
### Reporting Bugs
11+
#### Reporting Bugs
1212

13-
1. Open an issue on the [issue tracker](https://github.com/habedi/ordered/issues).
13+
1. Open an issue on the [issue tracker](https://github.com/CogitatorTech/ordered/issues).
1414
2. Include information such as steps to reproduce the observed behavior and relevant logs or screenshots.
1515

16-
### Suggesting Features
16+
#### Suggesting Features
1717

18-
1. Open an issue on the [issue tracker](https://github.com/habedi/ordered/issues).
18+
1. Open an issue on the [issue tracker](https://github.com/CogitatorTech/ordered/issues).
1919
2. Provide details about the feature, its purpose, and potential implementation ideas.
2020

21-
## Submitting Pull Requests
21+
### Submitting Pull Requests
2222

2323
- Ensure all tests pass before submitting a pull request.
2424
- Write a clear description of the changes you made and the reasons behind them.
2525

2626
> [!IMPORTANT]
2727
> It's assumed that by submitting a pull request, you agree to license your contributions under the project's license.
2828
29-
## Development Workflow
29+
### Development Workflow
3030

31-
### Prerequisites
31+
#### Prerequisites
3232

3333
Install GNU Make on your system if it's not already installed.
3434

@@ -39,22 +39,22 @@ sudo apt-get install make
3939

4040
- Use the `make install-deps` command to install the development dependencies.
4141

42-
### Code Style
42+
#### Code Style
4343

4444
- Use the `make format` command to format the code.
4545

46-
### Running Tests
46+
#### Running Tests
4747

4848
- Use the `make test` command to run the tests.
4949

50-
### Running Linters
50+
#### Running Linters
5151

5252
- Use the `make lint` command to run the linters.
5353

54-
### See Available Commands
54+
#### See Available Commands
5555

5656
- Run `make help` to see all available commands for managing different tasks.
5757

58-
## Code of Conduct
58+
### Code of Conduct
5959

60-
We adhere to the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) version 2.1.
60+
We adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md).

Makefile

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
# ################################################################################
22
# # Configuration and Variables
33
# ################################################################################
4-
ZIG ?= $(shell which zig || echo ~/.local/share/zig/0.14.1/zig)
4+
ZIG ?= $(shell which zig || echo ~/.local/share/zig/0.15.1/zig)
55
BUILD_TYPE ?= Debug
66
BUILD_OPTS = -Doptimize=$(BUILD_TYPE)
77
JOBS ?= $(shell nproc || echo 2)
88
SRC_DIR := src
99
EXAMPLES_DIR := examples
10+
BENCHMARKS_DIR:= benches
1011
BUILD_DIR := zig-out
1112
CACHE_DIR := .zig-cache
1213
BINARY_NAME := example
@@ -18,14 +19,18 @@ JUNK_FILES := *.o *.obj *.dSYM *.dll *.so *.dylib *.a *.lib *.pdb temp/
1819
EXAMPLES := $(patsubst %.zig,%,$(notdir $(wildcard examples/*.zig)))
1920
EXAMPLE ?= all
2021

22+
# Automatically find all benchmark names
23+
BENCHMARKS := $(patsubst %.zig,%,$(notdir $(wildcard benches/*.zig)))
24+
BENCHMARK ?= all
25+
2126
SHELL := /usr/bin/env bash
2227
.SHELLFLAGS := -eu -o pipefail -c
2328

2429
################################################################################
2530
# Targets
2631
################################################################################
2732

28-
.PHONY: all help build rebuild run test release clean lint format docs serve-docs install-deps setup-hooks test-hooks
33+
.PHONY: all help build rebuild run bench test release clean lint format docs serve-docs install-deps setup-hooks test-hooks
2934
.DEFAULT_GOAL := help
3035

3136
help: ## Show the help messages for all targets
@@ -43,7 +48,7 @@ build: ## Build project (e.g. 'make build BUILD_TYPE=ReleaseSmall' or 'make buil
4348

4449
rebuild: clean build ## clean and build
4550

46-
run: ## Run an example (e.g. 'make run EXAMPLE=sorted_set' or 'make run' to run all examples)
51+
run: ## Run an example (like 'make run EXAMPLE=e1_btree_map' or 'make run' to run all examples)
4752
@if [ "$(EXAMPLE)" = "all" ]; then \
4853
echo "--> Running all examples..."; \
4954
for ex in $(EXAMPLES); do \
@@ -56,6 +61,19 @@ run: ## Run an example (e.g. 'make run EXAMPLE=sorted_set' or 'make run' to run
5661
$(ZIG) build run-$(EXAMPLE) $(BUILD_OPTS); \
5762
fi
5863

64+
bench: ## Run a benchmark (like 'make bench BENCHMARK=b1_btree_map' or 'make run' to run all benchmarks)
65+
@if [ "$(BENCHMARK)" = "all" ]; then \
66+
echo "--> Running all benchmarks..."; \
67+
for ex in $(BENCHMARKS); do \
68+
echo ""; \
69+
echo "--> Running '$$ex'"; \
70+
$(ZIG) build bench-$$ex $(BUILD_OPTS); \
71+
done; \
72+
else \
73+
echo "--> Running benchmark: $(BENCHMARK)"; \
74+
$(ZIG) build bench-$(BENCHMARK) $(BUILD_OPTS); \
75+
fi
76+
5977
test: ## Run tests
6078
@echo "Running tests..."
6179
@$(ZIG) build test $(BUILD_OPTS) -j$(JOBS) $(TEST_FLAGS)

0 commit comments

Comments
 (0)