Skip to content
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
15 changes: 9 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,13 @@ jobs:
fetch-depth: 0
submodules: "true"
- uses: mozilla-actions/[email protected]
- uses: jdx/mise-action@v2
- run: mise install
- uses: jdx/mise-action@v3
with:
# version 2025.5.11, a symlink is created for rust setup
# without cache, missing components are installed
# with cache, nothing is installed, but as rust tool is symlinked, it is not cached => missing components failure
cache: false
cache_save: false
experimental: true
- run: mise run ci
shell: bash
- run: make generate
- run: make check_no_uncommitted_changes_on_sdk
- run: make check
- run: make test
33 changes: 0 additions & 33 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ concurrency:
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
cancel-in-progress: true

env:
# configure sccache to cache the build artifacts (on github caches)
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"

jobs:
lint_commits:
name: Lint Commit Messages
Expand All @@ -35,31 +30,3 @@ jobs:
fetch-depth: 0
- name: Check Commit Lint
uses: wagoid/commitlint-github-action@v6

lint_check:
name: Rust - lint_${{ matrix.lint_projects }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
lint_projects:
- cargo_fmt_check
- cargo_toml_fmt_files
- cargo_clippy
- cargo_deny
steps:
- name: Run the checkout command
uses: actions/checkout@v5
with:
fetch-depth: 0
submodules: "true"
- uses: mozilla-actions/[email protected]
- uses: jdx/mise-action@v2
- run: mise install
shell: bash
- name: Check cargo version
run: cargo --version
- name: Run ${{ matrix.lint_projects }}
run: make -f Makefile lint_${{ matrix.lint_projects }}
- run: ${SCCACHE_PATH} --show-stats
shell: bash
74 changes: 68 additions & 6 deletions .mise.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,78 @@
[env]
# RUSTC_WRAPPER = "sccache"
RUST_WITHOUT = "rust-docs"
# ASDF_RUST_PROFILE = "minimal"
MISE_CARGO_BINSTALL = "true"

[tools]
"aqua:cargo-bins/cargo-binstall" = "1"
rust = { version = "1.85", profile = "default" }
make = "latest"
# # experimental
rust = { version = "1.89.0", profile = "minimal", components = "rustfmt,clippy" } # the rust tool stack (with cargo, fmt, clippy) to build source
"cargo:cargo-nextest" = "0.9"
"cargo:cargo-hack" = "0.6"
"cargo:cargo-deny" = "0.16"
# "cargo:git-cliff" = "latest"
"cargo:dprint" = "0.45"
"dprint" = "latest"

[tasks."format"]
alias = "fmt"
description = "Format the code and sort dependencies"
run = [
"cargo --locked fmt",
"cargo --locked sort --grouped",
"dprint fmt --config=tools/dprint/dprint.json",
]

[tasks.check]
run = "cargo hack check --each-feature"

# no uncommitted changes on sdk (generated code)
[tasks."check:no_uncommitted_changes_on_sdk"]
run = "git diff --exit-code cdevents-sdk"

[tasks."lint:cargo_fmt"]
run = "cargo fmt --all -- --check"

[tasks."lint:cargo_deny"]
run = """
cargo deny --workspace --all-features \
--exclude-dev \
--exclude generator \
check licenses advisories \
--config=tools/cargo-deny/deny.toml
"""

[tasks."lint:cargo_clippy"]
run = "cargo clippy --workspace --all-features --no-deps --all-targets -- --deny warnings"

[tasks."lint:toml"]
run = "dprint check --config=tools/dprint/dprint.json"

[tasks."lint"]
depends = ["lint:*"]

[tasks.clean]
run = "cargo clean"

[tasks.generate]
run = """cargo run -p generator -- --templates-dir "generator/templates" --jsonschemas "cdevents-specs/*/schemas/*.json" --dest "cdevents-sdk/src/generated""""

[tasks.test]
wait_for = ["generate", "lint:*"]
run = [
"cargo nextest run --all-features",
"cargo test --doc",
]

# [tasks."git:setup_cdevents-specs"]
# run = [
# "git submodule deinit -f --all",
# "git submodule init",
# "git submodule add -f https://github.com/cdevents/spec.git cdevents-specs/main",
# "git submodule add -f -b spec-v0.3 https://github.com/cdevents/spec.git cdevents-specs/spec-v0.3",
# "git submodule add -f -b spec-v0.4 https://github.com/cdevents/spec.git cdevents-specs/spec-v0.4",
# "git submodule update -f --rebase -- cdevents-specs/main",
# ]

[tasks."git:update_cdevents-specs"]
run = "git submodule update --recursive --remote"

[tasks.ci]
depends = ["generate", "test", "lint", "check"]
66 changes: 33 additions & 33 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Contributing

🚀 Thank you for contributing to cdevents! 🚀
Expand All @@ -24,16 +23,18 @@ GitHub is used for project Source Code Management (SCM) using the SSH protocol f

1. Create [a GitHub account](https://github.com/join) if you do not already have one.
1. Setup
[GitHub access via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/)
[GitHub access via SSH](https://help.github.com/articles/connecting-to-github-with-ssh/)

### Install tools

You must install these tools:

1. [`git`](https://help.github.com/articles/set-up-git/): For source control

2. If you use [mise](https://mise.jdx.dev/): `mise install` (after git clone)
Else look into the mise configuration file [`.mise.toml`](https://github.com/cdevents/sdk-rust/blob/main/.mise.toml) to have the list of tools to install
2. [mise](https://mise.jdx.dev/):

- `mise install`: to install complementary tools, sdk,...
- `mise tasks`: to list all tasks used to build

### Setup a fork

Expand All @@ -43,41 +44,40 @@ The sdk-rust project requires that you develop (commit) code changes to branches

1. Create a clone of your fork on your local machine:

```shell
git clone [email protected]:${YOUR_GITHUB_USERNAME}/sdk-rust.git
```
```shell
git clone [email protected]:${YOUR_GITHUB_USERNAME}/sdk-rust.git
```

1. Configure `git` remote repositories

Adding `cdevents/sdk-rust` as the `upstream` and your fork as the `origin` remote repositories to your `.git/config` sets you up nicely for regularly [syncing your fork](https://help.github.com/articles/syncing-a-fork/) and submitting pull requests.

1. Change into the project directory
Adding `cdevents/sdk-rust` as the `upstream` and your fork as the `origin` remote repositories to your `.git/config` sets you up nicely for regularly [syncing your fork](https://help.github.com/articles/syncing-a-fork/) and submitting pull requests.
1. Change into the project directory

```shell
cd sdk-rust
```
```shell
cd sdk-rust
```

2. Retrieve submodules
2. Retrieve submodules

```shell
git submodule init
git submodule update --init --recursive
```
```shell
git submodule init
git submodule update --init --recursive
```

3. Configure sdk-rust as the `upstream` repository
3. Configure sdk-rust as the `upstream` repository

```shell
git remote add upstream [email protected]:cdevents/sdk-rust.git
```shell
git remote add upstream [email protected]:cdevents/sdk-rust.git

# Optional: Prevent accidental pushing of commits by changing the upstream URL to `no_push`
git remote set-url --push upstream no_push
```
# Optional: Prevent accidental pushing of commits by changing the upstream URL to `no_push`
git remote set-url --push upstream no_push
```

4. Configure your fork as the `origin` repository
4. Configure your fork as the `origin` repository

```shell
git remote add origin [email protected]:${YOUR_GITHUB_USERNAME}/sdk-rust.git
```
```shell
git remote add origin [email protected]:${YOUR_GITHUB_USERNAME}/sdk-rust.git
```

## Development

Expand All @@ -92,19 +92,19 @@ git switch -c feat_foo
To format the rust code and imports:

```shell
make fmt
mise run fmt
```

To run the go linter:
To run the all the tasks like the ci:

```shell
make lint
mise run ci
```

To run unit tests:

```shell
make test
mise run test
```

### Commit & push
Expand All @@ -130,4 +130,4 @@ Create a PR (pull request) and ask for review.
The last reviewer, will "Squash & merge" when ready.
The message of the squashed commit follows the [conventional commit], and aggregate/summaries commits of the branch.

[conventional commit]: https://www.conventionalcommits.org/en/v1.0.0/#summary
[conventional commit]: https://www.conventionalcommits.org/en/v1.0.0/#summary
53 changes: 0 additions & 53 deletions Makefile

This file was deleted.

Loading