-
Notifications
You must be signed in to change notification settings - Fork 400
CI:Add commit-lint in CI #50
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,149 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [ main, release ] | ||
| tags: | ||
| - 'release-*' | ||
| pull_request: | ||
| branches: [ main, release ] | ||
|
|
||
| env: | ||
| CARGO_TERM_COLOR: always | ||
| ARTIFACT_DIR: release-artifacts | ||
|
|
||
| jobs: | ||
| commit-lint: | ||
| name: Lint Commit Messages | ||
| runs-on: ubuntu-latest | ||
| if: github.event_name == 'pull_request' | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '16' | ||
|
|
||
| - name: Install commitlint | ||
| run: | | ||
| npm install --save-dev @commitlint/cli @commitlint/config-conventional | ||
| echo "module.exports = {extends: ['@commitlint/config-conventional']}" > commitlint.config.js | ||
|
|
||
| - name: Lint commit messages | ||
| run: npx commitlint --from ${{ github.event.pull_request.base.sha }} --to ${{ github.event.pull_request.head.sha }} --verbose | ||
|
|
||
| fmt: | ||
| name: Code Formatting | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Check formatting | ||
| run: cargo fmt --all -- --check | ||
|
|
||
| clippy: | ||
| name: Lint with Clippy | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: ${{ runner.os }}-cargo- | ||
|
|
||
| - name: Run clippy | ||
| run: cargo clippy --all-targets --all-features -- -D warnings | ||
|
|
||
| test: | ||
| name: Run Tests | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| # install nodejs | ||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v3 | ||
| with: | ||
| node-version: '20' | ||
|
|
||
| - name: Install uv | ||
| uses: astral-sh/setup-uv@v5 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Set up Python | ||
| run: uv python install | ||
|
|
||
| - name: Create venv for python | ||
| run: uv venv | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: ${{ runner.os }}-cargo- | ||
|
|
||
| - name: Run tests | ||
| run: cargo test --all-features | ||
|
|
||
| release: | ||
| name: Release crates | ||
| runs-on: ubuntu-latest | ||
| if: github.ref == 'refs/heads/release' || startsWith(github.ref, 'refs/tags/release') | ||
| needs: [fmt, clippy, test] | ||
| steps: | ||
| - uses: actions/checkout@v3 | ||
|
|
||
| - name: Install Rust | ||
| uses: dtolnay/rust-toolchain@stable | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: | | ||
| ~/.cargo/registry | ||
| ~/.cargo/git | ||
| target | ||
| key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
| restore-keys: ${{ runner.os }}-cargo- | ||
|
|
||
| - name: Cargo login | ||
| run: cargo login ${{ secrets.CRATES_TOKEN }} | ||
|
|
||
| - name: Publish macros dry run | ||
| run: cargo publish -p rmcp-macros --dry-run | ||
| continue-on-error: true | ||
|
|
||
| - name: Publish rmcp dry run | ||
| run: cargo publish -p rmcp --dry-run | ||
| continue-on-error: true | ||
|
|
||
| - name: Publish macro | ||
| if: ${{ startsWith(github.ref, 'refs/tags/release') }} | ||
| continue-on-error: true | ||
| run: cargo publish -p rmcp-macros | ||
|
|
||
| - name: Publish rmcp | ||
| if: ${{ startsWith(github.ref, 'refs/tags/release') }} | ||
| continue-on-error: true | ||
| run: cargo publish -p rmcp | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jokemanfire GitHub itself removed the ancient Node 16 a year ago, why is at least 20 not possible here?
https://github.blog/changelog/2024-03-06-github-actions-all-actions-will-run-on-node20-instead-of-node16-by-default/
Exactly because of Node 16 being unsupported since 2023 all had to be upgraded of course:
actions/checkout#1697
actions/setup-node#850
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks I will change it