Skip to content

Commit

Permalink
chore(rust): Make a single workspace and remove all workspace depende…
Browse files Browse the repository at this point in the history
…cies. (#12)

* chore(rust): Make a single workspace and remove all workspace dependencies.  Update rust toolchain.

* fix(rust/c509-certificate): Try and fix cargo.toml lint error

* fix(rust): Fix clippy.toml missing entry

* fix(rust/cbork): Copy cbork crates into builder properly

* fix(rust/cbork): Fix package now

* fix(rust/cbork): Fix cddl_parser library use statements

* fix(rust/cbork): Code format

* fix(rust/c509-certificate): Fix wasm library build for c509-certificate

* fix(rust/c509-certificate): Remove obsolete Earthfile

* feat(rust/hermes-ipfs): Fix doc comment formatting

* fix(rust/cbork): Fix cbork abnf parser module name

* fix(rust): Fix spelling mistake

* fix(rust): Add dev convenience helpers in a Justfile

* feat(general): Add command to sort the project spelling words list correctly

* fix(general): Fix project dictionary sorting

* feat(general): Add justfile for developer convenience and suggested pre-push hook that uses it.

* fix(rust/c509-certificate): Remove redundant errors file from cbork crate

* fix(rust/cbork): Add target which just exports the cbork executable we built.

* fix(rust): Build everything in the workspace, including docs.

* fix(rust/c509-certificate): Build js/wasm interop versions of c509 library, and export them.

* fix: c509 file name (#13)

* fix: move new c509 from cat-voice

* fix: revert file

* fix: revert file

* fix: revert file

* fix: format

* fix: typo

---------

Co-authored-by: Steven Johnson <[email protected]>

* fix(general): Make it required that pull requests need Scopes (to support proper auto-generation of changelogs).

* fix(rust): Bump rust cat-ci version to release v3.2.00

* fix(rust): Make Cargo.toml more uniform, and refer to the about-to-be tagged version of the repo

* fix(rust/cardano-chain-follower): Give the chain follower crate an explicit version.

---------

Co-authored-by: bkioshn <[email protected]>
  • Loading branch information
stevenj and bkioshn authored Sep 4, 2024
1 parent e8cd7c3 commit e835e1c
Show file tree
Hide file tree
Showing 162 changed files with 381 additions and 1,068 deletions.
28 changes: 14 additions & 14 deletions .config/dictionaries/project.dic
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
aarch
abnf
ABNF
abnf
addrr
adminer
anypolicy
Expand All @@ -21,13 +21,13 @@ bootstrapper
BROTLI
cantopen
cardano
cbor
CBOR
cbor
cbork
cdylib
CEST
chaincode
CHAINCODE
chaincode
chainsync
childs
Chotivichit
Expand All @@ -50,18 +50,18 @@ DBSTATUS
dbsync
dcbor
delegators
Dominik
dockerhub
Dominik
dotenv
dotenvy
dotglob
drep
dreps
earthfile
Earthfile
earthfile
encryptor
Eternl
Errno
Eternl
excalidraw
fadvise
fcntl
Expand Down Expand Up @@ -119,10 +119,10 @@ localizable
lookaside
maindbname
mapref
Metadatum
metadatum
mdlint
mdns
Metadatum
metadatum
minicbor
miniprotocol
miniprotocols
Expand Down Expand Up @@ -181,8 +181,8 @@ reqwest
retriggering
rlib
rulelist
rulename
RULENAME
rulename
runable
rustc
rustdoc
Expand Down Expand Up @@ -211,8 +211,8 @@ tacho
testcase
testcov
testdocs
testunit
testplan
testunit
thiserror
timelike
timespec
Expand All @@ -228,16 +228,16 @@ unixfs
unlinkat
upnp
userid
UTXO
utimensat
UTXO
vitss
Vkey
vkey
vkeywitness
voteplan
voteplans
wasi
WASI
wasi
wasip
wasip
wasip
Expand All @@ -247,7 +247,7 @@ webassembly
webpki
WORKDIR
xprivate
xprv
XPRV
xprv
xpub
yoroi
yoroi
1 change: 1 addition & 0 deletions .github/workflows/semantic_pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
name: Validate PR title
uses: input-output-hk/catalyst-ci/.github/workflows/semantic_pull_request.yml@master
with:
requireScope: true
scopes: |
rust
rust/c509-certificate
Expand Down
12 changes: 10 additions & 2 deletions Earthfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.1.24 AS mdlint-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.1.24 AS cspell-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/mdlint:v3.2.00 AS mdlint-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/cspell:v3.2.00 AS cspell-ci

FROM debian:stable-slim

Expand All @@ -15,6 +15,14 @@ markdown-check-fix:

DO mdlint-ci+MDLINT_LOCALLY --src=$(echo ${PWD}) --fix=--fix

# Make sure the project dictionary is properly sorted.
clean-spelling-list:
COPY .config/dictionaries/project.dic project.dic
RUN sort -d -f project.dic > new.dic
IF ! diff -q project.dic new.dic
SAVE ARTIFACT new.dic AS LOCAL .config/dictionaries/project.dic
END

# check-spelling : Check spelling in this repo inside a container.
check-spelling:
DO cspell-ci+CHECK
Expand Down
20 changes: 20 additions & 0 deletions Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# use with https://github.com/casey/just
#
# Developer convenience functions

default:
@just --list --unsorted

# Fix and Check Markdown files
check-markdown:
earthly +markdown-check-fix

# Check Spelling
check-spelling:
earthly +clean-spelling-list
earthly +check-spelling


# Pre Push Checks - intended to be run by a git pre-push hook.
pre-push: check-markdown check-spelling
just rust/pre-push
2 changes: 1 addition & 1 deletion docs/Earthfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.1.21 AS docs-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/docs:v3.2.00 AS docs-ci

IMPORT .. AS repo

Expand Down
7 changes: 7 additions & 0 deletions git_hooks/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Sample .git hooks

This directory contains sample git-hooks which can be used to improve the workflow of a developer.

Simply copy these to your .git/hooks folder and make them executable.

They can further be customized by editing them to suit your needs.
34 changes: 34 additions & 0 deletions git_hooks/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/bin/sh

# An example hook script to verify what is about to be pushed. Called by "git
# push" after it has checked the remote status, but before anything has been
# pushed. If this script exits with a non-zero status nothing will be pushed.
#
# This hook is called with the following parameters:
#
# $1 -- Name of the remote to which the push is being done
# $2 -- URL to which the push is being done
#
# If pushing without using a named remote those arguments will be equal.
#
# Information about the commits which are being pushed is supplied as lines to
# the standard input in the form:
#
# <local ref> <local oid> <remote ref> <remote oid>
#
# This Shows how we run basic checks which will fail in CI to speed up development and
# catch things which will fail immediately sooner.

remote="$1"
url="$2"

# Redirect output to stderr.
exec 1>&2

# Check for Noisy CI Issues before Pushing
if ! just pre-push; then
echo >&2 "Found CI Issues, not pushing"
exit 1
fi

exit 0
67 changes: 8 additions & 59 deletions rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
[workspace]
resolver = "2"
members = ["c509-certificate", "cardano-chain-follower", "hermes-ipfs"]
members = [
"c509-certificate",
"cardano-chain-follower",
"hermes-ipfs",
"cbork",
"cbork-abnf-parser",
"cbork-cddl-parser",
]

[workspace.package]
edition = "2021"
version = "0.0.1"
authors = ["Steven Johnson <[email protected]>"]
homepage = "https://github.com/input-output-hk/catalyst-libs"
repository = "https://github.com/input-output-hk/catalyst-libs"
Expand Down Expand Up @@ -45,60 +51,3 @@ string_slice = "deny"
unchecked_duration_subtraction = "deny"
unreachable = "deny"
missing_docs_in_private_items = "deny"

[workspace.dependencies]
pallas = { git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "709acb19c52c6b789279ecc4bc8793b5d8b5abe9", version = "0.25.0" }
pallas-hardano = { git = "https://github.com/input-output-hk/catalyst-pallas.git", rev = "709acb19c52c6b789279ecc4bc8793b5d8b5abe9", version = "0.25.0" }

wasmtime = "20.0.2"
rusty_ulid = "2.0.0"
anyhow = "1.0.71"
hex-literal = "0.4.1"
thiserror = "1.0.56"
hex = "0.4.3"
tracing = "0.1.40"
tracing-subscriber = { version = "0.3.18", features = ["env-filter"] }
criterion = "0.5.1"
libtest-mimic = "0.7.0"
crossbeam-queue = "0.3.11"
bip39 = "2.0.0"
iana-time-zone = "0.1.60"
rand = "0.8.5"
bip32 = "0.5.1"
ed25519-bip32 = "0.4.1"
dashmap = "6.0.1"
once_cell = "1.19.0"
clap = "4.5.3"
build-info = "0.0.37"
build-info-build = "0.0.37"
derive_more = "0.99.17"
chrono = "0.4.35"
chrono-tz = "0.9.0"
saffron = "0.1.0"
tokio = "1.36.0"
libsqlite3-sys = "0.29.0"
stringzilla = "3.8.4"
serial_test = { version = "3.1.1", features = ["file_locks"] }
temp-dir = "0.1.13"
hdf5 = { git = "https://github.com/aldanor/hdf5-rust.git", rev = "694e900972fbf5ffbdd1a2294f57a2cc3a91c994", version = "0.8.1", features = [
"static",
"blosc",
] }
blosc-src = { version = "0.3.0", features = ["lz4", "zlib", "zstd"] }
num_cpus = "1.16.0"
console = "0.15.8"
serde = "1.0"
serde_json = "1.0"
jsonschema = "0.18.0"
hmac = "0.12.1"
pbkdf2 = "0.12.2"
blake2b_simd = "1.0.2"
sha2 = "0.10"
ed25519-dalek = "2.1.1"
x509-cert = "0.2.5"
coset = "0.3.7"
libipld = "0.16.0"
rust-ipfs = "0.11.21"
rustyline-async = "0.4.2"
dirs = "5.0.1"
lipsum = "0.9.1"
22 changes: 17 additions & 5 deletions rust/Earthfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
VERSION 0.8

IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.1.21 AS rust-ci
IMPORT github.com/input-output-hk/catalyst-ci/earthly/rust:v3.2.00 AS rust-ci

# Use when debugging cat-ci locally.
# IMPORT ../../catalyst-ci/earthly/rust AS rust-ci

# builder : Set up our target toolchains, and copy our files.
builder:
DO rust-ci+SETUP

COPY Cargo.toml clippy.toml deny.toml rustfmt.toml .
COPY --dir .cargo .config c509-certificate cardano-chain-follower cbork hermes-ipfs .
COPY --dir .cargo .config c509-certificate cardano-chain-follower \
cbork cbork-abnf-parser cbork-cddl-parser \
hermes-ipfs .

# check : Run basic check.
check:
Expand All @@ -21,11 +26,18 @@ build:

DO rust-ci+EXECUTE \
--cmd="/scripts/std_build.py" \
--output="release/[^\./]+" \
--args1="--libs=c509-certificate" \
--args2="--libs=cardano-chain-follower" \
--args3="--libs=cbork" \
--args4="--libs=hermes-ipfs" \
--docs="false"
--args3="--libs=cbork-cddl-parser" \
--args4="--libs=cbork-abnf-parser" \
--args5="--libs=hermes-ipfs" \
--args6="--bins=cbork/cbork" \
--docs="true"

SAVE ARTIFACT target/$TARGETARCH/doc doc
SAVE ARTIFACT target/release/cbork cbork


# local-ci-run: This step simulates the full CI run for local purposes only.
local-ci-run:
Expand Down
29 changes: 29 additions & 0 deletions rust/Justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# use with https://github.com/casey/just
#
# Hermes developer convenience functions

# cspell: words prereqs, commitlog, rustls, nocapture

default:
@just --list --unsorted

# Show the dependency tree and all enabled feature flags of every crate.
cargo-tree:
cargo tree -e features,normal,build -f "{p}[{f}]" --workspace --frozen

# Check Dependency licenses and CVE's
license-check:
cargo deny check --exclude-dev

# Format the rust code
code-format:
cargo +nightly fmtfix
cargo +nightly fmtchk

# Lint the rust code
code-lint:
cargo lintfix
cargo lint

# Pre Push Checks
pre-push: code-format code-lint license-check
Loading

0 comments on commit e835e1c

Please sign in to comment.