ci(rust)::> Github Workflow to verify new crates that are being introduced #1
Workflow file for this run
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
name: Check Crates | |
on: | |
push: | |
branches: | |
- develop | |
pull_request: | |
branches: | |
- develop | |
jobs: | |
check_crates: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y jq | |
- name: Install Rust | |
uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
profile: minimal | |
override: true | |
- name: Install tomlq | |
run: cargo install --locked tomlq --version 0.1.0 | |
- name: Read member paths from implementations/rust/ockam directory | |
id: member_paths | |
run: | | |
paths=$(find implementations/rust/ockam -name Cargo.toml) | |
- name: Check for CHANGELOG.md | |
run: | | |
paths="${{ steps.member_paths.outputs.paths }}" | |
IFS=$'\n' read -r -d '' -a path_array <<< "$paths" | |
for path in "${path_array[@]}"; do | |
for crate in $(find $path -name 'Cargo.toml'); do | |
dir=$(dirname $crate) | |
if [ ! -f "$dir/CHANGELOG.md" ]; then | |
echo "Error: $dir/CHANGELOG.md is missing" | |
exit 1 | |
fi | |
done | |
done | |
- name: Check for README.md | |
run: | | |
paths="${{ steps.member_paths.outputs.paths }}" | |
IFS=$'\n' read -r -d '' -a path_array <<< "$paths" | |
for path in "${path_array[@]}"; do | |
for crate in $(find $path -name 'Cargo.toml'); do | |
dir=$(dirname $crate) | |
if [ ! -f "$dir/README.md" ]; then | |
echo "Error: $dir/README.md is missing" | |
exit 1 | |
fi | |
done | |
done | |
- name: Validate Cargo.toml categories | |
run: | | |
allowed_categories=" | |
accessibility | |
aerospace | |
aerospace::drones | |
aerospace::protocols | |
aerospace::simulation | |
aerospace::space-protocols | |
aerospace::unmanned-aerial-vehicles | |
algorithms | |
api-bindings | |
asynchronous | |
authentication | |
caching | |
command-line-interface | |
command-line-utilities | |
compilers | |
compression | |
computer-vision | |
concurrency | |
config | |
cryptography | |
cryptography::cryptocurrencies | |
data-structures | |
database | |
database-implementations | |
date-and-time | |
development-tools | |
development-tools::build-utils | |
development-tools::cargo-plugins | |
development-tools::debugging | |
development-tools::ffi | |
development-tools::procedural-macro-helpers | |
development-tools::profiling | |
development-tools::testing | |
embedded | |
emulators | |
encoding | |
external-ffi-bindings | |
filesystem | |
finance | |
game-development | |
game-engines | |
games | |
graphics | |
gui | |
hardware-support | |
internationalization | |
localization | |
mathematics | |
memory-management | |
multimedia | |
multimedia::audio | |
multimedia::encoding | |
multimedia::images | |
multimedia::video | |
network-programming | |
no-std | |
no-std::no-alloc | |
os | |
os::android-apis | |
os::freebsd-apis | |
os::linux-apis | |
os::macos-apis | |
os::unix-apis | |
os::windows-apis | |
parser-implementations | |
parsing | |
rendering | |
rendering::data-formats | |
rendering::engine | |
rendering::graphics-api | |
rust-patterns | |
science | |
science::bioinformatics | |
science::bioinformatics::genomics | |
science::bioinformatics::proteomics | |
science::bioinformatics::sequence-analysis | |
science::geo | |
science::neuroscience | |
science::robotics | |
simulation | |
template-engine | |
text-editors | |
text-processing | |
value-formatting | |
virtualization | |
visualization | |
wasm | |
web-programming | |
web-programming::http-client | |
web-programming::http-server | |
web-programming::websocket | |
" | |
paths="${{ steps.member_paths.outputs.paths }}" | |
IFS=$'\n' read -r -d '' -a path_array <<< "$paths" | |
for path in "${path_array[@]}"; do | |
for crate in $(find $path -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 | |
done |