Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolausWest authored Jan 6, 2025
0 parents commit 2abd4b8
Show file tree
Hide file tree
Showing 40 changed files with 7,360 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
BasedOnStyle: Google

# Make it slightly more similar to Rust.
# Based loosely on https://gist.github.com/YodaEmbedding/c2c77dc693d11f3734d78489f9a6eea4
AccessModifierOffset: -2
AlignAfterOpenBracket: BlockIndent
AllowAllArgumentsOnNextLine: false
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: Empty
AllowShortIfStatementsOnASingleLine: Never
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
BinPackArguments: false
BreakStringLiterals: false
ColumnLimit: 100
ContinuationIndentWidth: 4
DerivePointerAlignment: false
EmptyLineBeforeAccessModifier: LogicalBlock
IndentWidth: 4
IndentWrappedFunctionNames: true
InsertBraces: true
InsertTrailingCommas: Wrapped
MaxEmptyLinesToKeep: 1
NamespaceIndentation: All
PointerAlignment: Left
ReflowComments: false
SeparateDefinitionBlocks: Always
SpacesBeforeTrailingComments: 1

# Don't change include blocks, we want to control this manually.
# Sorting headers however is allowed as all our headers should be standalone.
IncludeBlocks: Preserve
SortIncludes: CaseInsensitive
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text=auto eol=lf
Cargo.lock linguist-generated=false
13 changes: 13 additions & 0 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!--
* Keep your PR:s small and focused.
* The PR title is what ends up in the changelog, so make it descriptive!
* If applicable, add a screenshot or gif.
* Do NOT open PR:s from your `main` branch, as that makes it hard for maintainers to test and add commits to your PR.
* Remember to run `cargo fmt` and `cargo clippy`.
* Open the PR as a draft until you have self-reviewed it and it passes CI.
* When you have addressed a PR comment, mark it as resolved.
Please be patient!
-->

* Closes #ISSUE_NUMBER
17 changes: 17 additions & 0 deletions .github/workflows/cargo_machete.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Cargo Machete

on:
push:
branches:
- "main"
pull_request:
types: [opened, synchronize]

jobs:
cargo-machete:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Machete
run: cargo install cargo-machete --locked && cargo machete
25 changes: 25 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copied from https://github.com/rerun-io/rerun_template
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: C++

jobs:
cpp-check:
name: C++
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.26.1
cache: true

- run: pixi run build

- run: pixi run cpp-fmt-check
34 changes: 34 additions & 0 deletions .github/workflows/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copied from https://github.com/rerun-io/rerun_template

# https://github.com/marketplace/actions/require-labels
# Check for existence of labels
# See all our labels at https://github.com/rerun-io/rerun/issues/labels

name: PR Labels

on:
pull_request:
types:
- opened
- synchronize
- reopened
- labeled
- unlabeled

jobs:
label:
runs-on: ubuntu-latest
steps:
- name: Check for a "do-not-merge" label
uses: mheap/github-action-required-labels@v3
with:
mode: exactly
count: 0
labels: "do-not-merge"

- name: Require label "include in changelog" or "exclude from changelog"
uses: mheap/github-action-required-labels@v3
with:
mode: minimum
count: 1
labels: "exclude from changelog, include in changelog"
34 changes: 34 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Copied from https://github.com/rerun-io/rerun_template
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: Link checker

jobs:
link-checker:
name: Check links
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore link checker cache
uses: actions/cache@v3
with:
path: .lycheecache
key: cache-lychee-${{ github.sha }}
restore-keys: cache-lychee-

# Check https://github.com/lycheeverse/lychee on how to run locally.
- name: Link Checker
id: lychee
uses: lycheeverse/[email protected]
with:
fail: true
lycheeVersion: "0.14.3"
# When given a directory, lychee checks only markdown, html and text files, everything else we have to glob in manually.
args: |
--base . --cache --max-cache-age 1d . "**/*.rs" "**/*.toml" "**/*.hpp" "**/*.cpp" "**/CMakeLists.txt" "**/*.py" "**/*.yml"
25 changes: 25 additions & 0 deletions .github/workflows/python.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copied from https://github.com/rerun-io/rerun_template
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: C++

jobs:
python-check:
name: Python
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: prefix-dev/[email protected]
with:
pixi-version: v0.26.1
cache: true

- run: pixi run py-fmt-check

- run: pixi run py-lint
140 changes: 140 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
# Copied from https://github.com/rerun-io/rerun_template
on:
push:
branches:
- "main"
pull_request:
types: [ opened, synchronize ]

name: Rust

env:
RUSTFLAGS: -D warnings
RUSTDOCFLAGS: -D warnings

jobs:
rust-check:
name: Rust
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- uses: actions-rs/toolchain@v1
with:
profile: default
toolchain: 1.80.0
override: true

- name: Install packages (Linux)
if: runner.os == 'Linux' && false # TODO: enable if eframe is part of the project, otherwise remove
uses: awalsh128/[email protected]
with:
# some deps used by eframe, if that is part of the project
packages: libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libxkbcommon-dev libssl-dev # libgtk-3-dev is used by rfd
version: 1.0
execute_install_scripts: true

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check

- name: check --all-features
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --all-targets

- name: check default features
uses: actions-rs/cargo@v1
with:
command: check
args: --all-targets

- name: check --no-default-features
uses: actions-rs/cargo@v1
with:
command: check
args: --no-default-features --lib --all-targets

- name: Test doc-tests
uses: actions-rs/cargo@v1
with:
command: test
args: --doc --all-features

- name: cargo doc --lib
uses: actions-rs/cargo@v1
with:
command: doc
args: --lib --no-deps --all-features

- name: cargo doc --document-private-items
uses: actions-rs/cargo@v1
with:
command: doc
args: --document-private-items --no-deps --all-features

- name: Build tests
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --no-run

- name: Run test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-targets --all-features -- -D warnings

# ---------------------------------------------------------------------------

check_wasm:
name: Check wasm32
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.80.0
target: wasm32-unknown-unknown
override: true
components: clippy

- name: Set up cargo cache
uses: Swatinem/rust-cache@v2

- name: Check wasm32
uses: actions-rs/cargo@v1
with:
command: check
args: --target wasm32-unknown-unknown --lib

- name: Clippy wasm32
env:
CLIPPY_CONF_DIR: "scripts/clippy_wasm" # Use scripts/clippy_wasm/clippy.toml
run: cargo clippy --target wasm32-unknown-unknown --lib -- -D warnings

# ---------------------------------------------------------------------------

cargo-deny:
name: Check Rust dependencies (cargo-deny)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: EmbarkStudios/cargo-deny-action@v1
with:
rust-version: "1.80.0"
log-level: warn
command: check
19 changes: 19 additions & 0 deletions .github/workflows/typos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Copied from https://github.com/rerun-io/rerun_template

# https://github.com/crate-ci/typos
# Add exceptions to `.typos.toml`
# install and run locally: cargo install typos-cli && typos

name: Spell Check
on: [pull_request]

jobs:
run:
name: Spell Check
runs-on: ubuntu-latest
steps:
- name: Checkout Actions Repository
uses: actions/checkout@v4

- name: Check spelling of entire workspace
uses: crate-ci/typos@master
22 changes: 22 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Mac stuff:
.DS_Store

# C++ build directory
build

# Rust compile target directories:
target
target_ra
target_wasm

# https://github.com/lycheeverse/lychee
.lycheecache

# Pixi environment
.pixi

# Python stuff:
__pycache__
.mypy_cache
.ruff_cache
venv
11 changes: 11 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[mypy]
files = .
exclude = build
namespace_packages = True
show_error_codes = True
strict = True
enable_error_code = redundant-expr, truthy-bool, ignore-without-code
; plugins = numpy.typing.mypy_plugin
ignore_missing_imports = True
no_implicit_reexport = False
disallow_untyped_calls = False
6 changes: 6 additions & 0 deletions .typos.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# https://github.com/crate-ci/typos
# install: cargo install typos-cli
# run: typos

[default.extend-words]
teh = "teh" # part of @teh-cmc
Loading

0 comments on commit 2abd4b8

Please sign in to comment.