Skip to content

Commit 2da199e

Browse files
committed
build: switch from make to mise
- reduce number of tools to install locally - simplify ci, and allow to excute the same tasks locally - ise provide more feature than make (like depends, wait_for, and other not used yet) Signed-off-by: David Bernard <[email protected]>
1 parent 09d40da commit 2da199e

File tree

5 files changed

+103
-131
lines changed

5 files changed

+103
-131
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,6 @@ jobs:
2828
fetch-depth: 0
2929
submodules: "true"
3030
- uses: mozilla-actions/[email protected]
31-
- uses: jdx/mise-action@v2
32-
- run: mise install
31+
- uses: jdx/mise-action@v3
32+
- run: mise run ci
3333
shell: bash
34-
- run: make generate
35-
- run: make check_no_uncommitted_changes_on_sdk
36-
- run: make check
37-
- run: make test

.github/workflows/linter.yml

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,6 @@ concurrency:
1919
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
2020
cancel-in-progress: true
2121

22-
env:
23-
# configure sccache to cache the build artifacts (on github caches)
24-
SCCACHE_GHA_ENABLED: "true"
25-
RUSTC_WRAPPER: "sccache"
26-
2722
jobs:
2823
lint_commits:
2924
name: Lint Commit Messages
@@ -35,31 +30,3 @@ jobs:
3530
fetch-depth: 0
3631
- name: Check Commit Lint
3732
uses: wagoid/commitlint-github-action@v6
38-
39-
lint_check:
40-
name: Rust - lint_${{ matrix.lint_projects }}
41-
runs-on: ubuntu-latest
42-
strategy:
43-
fail-fast: false
44-
matrix:
45-
lint_projects:
46-
- cargo_fmt_check
47-
- cargo_toml_fmt_files
48-
- cargo_clippy
49-
- cargo_deny
50-
steps:
51-
- name: Run the checkout command
52-
uses: actions/checkout@v5
53-
with:
54-
fetch-depth: 0
55-
submodules: "true"
56-
- uses: mozilla-actions/[email protected]
57-
- uses: jdx/mise-action@v2
58-
- run: mise install
59-
shell: bash
60-
- name: Check cargo version
61-
run: cargo --version
62-
- name: Run ${{ matrix.lint_projects }}
63-
run: make -f Makefile lint_${{ matrix.lint_projects }}
64-
- run: ${SCCACHE_PATH} --show-stats
65-
shell: bash

.mise.toml

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,78 @@
11
[env]
22
# RUSTC_WRAPPER = "sccache"
3-
RUST_WITHOUT = "rust-docs"
4-
# ASDF_RUST_PROFILE = "minimal"
53
MISE_CARGO_BINSTALL = "true"
64

75
[tools]
86
"aqua:cargo-bins/cargo-binstall" = "1"
9-
rust = { version = "1.85", profile = "default" }
10-
make = "latest"
11-
# # experimental
7+
rust = { version = "1.89.0", profile = "minimal", components = "rustfmt,clippy" } # the rust tool stack (with cargo, fmt, clippy) to build source
128
"cargo:cargo-nextest" = "0.9"
139
"cargo:cargo-hack" = "0.6"
1410
"cargo:cargo-deny" = "0.16"
1511
# "cargo:git-cliff" = "latest"
16-
"cargo:dprint" = "0.45"
12+
"dprint" = "latest"
13+
14+
[tasks."format"]
15+
alias = "fmt"
16+
description = "Format the code and sort dependencies"
17+
run = [
18+
"cargo --locked fmt",
19+
"cargo --locked sort --grouped",
20+
"dprint fmt --config=tools/dprint/dprint.json",
21+
]
22+
23+
[tasks.check]
24+
run = "cargo hack check --each-feature"
25+
26+
# no uncommitted changes on sdk (generated code)
27+
[tasks."check:no_uncommitted_changes_on_sdk"]
28+
run = "git diff --exit-code cdevents-sdk"
29+
30+
[tasks."lint:cargo_fmt"]
31+
run = "cargo fmt --all -- --check"
32+
33+
[tasks."lint:cargo_deny"]
34+
run = """
35+
cargo deny --workspace --all-features \
36+
--exclude-dev \
37+
--exclude generator \
38+
check licenses advisories \
39+
--config=tools/cargo-deny/deny.toml
40+
"""
41+
42+
[tasks."lint:cargo_clippy"]
43+
run = "cargo clippy --workspace --all-features --no-deps --all-targets -- --deny warnings"
44+
45+
[tasks."lint:toml"]
46+
run = "dprint check --config=tools/dprint/dprint.json"
47+
48+
[tasks."lint"]
49+
depends = ["lint:*"]
50+
51+
[tasks.clean]
52+
run = "cargo clean"
53+
54+
[tasks.generate]
55+
run = """cargo run -p generator -- --templates-dir "generator/templates" --jsonschemas "cdevents-specs/*/schemas/*.json" --dest "cdevents-sdk/src/generated""""
56+
57+
[tasks.test]
58+
wait_for = ["generate", "lint:*"]
59+
run = [
60+
"cargo nextest run --all-features",
61+
"cargo test --doc",
62+
]
63+
64+
# [tasks."git:setup_cdevents-specs"]
65+
# run = [
66+
# "git submodule deinit -f --all",
67+
# "git submodule init",
68+
# "git submodule add -f https://github.com/cdevents/spec.git cdevents-specs/main",
69+
# "git submodule add -f -b spec-v0.3 https://github.com/cdevents/spec.git cdevents-specs/spec-v0.3",
70+
# "git submodule add -f -b spec-v0.4 https://github.com/cdevents/spec.git cdevents-specs/spec-v0.4",
71+
# "git submodule update -f --rebase -- cdevents-specs/main",
72+
# ]
73+
74+
[tasks."git:update_cdevents-specs"]
75+
run = "git submodule update --recursive --remote"
76+
77+
[tasks.ci]
78+
depends = ["generate", "test", "lint", "check"]

CONTRIBUTING.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
# Contributing
32

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

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

2928
### Install tools
3029

3130
You must install these tools:
3231

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

35-
2. If you use [mise](https://mise.jdx.dev/): `mise install` (after git clone)
36-
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
34+
2. [mise](https://mise.jdx.dev/):
35+
36+
- `mise install`: to install complementary tools, sdk,...
37+
- `mise tasks`: to list all tasks used to build
3738

3839
### Setup a fork
3940

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

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

46-
```shell
47-
git clone [email protected]:${YOUR_GITHUB_USERNAME}/sdk-rust.git
48-
```
47+
```shell
48+
git clone [email protected]:${YOUR_GITHUB_USERNAME}/sdk-rust.git
49+
```
4950

5051
1. Configure `git` remote repositories
5152

52-
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.
53-
54-
1. Change into the project directory
53+
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.
54+
1. Change into the project directory
5555

56-
```shell
57-
cd sdk-rust
58-
```
56+
```shell
57+
cd sdk-rust
58+
```
5959

60-
2. Retrieve submodules
60+
2. Retrieve submodules
6161

62-
```shell
63-
git submodule init
64-
git submodule update --init --recursive
65-
```
62+
```shell
63+
git submodule init
64+
git submodule update --init --recursive
65+
```
6666

67-
3. Configure sdk-rust as the `upstream` repository
67+
3. Configure sdk-rust as the `upstream` repository
6868

69-
```shell
70-
git remote add upstream [email protected]:cdevents/sdk-rust.git
69+
```shell
70+
git remote add upstream [email protected]:cdevents/sdk-rust.git
7171
72-
# Optional: Prevent accidental pushing of commits by changing the upstream URL to `no_push`
73-
git remote set-url --push upstream no_push
74-
```
72+
# Optional: Prevent accidental pushing of commits by changing the upstream URL to `no_push`
73+
git remote set-url --push upstream no_push
74+
```
7575

76-
4. Configure your fork as the `origin` repository
76+
4. Configure your fork as the `origin` repository
7777

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

8282
## Development
8383

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

9494
```shell
95-
make fmt
95+
mise run fmt
9696
```
9797

98-
To run the go linter:
98+
To run the all the tasks like the ci:
9999

100100
```shell
101-
make lint
101+
mise run ci
102102
```
103103

104104
To run unit tests:
105105

106106
```shell
107-
make test
107+
mise run test
108108
```
109109

110110
### Commit & push
@@ -130,4 +130,4 @@ Create a PR (pull request) and ask for review.
130130
The last reviewer, will "Squash & merge" when ready.
131131
The message of the squashed commit follows the [conventional commit], and aggregate/summaries commits of the branch.
132132
133-
[conventional commit]: https://www.conventionalcommits.org/en/v1.0.0/#summary
133+
[conventional commit]: https://www.conventionalcommits.org/en/v1.0.0/#summary

Makefile

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)