Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(rust)::> Github Workflow to verify new crates that are being introduced #8266

Merged
merged 2 commits into from
Aug 2, 2024
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
183 changes: 183 additions & 0 deletions .github/workflows/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,186 @@ jobs:
git diff;
exit 1; \
}

check_crates:
runs-on: ubuntu-latest
name: All - check_crates
steps:
- name: Checkout code
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y jq

- name: Install Rust
uses: actions-rs/toolchain@88dc2356392166efad76775c878094f4e83ff746
with:
toolchain: stable
profile: minimal
override: true

- name: Install tomlq
run: cargo install --locked tomlq --version 0.1.0

- name: Check for CHANGELOG.md
run: |
for crate in $(find implementations/rust/ockam -name Cargo.toml); do

dir=$(dirname $crate)
if [ ! -f "$dir/CHANGELOG.md" ]; then
echo "Error: $dir/CHANGELOG.md is missing"
exit 1
fi
done

- name: Check for README.md
run: |
for crate in $(find implementations/rust/ockam -name Cargo.toml); do

dir=$(dirname $crate)
if [ ! -f "$dir/README.md" ]; then
echo "Error: $dir/README.md is missing"
exit 1
fi
done

- name: Validate Cargo.toml categories
run: |
allowed_categories="
accessibility
aerospace
drones
protocols
simulation
space-protocols
unmanned-aerial-vehicles
algorithms
api-bindings
asynchronous
authentication
caching
command-line-interface
command-line-utilities
compilers
compression
computer-vision
concurrency
config
cryptography
cryptocurrencies
data-structures
database
database-implementations
date-and-time
development-tools
build-utils
cargo-plugins
debugging
ffi
procedural-macro-helpers
profiling
testing
email
embedded
emulators
encoding
external-ffi-bindings
filesystem
finance
game-development
game-engines
games
graphics
gui
hardware-support
internationalization
localization
mathematics
memory-management
multimedia
audio
encoding
images
video
network-programming
no-std
no-std::no-alloc
os
android-apis
freebsd-apis
linux-apis
macos-apis
unix-apis
windows-apis
parser-implementations
parsing
rendering
rendering::data-formats
rendering::engine
rendering::graphics-api
rust-patterns
science
bioinformatics
genomics
proteomics
sequence-analysis
geo
neuroscience
robotics
simulation
template-engine
text-editors
text-processing
value-formatting
virtualization
visualization
wasm
web-programming
http-client
http-server
websocket
"

for crate in $(find implementations/rust/ockam -name Cargo.toml); do

categories=$(tomlq package.categories -f "$crate" | jq -r '.[]')
for category in $categories; do
if ! echo "$allowed_categories" | grep -q "$category"; then
echo "Error: $crate contains invalid category $category"
exit 1
fi
done
done

- name: Check Cargo.toml To Ensure That All 3rd Party Crates Have Specified Versions
run: |
set -ex
cargo install [email protected]

regex="^[\^|=]*[0-9]+(\.[0-9]+)*(\.[0-9]+)*"

for crate in $(find implementations/rust/ockam -name Cargo.toml); do

deps=$(toml2json <<< cat "$crate" | jq -r '.dependencies')
dev_deps=$(toml2json <<< cat "$crate" | jq -r ".\"dev-dependencies\"")
dependencies=$(echo "$deps $dev_deps" | jq -s add)

dependencies=$(toml2json <<< cat "$crate" | jq -r '.dependencies')
dependencies_keys=$(echo $dependencies | jq -r 'keys')
dependencies_keys_len=$(echo $dependencies | jq -r 'keys | length')

for ((i=0; i<$dependencies_keys_len; i++)); do
crate_name=$(jq -r ".[$i]" <<< $dependencies_keys)
version=$(jq -r ".\"$crate_name\".version" <<< $dependencies || jq -r ".\"$crate_name\"" <<< $dependencies)

if [[ $version =~ $regex ]]; then
echo "crate_name: $crate_name"
echo "version: $version"
else
echo "No version found for $crate_name $version in crate $crate"
exit 1
fi
done
done
8 changes: 4 additions & 4 deletions implementations/rust/ockam/ockam_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ tracing-subscriber = { version = "0.3.18", features = ["json"] }
url = "2.5.2"

ockam_multiaddr = { path = "../ockam_multiaddr", version = "0.57.0", features = ["cbor", "serde"] }
ockam_transport_core = { path = "../ockam_transport_core" }
ockam_transport_core = { path = "../ockam_transport_core", version = "^0.87.0" }
ockam_transport_tcp = { path = "../ockam_transport_tcp", version = "^0.120.0", default-features = false, features = ["std"] }
tonic = "0.11"

Expand Down Expand Up @@ -155,9 +155,9 @@ hex = "0.4.3"
indexmap = "2.2.6"
mockall = "0.12"
multimap = "0.10.0"
ockam_macros = { path = "../ockam_macros", features = ["std"] }
ockam_transport_core = { path = "../ockam_transport_core" }
ockam_transport_tcp = { path = "../ockam_transport_tcp", default-features = false }
ockam_macros = { path = "../ockam_macros", features = ["std"], version = "^0.34.0" }
ockam_transport_core = { path = "../ockam_transport_core", version = "^0.87.0" }
ockam_transport_tcp = { path = "../ockam_transport_tcp", default-features = false, version = "^0.120.0" }
once_cell = { version = "1", default-features = false }
opentelemetry_sdk = { version = "0.23.0", features = ["logs", "metrics", "trace", "rt-tokio", "testing"], default-features = false }
pretty_assertions = "1.4.0"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ rust-crypto = ["ockam_vault/rust-crypto"]
hex = { version = "0.4", default-features = false }
lazy_static = "1.5.0"
minicbor = { version = "0.24.1", features = ["alloc", "derive"] }
ockam_core = { path = "../ockam_core", default-features = false, features = ["std"] }
ockam_identity = { path = "../ockam_identity", default-features = false, features = ["std", "software_vault"] }
ockam_vault = { path = "../ockam_vault", default-features = false, features = ["std", "storage"] }
ockam_vault_aws = { path = "../ockam_vault_aws" }
ockam_core = { path = "../ockam_core", default-features = false, features = ["std"], version = "^0.113.0" }
ockam_identity = { path = "../ockam_identity", default-features = false, features = ["std", "software_vault"], version = "^0.117.0" }
ockam_vault = { path = "../ockam_vault", default-features = false, features = ["std", "storage"], version = "^0.115.0" }
ockam_vault_aws = { path = "../ockam_vault_aws", version = "^0.41.0" }
# Enable credentials-sso feature in ockam_vault_aws for use on sso environments (like dev machines)
rustler = "0.33.0"
time = "0.3.36"
Expand Down
Loading