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

Proposal: Add MegaLinter and Cargo Clippy CI Cycle #278

Draft
wants to merge 65 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
65 commits
Select commit Hold shift + click to select a range
face142
Documents
ScottGibb Jan 24, 2025
3b90c94
attempt at megalinter
ScottGibb Jan 24, 2025
efd1683
fixed formatting
ScottGibb Jan 24, 2025
2a038e7
added crates checks
ScottGibb Jan 24, 2025
3e50372
updated uses tag
ScottGibb Jan 24, 2025
1ba9adf
need to investiaget lint checks
ScottGibb Jan 24, 2025
aab9ec8
rearranged commands
ScottGibb Jan 27, 2025
a804847
added toolchains
ScottGibb Jan 27, 2025
c97ad79
fixed python and markdown
ScottGibb Jan 27, 2025
ab25ffd
fixed shell script
ScottGibb Jan 27, 2025
1d6995a
bumped ci dependency
ScottGibb Jan 27, 2025
908bfa0
Fixed YAML and added allow comments
ScottGibb Jan 27, 2025
a60ae92
yaml fixes
ScottGibb Jan 27, 2025
33aab51
jsonlint removed trailing comma
ScottGibb Jan 27, 2025
ab6c3e3
removed trailing spaces
ScottGibb Jan 27, 2025
82d774c
fixed globbing
ScottGibb Jan 27, 2025
e3dc4a9
removed commas and extra spaces
ScottGibb Jan 27, 2025
b148e97
fixed markdown error
ScottGibb Jan 27, 2025
4b3095a
ran cargo fmt on the codebase
ScottGibb Jan 27, 2025
1fcaf4f
commented out apache-nimble
ScottGibb Jan 27, 2025
c8a0dc9
removed trailing comma
ScottGibb Jan 27, 2025
b257627
removed esp32 from clippy
ScottGibb Jan 27, 2025
ed71371
made mega-linter match ci.sh
ScottGibb Jan 27, 2025
0507242
added megalinter fixes
ScottGibb Jan 27, 2025
6120832
attempt to fix megalinter ci
ScottGibb Jan 27, 2025
77c8df6
removed another example
ScottGibb Jan 27, 2025
f0dc31e
adjusted clippy checks to do it inside the projects
ScottGibb Jan 27, 2025
acfb5af
Merge branch 'main' into add-linter
ScottGibb Jan 27, 2025
1ce7ab9
fixed scan.rs
ScottGibb Jan 27, 2025
8d91231
remove clippy and fmt from ci.sh
ScottGibb Jan 27, 2025
47b91a7
ran cargo fmt
ScottGibb Jan 27, 2025
6e58aa6
do full scan on all stages for linting
ScottGibb Jan 27, 2025
5424187
fixed ble scanner
ScottGibb Jan 27, 2025
517009c
removed continue-on-error
ScottGibb Jan 27, 2025
66c920e
fail on warnings
ScottGibb Jan 27, 2025
c07ef49
removed old docs
ScottGibb Jan 27, 2025
90f4958
fixed clippy warnings
ScottGibb Jan 27, 2025
f7b4253
removed tests that imediately fail
ScottGibb Jan 27, 2025
ee40712
dont need all-features flag in host-macros
ScottGibb Jan 27, 2025
d500c48
made it a bit clearer on the GitHub Runner side
ScottGibb Jan 27, 2025
b244463
commented back in examples checking
ScottGibb Jan 27, 2025
c374ce1
added Default
ScottGibb Jan 27, 2025
720b547
added extensions
ScottGibb Jan 28, 2025
294213a
[MegaLinter] Apply linters automatic fixes
ScottGibb Jan 28, 2025
a7ca57d
Merge pull request #2 from dysonltd/megalinter-fixes-add-linter
ScottGibb Jan 28, 2025
f890a90
added esp32 clippy tests
ScottGibb Jan 28, 2025
1949a34
removed whitespaces
ScottGibb Jan 28, 2025
920aabf
removed apache-nimble from CI
ScottGibb Jan 28, 2025
3ddf894
commented out broken toolchains
ScottGibb Jan 28, 2025
c979cba
fix
ScottGibb Jan 28, 2025
7fe81a0
removed esp32c6
ScottGibb Jan 28, 2025
d57350d
and esp32h2
ScottGibb Jan 28, 2025
8632e9c
update echo strings
ScottGibb Jan 28, 2025
34c4d55
added nrf clippy
ScottGibb Jan 28, 2025
f791c4b
adding back esp32c6 and esp32h2
ScottGibb Jan 28, 2025
a4a7197
added toolchain
ScottGibb Jan 28, 2025
f4d4922
Merge branch 'main' into add-linter
ScottGibb Jan 29, 2025
94b4059
Merge branch 'main' into add-linter
ScottGibb Mar 4, 2025
9db0f7c
removed issue with duplicated imports
ScottGibb Mar 4, 2025
8d87261
removed double import
ScottGibb Mar 4, 2025
e9ecf44
all formatting and clippy now done in ci.sh
ScottGibb Mar 4, 2025
5ee9d85
added missing \
ScottGibb Mar 4, 2025
48d5fbf
added print statements
ScottGibb Mar 4, 2025
84bf2fb
commented out mega-linter
ScottGibb Mar 4, 2025
ae7cda4
added working linter setup script
ScottGibb Mar 4, 2025
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
2 changes: 1 addition & 1 deletion .ci/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"probe": "303a:1001:60:55:F9:BF:A9:44",
"labels": {
"target": "esp32",
"board": "esp-rust-board"
"board": "esp-rust-board"
}
}
]
Expand Down
1 change: 1 addition & 0 deletions .github/rodbot.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
on:
issue_comment:
- if:
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: CI

on:
Expand All @@ -11,14 +12,16 @@ on:
jobs:
build:
runs-on: ubuntu-latest
env:
ENABLE_MEGALINTER: true
steps:
- uses: actions/checkout@v4
- name: Add dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends libudev-dev
- name: Set up cargo cache
uses: actions/cache@v3
uses: actions/cache@v4.2.0
continue-on-error: true
with:
path: |
Expand Down
91 changes: 46 additions & 45 deletions .github/workflows/release_trouble_host.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
name: Trouble Host Release
---
name: Trouble Host Release

on:
push:
tags:
- 'trouble-host-v[0-9]+.[0-9]+.[0-9]+'
- "trouble-host-v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: write

jobs:
# Re Run the Checks
build:
Expand All @@ -19,7 +20,7 @@ jobs:
sudo apt-get update
sudo apt-get install --no-install-recommends libudev-dev
- name: Set up cargo cache
uses: actions/cache@v3
uses: actions/cache@v4.2.0
continue-on-error: true
with:
path: |
Expand All @@ -43,48 +44,48 @@ jobs:
timeout-minutes: 10
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Verify Version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/trouble-host-v}
CARGO_VERSION=$(grep '^version =' host/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Version mismatch: tag is $TAG_VERSION but Cargo.toml is $CARGO_VERSION"
exit 1 # Exits with a non-zero status to fail the workflow
fi
shell: bash
- name: Verify Version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/trouble-host-v}
CARGO_VERSION=$(grep '^version =' host/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Version mismatch: tag is $TAG_VERSION but Cargo.toml is $CARGO_VERSION"
exit 1 # Exits with a non-zero status to fail the workflow
fi
shell: bash

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Build project
run: |
cd host
cargo build --release

- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} host v${tag#trouble-host-v}" \
--generate-notes
- name: Build project
run: |
cd host
cargo build --release

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish to the main registry
run: |
echo "Publishing to crates.io"
cargo publish
# To perform a dry run uncomment the following lines
# run: |
# echo "Performing dry-run publish to crates.io"
# cd host
# cargo publish --dry-run
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} host v${tag#trouble-host-v}" \
--generate-notes

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish to the main registry
run: |
echo "Publishing to crates.io"
cargo publish
# To perform a dry run uncomment the following lines
# run: |
# echo "Performing dry-run publish to crates.io"
# cd host
# cargo publish --dry-run
89 changes: 45 additions & 44 deletions .github/workflows/release_trouble_host_macros.yaml
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
name: Trouble Host macros Release

on:
push:
tags:
- 'trouble-host-macros-v[0-9]+.[0-9]+.[0-9]+'
- "trouble-host-macros-v[0-9]+.[0-9]+.[0-9]+"

permissions:
contents: write

jobs:
# Re Run the Checks
build:
Expand All @@ -19,7 +20,7 @@ jobs:
sudo apt-get update
sudo apt-get install --no-install-recommends libudev-dev
- name: Set up cargo cache
uses: actions/cache@v3
uses: actions/cache@v4.2.0
continue-on-error: true
with:
path: |
Expand All @@ -43,48 +44,48 @@ jobs:
timeout-minutes: 10
if: github.ref == 'refs/heads/main'
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Checkout code
uses: actions/checkout@v4

- name: Verify Version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/trouble-host-macros-v}
CARGO_VERSION=$(grep '^version =' host-macros/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Version mismatch: tag is $TAG_VERSION but Cargo.toml is $CARGO_VERSION"
exit 1 # Exits with a non-zero status to fail the workflow
fi
shell: bash
- name: Verify Version
run: |
TAG_VERSION=${GITHUB_REF#refs/tags/trouble-host-macros-v}
CARGO_VERSION=$(grep '^version =' host-macros/Cargo.toml | sed -E 's/version = "([^"]+)"/\1/')
if [ "$TAG_VERSION" != "$CARGO_VERSION" ]; then
echo "Version mismatch: tag is $TAG_VERSION but Cargo.toml is $CARGO_VERSION"
exit 1 # Exits with a non-zero status to fail the workflow
fi
shell: bash

- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable

- name: Build project
run: |
cd host-macros
cargo build --release

- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} host macros v${tag#trouble-host-macros-v}" \
--generate-notes
- name: Build project
run: |
cd host-macros
cargo build --release

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish to the main registry
run: |
echo "Publishing to crates.io"
cargo publish
# To perform a dry run uncomment the following lines
# run: |
# echo "Performing dry-run publish to crates.io"
# cd host-macros
# cargo publish --dry-run
- name: Create GitHub release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} host macros v${tag#trouble-host-macros-v}" \
--generate-notes

- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
# Publish to the main registry
run: |
echo "Publishing to crates.io"
cargo publish
# To perform a dry run uncomment the following lines
# run: |
# echo "Performing dry-run publish to crates.io"
# cd host-macros
# cargo publish --dry-run
9 changes: 5 additions & 4 deletions .github/workflows/rodbot.yaml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
---
name: rodbot

on:
issue_comment:
types: [ "created" ]
types: ["created"]

jobs:
rodbot:
Expand All @@ -13,11 +14,11 @@ jobs:

steps:
- run: |
echo $GITHUB_EVENT_PATH
cat $GITHUB_EVENT_PATH
echo $"GITHUB_EVENT_PATH"
cat $"GITHUB_EVENT_PATH"

- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- uses: ctron/[email protected]
with:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Tests

on:
Expand All @@ -23,7 +24,7 @@ jobs:
sudo apt-get update
sudo apt-get install --no-install-recommends libudev-dev
- name: Set up cargo cache
uses: actions/cache@v3
uses: actions/cache@v4.2.0
continue-on-error: true
with:
path: |
Expand Down Expand Up @@ -62,7 +63,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/${COMMIT} \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/"${COMMIT}" \
-f "state=pending" -f "description=Running integration tests" -f "context=integration-tests"
- name: Test
env:
Expand All @@ -78,7 +79,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/${COMMIT} \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/"${COMMIT}" \
-f "state=failure" -f "description=The integration tests failed" -f "context=integration-tests"
- name: Update success status
if: success()
Expand All @@ -87,7 +88,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/${COMMIT} \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/"${COMMIT}" \
-f "state=success" -f "description=The integration tests succeeded!" -f "context=integration-tests"

example-tests:
Expand All @@ -108,7 +109,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/${COMMIT} \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/"${COMMIT}" \
-f "state=pending" -f "description=Running example tests" -f "context=example-tests"

- uses: actions/download-artifact@v4
Expand All @@ -131,7 +132,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/${COMMIT} \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/"${COMMIT}" \
-f "state=failure" -f "description=The example tests failed" -f "context=example-tests"
- name: Update success status
if: success()
Expand All @@ -140,5 +141,5 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
gh api --method POST -H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/${COMMIT} \
-H "X-GitHub-Api-Version: 2022-11-28" /repos/embassy-rs/trouble/statuses/"${COMMIT}" \
-f "state=success" -f "description=The example tests succeeded!" -f "context=example-tests"
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
**/target
**/target_ci
Cargo.lock
.idea
.idea
megalinter-reports/
# Mac Users
.DS_Store
4 changes: 4 additions & 0 deletions .markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"default": true,
"line-length": false
}
Loading
Loading