-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
312 additions
and
149 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,20 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "cargo" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "monday" | ||
time: "05:00" | ||
timezone: "US/Pacific" | ||
groups: | ||
rust-dependencies: | ||
patterns: | ||
- "*" | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
schedule: | ||
interval: "weekly" | ||
day: "monday" | ||
time: "05:00" | ||
timezone: "US/Pacific" |
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,72 @@ | ||
# This is mostly copied from the rust-analyzer repo | ||
# https://github.com/rust-lang/rust-analyzer/blob/12e7aa3132217cc6a6c1151d468be35d7b365999/.github/workflows/ci.yaml | ||
|
||
name: Rust CI | ||
on: | ||
pull_request: | ||
types: [opened, reopened, synchronize, labeled] | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_INCREMENTAL: 0 | ||
CARGO_NET_RETRY: 10 | ||
CI: 1 | ||
RUST_BACKTRACE: short | ||
RUSTFLAGS: "-D warnings -W unreachable-pub -W bare-trait-objects" | ||
RUSTUP_MAX_RETRIES: 10 | ||
|
||
jobs: | ||
rust: | ||
name: Rust CI | ||
timeout-minutes: 20 | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
working-directory: ./ | ||
#permissions: | ||
#contents: read | ||
#actions: read | ||
#pull-requests: read | ||
env: | ||
#CC: deny_c | ||
RUST_CHANNEL: 'stable' | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [ubuntu-latest-m] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Install Just | ||
run: sudo snap install --edge --classic just | ||
|
||
- name: Install Rust toolchain | ||
run: | | ||
rustup update --no-self-update ${{ env.RUST_CHANNEL }} | ||
rustup component add --toolchain ${{ env.RUST_CHANNEL }} rustfmt rust-src | ||
rustup default ${{ env.RUST_CHANNEL }} | ||
- name: Cache Dependencies | ||
uses: Swatinem/rust-cache@v2 | ||
with: | ||
workspaces: "rust -> target" | ||
key: ${{ env.RUST_CHANNEL }} | ||
|
||
- name: Install cargo-deny | ||
run: cargo install --locked cargo-deny | ||
|
||
- name: Check | ||
if: matrix.os == 'ubuntu-latest-m' || github.event_name == 'push' | ||
env: | ||
AWS_ACCESS_KEY_ID: minio123 | ||
AWS_SECRET_ACCESS_KEY: minio123 | ||
AWS_DEFAULT_REGION: "us-east-1" | ||
run: | | ||
just pre-commit |
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,37 @@ | ||
alias fmt := format | ||
alias pre := pre-commit | ||
|
||
# run all tests | ||
test *args='': | ||
cargo test {{args}} | ||
|
||
# compile but don't run all tests | ||
compile-tests *args='': | ||
cargo test --no-run {{args}} | ||
|
||
# build debug version | ||
build *args='': | ||
cargo build {{args}} | ||
|
||
# build release version | ||
build-release *args='': | ||
cargo build --release {{args}} | ||
|
||
# run clippy | ||
lint *args='': | ||
cargo clippy --all-targets --all-features {{args}} | ||
|
||
# reformat all rust files | ||
format *args='': | ||
cargo fmt --all {{args}} | ||
|
||
# reformat all nix files | ||
format-nix *args='': | ||
alejandra . | ||
|
||
# run cargo deny to check dependencies | ||
check-deps *args='': | ||
cargo deny --all-features check {{args}} | ||
|
||
# run all checks that CI actions will run | ||
pre-commit: (compile-tests "--locked") build (format "--check") lint test check-deps |
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,68 @@ | ||
[graph] | ||
all-features = true | ||
|
||
[advisories] | ||
version = 2 | ||
|
||
[licenses] | ||
# List of explicitly allowed licenses | ||
# See https://spdx.org/licenses/ for list of possible licenses | ||
# [possible values: any SPDX 3.11 short identifier (+ optional exception)]. | ||
# This list was generated using: | ||
# https://github.com/earth-mover/arraylake/pull/1067/files | ||
allow = [ | ||
"MIT", | ||
"Apache-2.0", | ||
"BSD-2-Clause", | ||
"BSD-3-Clause", | ||
"MPL-2.0", | ||
"ISC", | ||
"OpenSSL", | ||
"Unicode-DFS-2016", | ||
"CC0-1.0", | ||
] | ||
# The confidence threshold for detecting a license from license text. | ||
# The higher the value, the more closely the license text must be to the | ||
# canonical license text of a valid SPDX license file. | ||
# [possible values: any between 0.0 and 1.0]. | ||
confidence-threshold = 0.8 | ||
# Allow 1 or more licenses on a per-crate basis, so that particular licenses | ||
# aren't accepted for every possible crate as with the normal allow list | ||
exceptions = [ | ||
# Each entry is the crate and version constraint, and its specific allow | ||
# list | ||
#{ allow = ["Zlib"], name = "adler32", version = "*" }, | ||
] | ||
|
||
[licenses.private] | ||
ignore = true | ||
|
||
[[licenses.clarify]] | ||
name = "ring" | ||
expression = "MIT AND ISC AND OpenSSL" | ||
license-files = [ | ||
# Each entry is a crate relative path, and the (opaque) hash of its contents | ||
{ path = "LICENSE", hash = 0xbd0eed23 }, | ||
] | ||
|
||
|
||
[bans] | ||
# Lint level for when multiple versions of the same crate are detected | ||
multiple-versions = "warn" | ||
# Lint level for when a crate version requirement is `*` | ||
wildcards = "warn" | ||
workspace-default-features = "allow" | ||
external-default-features = "allow" | ||
allow = [ | ||
#{ name = "ansi_term", version = "=0.11.0" }, | ||
] | ||
# List of crates to deny | ||
deny = [ | ||
# Each entry the name of a crate and a version range. If version is | ||
# not specified, all versions will be matched. | ||
#{ name = "ansi_term", version = "=0.11.0" }, | ||
# | ||
# Wrapper crates can optionally be specified to allow the crate when it | ||
# is a direct dependency of the otherwise banned crate | ||
#{ name = "ansi_term", version = "=0.11.0", wrappers = [] }, | ||
] |
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 @@ | ||
max_width = 90 | ||
use_small_heuristics = "Max" |
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,43 +1,42 @@ | ||
let | ||
# Pinned nixpkgs, deterministic. Last updated to nixpkgs-unstable as of: 2024-07-23 | ||
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/68c9ed8bbed9dfce253cc91560bf9043297ef2fe.tar.gz") {}; | ||
# Pinned nixpkgs, deterministic. Last updated to nixpkgs-unstable as of: 2024-07-23 | ||
pkgs = import (fetchTarball "https://github.com/NixOS/nixpkgs/archive/68c9ed8bbed9dfce253cc91560bf9043297ef2fe.tar.gz") {}; | ||
|
||
# Rolling updates, not deterministic. | ||
# pkgs = import (fetchTarball("channel:nixpkgs-unstable")) {}; | ||
|
||
# Rolling updates, not deterministic. | ||
# pkgs = import (fetchTarball("channel:nixpkgs-unstable")) {}; | ||
|
||
alejandra = | ||
(import (builtins.fetchTarball { | ||
url = "https://github.com/kamadorueda/alejandra/tarball/3.0.0"; | ||
sha256 = "sha256:18jm0d5xrxk38hw5sa470zgfz9xzdcyaskjhgjwhnmzd5fgacny4"; | ||
}) {}) | ||
.outPath; | ||
alejandra = | ||
(import (builtins.fetchTarball { | ||
url = "https://github.com/kamadorueda/alejandra/tarball/3.0.0"; | ||
sha256 = "sha256:18jm0d5xrxk38hw5sa470zgfz9xzdcyaskjhgjwhnmzd5fgacny4"; | ||
}) {}) | ||
.outPath; | ||
in | ||
pkgs.mkShell.override { | ||
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv; | ||
} { | ||
packages = with pkgs; [ | ||
rustc | ||
pkgs.mkShell.override { | ||
stdenv = pkgs.stdenvAdapters.useMoldLinker pkgs.clangStdenv; | ||
} { | ||
packages = with pkgs; [ | ||
rustc | ||
cargo | ||
cargo-watch | ||
cargo-nextest # test runner | ||
cargo-nextest # test runner | ||
cargo-deny | ||
rust-analyzer # rust lsp server | ||
rust-analyzer # rust lsp server | ||
rustfmt | ||
clippy | ||
taplo # toml lsp server | ||
taplo # toml lsp server | ||
|
||
awscli2 | ||
just # script launcher with a make flavor | ||
alejandra # nix code formatter | ||
]; | ||
just # script launcher with a make flavor | ||
alejandra # nix code formatter | ||
]; | ||
|
||
shellHook = '' | ||
export PYTHONPATH=".:$PYTHONPATH" | ||
shellHook = '' | ||
export PYTHONPATH=".:$PYTHONPATH" | ||
export AWS_ACCESS_KEY_ID=minio123 | ||
export AWS_SECRET_ACCESS_KEY=minio123 | ||
export AWS_DEFAULT_REGION=us-east-1 | ||
export RUSTFLAGS="-W unreachable-pub -W bare-trait-objects" | ||
export AWS_ACCESS_KEY_ID=minio123 | ||
export AWS_SECRET_ACCESS_KEY=minio123 | ||
export AWS_DEFAULT_REGION=us-east-1 | ||
export RUSTFLAGS="-W unreachable-pub -W bare-trait-objects" | ||
''; | ||
} | ||
} |
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
Oops, something went wrong.