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
21 changes: 7 additions & 14 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
# Top-most EditorConfig file
root = true

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

# Zig files
[*.zig]
max_line_length = 100

# Markdown files
[*.md]
max_line_length = 120
trim_trailing_whitespace = false # Don't remove trailing whitespace in Markdown files
trim_trailing_whitespace = false

# Bash scripts
[*.sh]
indent_size = 2

# YAML files
[*.{yml,yaml}]
indent_size = 2

# Python files
[*.py]
max_line_length = 100
36 changes: 36 additions & 0 deletions .github/workflows/benches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Run Benchmarks

on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'
pull_request:
branches:
- main

permissions:
contents: read

jobs:
benchmarks:
runs-on: ubuntu-latest

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: '0.15.1'

- name: Install Dependencies
run: |
sudo apt-get update
sudo apt-get install -y make

- name: Run the Benchmarks
run: make bench
5 changes: 2 additions & 3 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
name: Publish API Documentation

on:
workflow_dispatch:
push:
tags:
- 'v*'

workflow_dispatch:

permissions:
contents: write

Expand All @@ -20,7 +19,7 @@ jobs:
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: '0.14.1'
version: '0.15.1'

- name: Install System Dependencies
run: |
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/lints.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: Run Linter Checks

on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'

pull_request:
branches:
- main

workflow_dispatch:

permissions:
contents: read

Expand All @@ -27,7 +23,7 @@ jobs:
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: '0.14.1'
version: '0.15.1'

- name: Install Dependencies
run: |
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
name: Run Tests

on:
workflow_dispatch:
push:
branches:
- main
tags:
- 'v*'

pull_request:
branches:
- main

workflow_dispatch:

permissions:
contents: read

Expand All @@ -27,7 +25,7 @@ jobs:
- name: Install Zig
uses: goto-bus-stop/setup-zig@v2
with:
version: '0.14.1'
version: '0.15.1'

- name: Install Dependencies
run: |
Expand Down
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ repos:
- repo: local
hooks:
- id: format
name: Format the code
name: Format Code
entry: make format
language: system
pass_filenames: false
stages: [ pre-commit ]

- id: lint
name: Check code style
name: Check Code Style
entry: make lint
language: system
pass_filenames: false
stages: [ pre-commit ]

- id: test
name: Run the tests
name: Run Test
entry: make test
language: system
pass_filenames: false
2 changes: 1 addition & 1 deletion CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Code of Conduct
## Code of Conduct

We adhere to the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) version 2.1.
32 changes: 16 additions & 16 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,34 +1,34 @@
# Contribution Guidelines
## Contribution Guidelines

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

## How to Contribute
### How to Contribute

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

### Reporting Bugs
#### Reporting Bugs

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

### Suggesting Features
#### Suggesting Features

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

## Submitting Pull Requests
### Submitting Pull Requests

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

> [!IMPORTANT]
> It's assumed that by submitting a pull request, you agree to license your contributions under the project's license.

## Development Workflow
### Development Workflow

### Prerequisites
#### Prerequisites

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

Expand All @@ -39,22 +39,22 @@ sudo apt-get install make

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

### Code Style
#### Code Style

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

### Running Tests
#### Running Tests

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

### Running Linters
#### Running Linters

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

### See Available Commands
#### See Available Commands

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

## Code of Conduct
### Code of Conduct

We adhere to the [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) version 2.1.
We adhere to the project's [Code of Conduct](CODE_OF_CONDUCT.md).
24 changes: 21 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
# ################################################################################
# # Configuration and Variables
# ################################################################################
ZIG ?= $(shell which zig || echo ~/.local/share/zig/0.14.1/zig)
ZIG ?= $(shell which zig || echo ~/.local/share/zig/0.15.1/zig)
BUILD_TYPE ?= Debug
BUILD_OPTS = -Doptimize=$(BUILD_TYPE)
JOBS ?= $(shell nproc || echo 2)
SRC_DIR := src
EXAMPLES_DIR := examples
BENCHMARKS_DIR:= benches
BUILD_DIR := zig-out
CACHE_DIR := .zig-cache
BINARY_NAME := example
Expand All @@ -18,14 +19,18 @@ JUNK_FILES := *.o *.obj *.dSYM *.dll *.so *.dylib *.a *.lib *.pdb temp/
EXAMPLES := $(patsubst %.zig,%,$(notdir $(wildcard examples/*.zig)))
EXAMPLE ?= all

# Automatically find all benchmark names
BENCHMARKS := $(patsubst %.zig,%,$(notdir $(wildcard benches/*.zig)))
BENCHMARK ?= all

SHELL := /usr/bin/env bash
.SHELLFLAGS := -eu -o pipefail -c

################################################################################
# Targets
################################################################################

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

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

rebuild: clean build ## clean and build

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

bench: ## Run a benchmark (like 'make bench BENCHMARK=b1_btree_map' or 'make run' to run all benchmarks)
@if [ "$(BENCHMARK)" = "all" ]; then \
echo "--> Running all benchmarks..."; \
for ex in $(BENCHMARKS); do \
echo ""; \
echo "--> Running '$$ex'"; \
$(ZIG) build bench-$$ex $(BUILD_OPTS); \
done; \
else \
echo "--> Running benchmark: $(BENCHMARK)"; \
$(ZIG) build bench-$(BENCHMARK) $(BUILD_OPTS); \
fi

test: ## Run tests
@echo "Running tests..."
@$(ZIG) build test $(BUILD_OPTS) -j$(JOBS) $(TEST_FLAGS)
Expand Down
Loading
Loading