-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from github/add-geo_filters
Add scaffolding and geo_filters crate
- Loading branch information
Showing
61 changed files
with
4,874 additions
and
3 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,24 @@ | ||
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu as build | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
RUN apt-get update \ | ||
&& apt install -y --no-install-recommends \ | ||
build-essential \ | ||
ca-certificates \ | ||
clang \ | ||
cmake \ | ||
curl \ | ||
git \ | ||
lldb \ | ||
procps \ | ||
software-properties-common \ | ||
&& apt-get clean -y \ | ||
&& apt-get autoremove -y \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY install-mold.sh . | ||
|
||
RUN ./install-mold.sh | ||
|
||
ENV DEBIAN_FRONTEND=readline |
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,49 @@ | ||
{ | ||
"name": "rust-algos", | ||
"build": { | ||
"dockerfile": "Dockerfile", | ||
"context": "." | ||
}, | ||
"runArgs": [ | ||
"--cap-add=SYS_PTRACE", | ||
"--security-opt", | ||
"seccomp=unconfined", | ||
"--network=host", | ||
"--privileged", | ||
"--init" | ||
], | ||
// Set *default* container specific settings.json values on container create. | ||
"settings": { | ||
"lldb.executable": "/usr/bin/lldb", | ||
// VS Code don't watch files under ./target | ||
"files.watcherExclude": { | ||
"**/target/**": true | ||
} | ||
}, | ||
"features": { | ||
"ghcr.io/devcontainers/features/docker-in-docker:2": { | ||
"version": "latest", | ||
"moby": true, | ||
"dockerDashComposeVersion": "v1", | ||
"installDockerBuildx": true | ||
}, | ||
"ghcr.io/devcontainers/features/rust:1": { | ||
"version": "latest", | ||
"profile": "minimal" | ||
}, | ||
"ghcr.io/devcontainers/features/sshd:1": { | ||
"version": "latest" | ||
}, | ||
"ghcr.io/devcontainers/features/github-cli:1": {} | ||
}, | ||
// Add the IDs of extensions you want installed when the container is created. | ||
"extensions": [ | ||
"tamasfe.even-better-toml", | ||
"matklad.rust-analyzer", | ||
"ms-azuretools.vscode-docker", | ||
"mutantdino.resourcemonitor", | ||
"vadimcn.vscode-lldb", | ||
"visualstudioexptteam.vscodeintellicode", | ||
], | ||
"userEnvProbe": "loginInteractiveShell", | ||
} |
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 @@ | ||
#! /usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
if [ "$(uname -s)" != "Linux" ]; then | ||
echo "mold is linux only, skipping install." | ||
exit 0 | ||
fi | ||
|
||
version=$(wget -q -O- https://api.github.com/repos/rui314/mold/releases/latest | jq -r .tag_name | sed 's/^v//'); true | ||
echo "mold $version" | ||
wget -q -O- https://github.com/rui314/mold/releases/download/v$version/mold-$version-"$(uname -m)"-linux.tar.gz | tar -C /usr/local --strip-components=1 -xzf - | ||
ln -sf /usr/local/bin/mold "$(realpath /usr/bin/ld)"; true |
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,12 @@ | ||
version: 2 | ||
|
||
updates: | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
|
||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" |
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,49 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
|
||
permissions: | ||
contents: read | ||
packages: read | ||
|
||
# In the event that there is a new push to the ref, cancel any running jobs because there are now obsolete, and wasting | ||
# resources. | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: rui314/setup-mold@c9803d2102b7e020ad0ccd687c55b2ad8baf3496 | ||
|
||
- name: Build | ||
run: make build | ||
|
||
lint: | ||
name: Lint | ||
runs-on: ubuntu-latest | ||
needs: build | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: rui314/setup-mold@c9803d2102b7e020ad0ccd687c55b2ad8baf3496 | ||
|
||
- name: Check formatting and clippy | ||
run: make lint | ||
|
||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: rui314/setup-mold@c9803d2102b7e020ad0ccd687c55b2ad8baf3496 | ||
|
||
- name: Run unit tests | ||
run: make test |
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 @@ | ||
Cargo.lock | ||
/target/ | ||
/crates/*/target/ | ||
/crates/*/Cargo.lock | ||
.vscode/ |
Validating CODEOWNERS rules …
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 @@ | ||
* @github/blackbird-reviewers |
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,74 @@ | ||
# Contributor Covenant Code of Conduct | ||
|
||
## Our Pledge | ||
|
||
In the interest of fostering an open and welcoming environment, we as | ||
contributors and maintainers pledge to making participation in our project and | ||
our community a harassment-free experience for everyone, regardless of age, body | ||
size, disability, ethnicity, gender identity and expression, level of experience, | ||
nationality, personal appearance, race, religion, or sexual identity and | ||
orientation. | ||
|
||
## Our Standards | ||
|
||
Examples of behavior that contributes to creating a positive environment | ||
include: | ||
|
||
* Using welcoming and inclusive language | ||
* Being respectful of differing viewpoints and experiences | ||
* Gracefully accepting constructive criticism | ||
* Focusing on what is best for the community | ||
* Showing empathy towards other community members | ||
|
||
Examples of unacceptable behavior by participants include: | ||
|
||
* The use of sexualized language or imagery and unwelcome sexual attention or | ||
advances | ||
* Trolling, insulting/derogatory comments, and personal or political attacks | ||
* Public or private harassment | ||
* Publishing others' private information, such as a physical or electronic | ||
address, without explicit permission | ||
* Other conduct which could reasonably be considered inappropriate in a | ||
professional setting | ||
|
||
## Our Responsibilities | ||
|
||
Project maintainers are responsible for clarifying the standards of acceptable | ||
behavior and are expected to take appropriate and fair corrective action in | ||
response to any instances of unacceptable behavior. | ||
|
||
Project maintainers have the right and responsibility to remove, edit, or | ||
reject comments, commits, code, wiki edits, issues, and other contributions | ||
that are not aligned to this Code of Conduct, or to ban temporarily or | ||
permanently any contributor for other behaviors that they deem inappropriate, | ||
threatening, offensive, or harmful. | ||
|
||
## Scope | ||
|
||
This Code of Conduct applies both within project spaces and in public spaces | ||
when an individual is representing the project or its community. Examples of | ||
representing a project or community include using an official project e-mail | ||
address, posting via an official social media account, or acting as an appointed | ||
representative at an online or offline event. Representation of a project may be | ||
further defined and clarified by project maintainers. | ||
|
||
## Enforcement | ||
|
||
Instances of abusive, harassing, or otherwise unacceptable behavior may be | ||
reported by contacting the project team at [email protected]. All | ||
complaints will be reviewed and investigated and will result in a response that | ||
is deemed necessary and appropriate to the circumstances. The project team is | ||
obligated to maintain confidentiality with regard to the reporter of an incident. | ||
Further details of specific enforcement policies may be posted separately. | ||
|
||
Project maintainers who do not follow or enforce the Code of Conduct in good | ||
faith may face temporary or permanent repercussions as determined by other | ||
members of the project's leadership. | ||
|
||
## Attribution | ||
|
||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, | ||
available at [http://contributor-covenant.org/version/1/4][version] | ||
|
||
[homepage]: http://contributor-covenant.org | ||
[version]: http://contributor-covenant.org/version/1/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,42 @@ | ||
# Contributing | ||
|
||
Hi there! We're thrilled that you'd like to contribute to this project. Your help is essential for keeping it great. | ||
|
||
Contributions to this project are [released](https://help.github.com/articles/github-terms-of-service/#6-contributions-under-repository-license) to the public under the [project's open source license][license]. | ||
|
||
Please note that this project is released with a [Contributor Code of Conduct][code-of-conduct]. By participating in this project you agree to abide by its terms. | ||
|
||
## Prerequisites for running and testing code | ||
|
||
These are one time installations required to be able to test your changes locally as part of the pull request (PR) submission process. | ||
|
||
1. Install Rust [through download](https://www.rust-lang.org/learn/get-started) | [through Homebrew](https://formulae.brew.sh/formula/rustup-init) | ||
|
||
## Submitting a pull request | ||
|
||
1. [Fork][fork] and clone the repository | ||
1. Make sure the tests pass on your machine: `make test` | ||
1. Make sure linter passes on your machine: `make lint` | ||
1. Create a new branch: `git checkout -b my-branch-name` | ||
1. Make your change, add tests, and make sure the tests and linter still pass | ||
1. Push to your fork and [submit a pull request][pr] | ||
1. Pat yourself on the back and wait for your pull request to be reviewed and merged. | ||
|
||
Here are a few things you can do that will increase the likelihood of your pull request being accepted: | ||
|
||
- Follow the [style guide][style]. | ||
- Write tests. | ||
- Keep your change as focused as possible. If there are multiple changes you would like to make that are not dependent upon each other, consider submitting them as separate pull requests. | ||
- Write a [good commit message](http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html). | ||
|
||
## Resources | ||
|
||
- [How to Contribute to Open Source](https://opensource.guide/how-to-contribute/) | ||
- [Using Pull Requests](https://help.github.com/articles/about-pull-requests/) | ||
- [GitHub Help](https://help.github.com) | ||
|
||
[fork]: https://github.com/github/rust-algos/fork | ||
[pr]: https://github.com/github/rust-algos/compare | ||
[style]: https://doc.rust-lang.org/nightly/style-guide/ | ||
[code-of-conduct]: CODE_OF_CONDUCT.md | ||
[license]: LICENSE |
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,12 @@ | ||
[workspace] | ||
|
||
members = [ | ||
"crates/*", | ||
] | ||
resolver = "2" | ||
|
||
[profile.bench] | ||
debug = true | ||
|
||
[profile.release] | ||
debug = true |
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,39 @@ | ||
.PHONY: all | ||
all: build lint test | ||
|
||
.PHONY: clean | ||
clean: | ||
cargo clean | ||
|
||
.PHONY: format | ||
format: | ||
RUST_LOG=error; cargo fmt | ||
|
||
.PHONY: lint | ||
lint: | ||
cargo fmt --all -- --check | ||
# Sadly the clippy team can't seem to figure out how to allow enabling/disabling lints in their config file (https://github.com/rust-lang/cargo/issues/5034) | ||
# So we have to do it with CLI flags. | ||
cargo clippy -- --no-deps --deny warnings -D clippy::unwrap_used | ||
cargo clippy --tests -- --no-deps --deny warnings -A clippy::unwrap_used | ||
|
||
.PHONY: build | ||
build: | ||
# Use --all-targets to ensure that all of the benchmarks compile. | ||
cargo build --all-targets --all-features | ||
|
||
.PHONY: test | ||
test: | ||
RUST_BACKTRACE=1 cargo test | ||
# Amazingly, `--all-targets` causes doc-tests not to run. | ||
RUST_BACKTRACE=1 cargo test --doc | ||
|
||
.PHONY: test-ignored | ||
test-ignored: | ||
# This is how Rust suggests skipping expensive tests unless you really want them to run: | ||
# https://doc.rust-lang.org/book/ch11-02-running-tests.html#ignoring-some-tests-unless-specifically-requested | ||
cargo test -- --ignored | ||
|
||
.PHONY: build-release | ||
build-release: | ||
cargo build --release |
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 |
---|---|---|
@@ -1,2 +1,21 @@ | ||
# rust-gems | ||
A collection of rust algorithms and data structures | ||
# Rust Algorithms | ||
|
||
A collection of useful algorithms written in Rust. Currently contains: | ||
|
||
- [`geo_filters`](crates/geo_filters): probabilistic data structures that solve the [Distinct Count Problem](https://en.wikipedia.org/wiki/Count-distinct_problem) using geometric filters. | ||
|
||
## Background | ||
|
||
**Rust Algorithms** is under active development and maintained by GitHub staff **AND THE COMMUNITY**. | ||
See [CODEOWNERS](CODEOWNERS) for more details. | ||
|
||
We will do our best to respond to support, feature requests, and community questions in a timely manner. | ||
For more details see [support](SUPPORT.md) and [contribution](CONTRIBUTING.md) guidelines. | ||
|
||
## Requirements | ||
|
||
Requires a working installation of Rust [through download](https://www.rust-lang.org/learn/get-started) | [through Homebrew](https://formulae.brew.sh/formula/rustup-init) | ||
|
||
## License | ||
|
||
This project is licensed under the terms of the MIT open source license. Please refer to [MIT](LICENSE) for the full terms. |
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 @@ | ||
Thanks for helping make GitHub safe for everyone. | ||
|
||
# Security | ||
|
||
GitHub takes the security of our software products and services seriously, including all of the open source code repositories managed through our GitHub organizations, such as [GitHub](https://github.com/GitHub). | ||
|
||
Even though [open source repositories are outside of the scope of our bug bounty program](https://bounty.github.com/index.html#scope) and therefore not eligible for bounty rewards, we will ensure that your finding gets passed along to the appropriate maintainers for remediation. | ||
|
||
## Reporting Security Issues | ||
|
||
If you believe you have found a security vulnerability in any GitHub-owned repository, please report it to us through coordinated disclosure. | ||
|
||
**Please do not report security vulnerabilities through public GitHub issues, discussions, or pull requests.** | ||
|
||
Instead, please send an email to opensource-security[@]github.com. | ||
|
||
Please include as much of the information listed below as you can to help us better understand and resolve the issue: | ||
|
||
* The type of issue (e.g., buffer overflow, SQL injection, or cross-site scripting) | ||
* Full paths of source file(s) related to the manifestation of the issue | ||
* The location of the affected source code (tag/branch/commit or direct URL) | ||
* Any special configuration required to reproduce the issue | ||
* Step-by-step instructions to reproduce the issue | ||
* Proof-of-concept or exploit code (if possible) | ||
* Impact of the issue, including how an attacker might exploit the issue | ||
|
||
This information will help us triage your report more quickly. | ||
|
||
## Policy | ||
|
||
See [GitHub's Safe Harbor Policy](https://docs.github.com/en/site-policy/security-policies/github-bug-bounty-program-legal-safe-harbor#1-safe-harbor-terms) |
Oops, something went wrong.