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

fixed commit #10

Closed
wants to merge 10 commits into from
Closed
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
42 changes: 33 additions & 9 deletions .github/workflows/linter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: linter

permissions:
contents: read
# To report GitHub Actions status checks
statuses: write

on:
push:
Expand All @@ -17,34 +19,56 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

defaults:
run:
shell: bash

jobs:
lint_commits:
name: Lint Commit Messages
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check Commit Lint
uses: wagoid/commitlint-github-action@v5.0.0
with:
configFile: "./.commitlint.config.js"
uses: wagoid/commitlint-github-action@v5.4.5

lint_check:
name: Rust - lint_${{ matrix.lint_projects }}
runs-on: ubuntu-22.04
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lint_projects:
- cargo_fmt_check
- cargo_toml_fmt_files
- cargo_clippy
- cargo_deny
- cargo_toml_files
steps:
- name: Checkout repository
rjtch marked this conversation as resolved.
Show resolved Hide resolved
- name: Run the checkout command
uses: actions/checkout@v4
- name: Install rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: nightly
components: clippy, rustfmt
- name: Install development tools
uses: taiki-e/install-action@v2
with:
tool: cargo-deny, dprint
- name: Rust Cache
uses: actions/cache@v4
continue-on-error: false
with:
path: |
~/.cargo/bin
~/.cargo/registry
~/.cargo/git/db/
key: ${{ runner.os }}-sdk-rust-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-sdk-rust-
- name: Check cargo version
run: cargo --version
- name: Run lint ${{ matrix.lint_projects }}
run: make -f Makefile lint_${{ matrix.lint_projects }}

1 change: 1 addition & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx --no -- commitlint --edit $1
1 change: 1 addition & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npm test
32 changes: 16 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[workspace]
members = [
"bindings",
"factory",
"types",
"zz_artifact",
"zz_branch",
"zz_build",
"zz_change",
"zz_environment",
"zz_incident",
"zz_pipeline",
"zz_repository",
"zz_service",
"zz_task",
]
[workspace]
members = [
"bindings",
"factory",
"types",
"zz_artifact",
"zz_branch",
"zz_build",
"zz_change",
"zz_environment",
"zz_incident",
"zz_pipeline",
"zz_repository",
"zz_service",
"zz_task",
]
45 changes: 6 additions & 39 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,57 +1,24 @@
build_docs:
cargo doc --locked --no-deps
build_examples:
cargo --locked build --examples
build:
cargo build --locked
build_release:
cargo --locked build --release
build_release_%:
cargo --locked build --release --package $*
build_%:
cargo build --locked --package $*

check:
cargo check --locked
check_no_std:
cargo --version
cargo check --locked --target thumbv7em-none-eabihf -p ockam --no-default-features --features 'no_std alloc software_vault'
# no_std example project
cd examples/rust/example_projects/no_std
cargo check --example hello
check_cargo_update:
cargo --version
# TODO: uncomment when tauri version is updated
# rm -rf Cargo.lock
# cargo update
# cargo check --locked

lint: lint_cargo_fmt_check lint_cargo_deny lint_cargo_clippy

lint_cargo_fmt_check:
cargo fmt --all -- --check

lint_cargo_deny:
cargo deny --all-features \
check licenses advisories\
check licenses advisories \
--config=tools/cargo-deny/deny.toml

lint_cargo_clippy:
cargo clippy --no-deps --all-targets -- -D warnings

lint_cargo_toml_files:
dprint check --config tools/dprint/dprint.json
lint_cargo_toml_fmt_files:
dprint fmt --config=tools/dprint/dprint.json

lint_cargo_toml_check_files:
dprint check --config=tools/dprint/dprint.json

clean:
cargo clean
clean_%:
cargo clean --package $*

very_clean:
rm -rf ../../target

format:
cargo fmt --all

.PHONY:
check \
Expand Down
36 changes: 36 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = {
parserPreset: 'conventional-changelog-conventionalcommits',
rules: {
'body-leading-blank': [1, 'always'],
'body-max-line-length': [2, 'always', 100],
'footer-leading-blank': [1, 'always'],
'footer-max-line-length': [2, 'always', 100],
'header-max-length': [2, 'always', 100],
'subject-case': [
2,
'never',
['sentence-case', 'start-case', 'pascal-case', 'upper-case'],
],
'subject-empty': [2, 'never'],
'subject-full-stop': [2, 'never', '.'],
'type-case': [2, 'always', 'lower-case'],
'type-empty': [2, 'never'],
'type-enum': [
2,
'always',
[
'build',
'chore',
'ci',
'docs',
'feat',
'fix',
'perf',
'refactor',
'revert',
'style',
'test',
],
],
},
};
5 changes: 2 additions & 3 deletions tools/cargo-deny/deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,16 @@ unlicensed = "deny"
copyleft = "deny"
confidence-threshold = 0.95
allow = [
"MIT",
"Apache-2.0",
"MIT",
"BSD-2-Clause",
]
exceptions = []

[advisories]
unmaintained = "deny"
vulnerability = "deny"
#Determines what happens when a crate with a version that has been yanked from its source registry is encountered.
yanked = "warn"
ignore = []
# Users who require or prefer Git to use SSH cloning instead of HTTPS,
# such as implemented via "insteadOf" rules in Git config, can still
# successfully fetch advisories with this enabled.
Expand Down
3 changes: 2 additions & 1 deletion tools/dprint/dprint.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"includes": [
"**/Cargo.toml"
"**/*.toml",
"**/*.yaml"
],
"plugins": [
"https://plugins.dprint.dev/toml-0.5.4.wasm"
Expand Down
Loading