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

Add support for partition-tables. #67

Merged
merged 7 commits into from
Nov 20, 2024
Merged

Add support for partition-tables. #67

merged 7 commits into from
Nov 20, 2024

Conversation

floitsch
Copy link
Member

@floitsch floitsch commented Nov 6, 2024

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced an optional parameter to build partition tables in the GitHub Actions workflow.
    • Added a new job for releasing partition tables, enhancing the build process.
    • Expanded the repository's scope to include partition tables alongside envelopes.
  • Documentation

    • Updated README.md to clarify the repository's offerings, including new sections on partition tables and variants.
    • Created a new contributing guide for adding variants, streamlining the contribution process.
    • Added detailed descriptions of various ESP32 variants in the variants README.
    • Introduced a dedicated README for partition tables, explaining their configurations and usage.

@floitsch floitsch requested a review from kasperl November 6, 2024 12:04
Copy link

coderabbitai bot commented Nov 6, 2024

Walkthrough

Groovy, baby! This pull request introduces a fab new input parameter, build-tables, to the GitHub Actions workflow, allowing users to optionally create partition tables. A new job, release-partition-tables, is added to handle this task. The README.md gets a snazzy update to clarify the repository's purpose, now including partition tables alongside envelopes. New documentation for partition tables and variants is also introduced, making everything clearer, baby! It's a total overhaul of the workflow and documentation, ensuring smooth operations and clear instructions.

Changes

File Path Change Summary
.github/workflows/build.yml Added input parameter build-tables and new job release-partition-tables. Modified release steps to include partition tables.
README.md Updated title to include "partition tables." Revised content for clarity and added references to variants/README.md and partition-tables/README.md.
partition-tables/README.md Added new section detailing partition tables and the "OTA-1C0000" partition table.
partition-tables/ota-1c0000/README.md New section describing the "OTA-1C0000" partition table configuration.
variants/Contributing.md New guidelines for contributing variants, including instructions and examples for creating new variants.
variants/README.md Introduced a new section on variants with descriptions of various ESP32-related variants.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant Release Job
    participant Artifact Storage

    User->>GitHub Actions: Trigger workflow with build-tables
    GitHub Actions->>Release Job: Start release-partition-tables job
    Release Job->>Release Job: Checkout repository
    Release Job->>Release Job: Prepare partition tables
    Release Job->>Artifact Storage: Release artifacts
Loading

🎉✨ Oh, what a change, it's quite the delight,
Adding partition tables, everything feels right!
With a workflow so snazzy, and docs that shine,
Groovy instructions, oh baby, they're divine!
So let's build and release, with a wink and a cheer,
In the world of Toit, we’ve got nothing to fear! 🎈💃


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Outside diff range and nitpick comments (8)
README.md (1)

26-28: Shagadelic new partition tables section!

The addition of the partition tables section with a reference to its dedicated README is absolutely fab! However, let's make it even more groovy, baby!

Consider adding a brief one-liner explaining what partition tables are, like this:

 See the [partition-tables/README.md](partition-tables/README.md) for
 a list of the most commonly used partition tables. You can also browse
-the `partition-tables` directory for more partition tables.
+the `partition-tables` directory for more partition tables. Partition
+tables define how the flash memory is organized on ESP32 devices.
variants/Contributing.md (6)

3-8: Yeah baby, yeah! Let's add more specifics about variant acceptance criteria!

Groovy introduction, but it would be totally shagadelic if we could specify:

  • What makes a variant "generally useful"
  • How often the automated builds run
  • Where to find the built variants

12-14: Oh behave! Let's add some smashing version control guidelines!

The overview's got the mojo, baby, but it would be even more groovy with:

  • Git branching strategy recommendations
  • Testing requirements before submission
  • Naming conventions for variants

18-20: Smashing example, but let's add some punctuation, baby!

A comma is missing after esp32-ota-1c0000. Also, it would be absolutely fab to add:

  • Minimum/maximum partition size constraints
  • Impact on flash memory layout
-the `esp32-ota-1c0000` is an example of this where
+the `esp32-ota-1c0000` is an example of this, where
🧰 Tools
🪛 LanguageTool

[uncategorized] ~19-~19: Possible missing comma found.
Context: ...The esp32-ota-1c0000 is an example of this where the OTA partition size has been i...

(AI_HYDRA_LEO_MISSING_COMMA)


34-41: Crikey! Let's make this code block groovy with proper formatting!

The diff command is looking sharp, but let's make it even more shagadelic:

  1. Add 'bash' language specification to the code block
  2. Consider providing a helper script to generate patches
-  ```
+  ```bash
🧰 Tools
🪛 Markdownlint

34-34: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)


48-51: Let's make this section totally Austin-worthy with more details!

The section's a bit light, baby. It would be smashing to add:

  • Example of creating a recursive diff
  • Patch naming conventions
  • Common gotchas when modifying the main directory

1-2: Yeah baby! Let's add a table of contents to this groovy document!

For a document this size, a table of contents would make it absolutely smashing to navigate!

# Contributing

## Table of Contents
- [Overview](#overview)
- [Creating a variant](#creating-a-variant)
  - [Partition changes](#partition-changes)
  - [sdkconfig changes](#sdkconfig-changes)
  - [Main changes](#main-changes)
🧰 Tools
🪛 LanguageTool

[style] ~2-~2: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: # Contributing Feel free to open issues and pull requests with new ...

(FEEL_FREE_TO_STYLE_ME)

.github/workflows/build.yml (1)

396-398: Let's fix this groovy shell script, shall we?

There's a potential word splitting issue in the environment variable assignment.

Here's the fix, baby:

-          echo "TOIT_GIT_VERSION=${{ github.event.inputs.toit-version }}" >> $GITHUB_ENV
+          echo "TOIT_GIT_VERSION='${{ github.event.inputs.toit-version }}'" >> "$GITHUB_ENV"
🧰 Tools
🪛 actionlint

397-397: shellcheck reported issue in this script: SC2086:info:1:68: Double quote to prevent globbing and word splitting

(shellcheck)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 9807f6c and f8802a2.

⛔ Files ignored due to path filters (1)
  • partition-tables/ota-1c0000/partitions.csv is excluded by !**/*.csv
📒 Files selected for processing (6)
  • .github/workflows/build.yml (4 hunks)
  • README.md (2 hunks)
  • partition-tables/README.md (1 hunks)
  • partition-tables/ota-1c0000/README.md (1 hunks)
  • variants/Contributing.md (1 hunks)
  • variants/README.md (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • partition-tables/README.md
🧰 Additional context used
🪛 actionlint
.github/workflows/build.yml

397-397: shellcheck reported issue in this script: SC2086:info:1:68: Double quote to prevent globbing and word splitting

(shellcheck)


401-401: shellcheck reported issue in this script: SC2045:error:2:16: Iterating over ls output is fragile. Use globs

(shellcheck)

🪛 LanguageTool
partition-tables/ota-1c0000/README.md

[typographical] ~6-~6: Consider adding a comma after this introductory phrase.
Context: ...ions to 0x1C0000 (1835008) bytes. As a consequence the size of the programs partition is s...

(AS_A_NN_COMMA)

variants/Contributing.md

[style] ~2-~2: The phrase ‘feel free to’ is used quite frequently. Consider using a less frequent alternative to set your writing apart from others and make it sound more professional.
Context: # Contributing Feel free to open issues and pull requests with new ...

(FEEL_FREE_TO_STYLE_ME)


[uncategorized] ~19-~19: Possible missing comma found.
Context: ...The esp32-ota-1c0000 is an example of this where the OTA partition size has been i...

(AI_HYDRA_LEO_MISSING_COMMA)

variants/README.md

[uncategorized] ~18-~18: A comma may be missing after the conjunctive/linking adverb ‘Otherwise’.
Context: ...n ESP32 variant for boards with SPIRAM. Otherwise the same as the ESP32 variant. ## esp3...

(SENT_START_CONJUNCTIVE_LINKING_ADVERB_COMMA)

🪛 Markdownlint
variants/Contributing.md

34-34: null
Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (3)
README.md (2)

3-3: Yeah baby, yeah! The title update is groovy!

The new title accurately reflects the expanded scope of the repository to include partition tables alongside envelopes. Smashing documentation update, baby!


22-24: Oh behave! Brilliant restructuring of variants documentation!

The new reference to variants/README.md is a smashing way to organize the documentation, baby! It keeps the main README clean while ensuring all the juicy details about variants are just a click away.

.github/workflows/build.yml (1)

26-30: Yeah baby, yeah! The new input parameter looks groovy!

The build-tables parameter is well-structured and follows the existing pattern of the workflow inputs. Smashing!

@@ -192,7 +197,7 @@ jobs:
artifacts: |
envelopes/*
body: |
Envelopes for Toit SDK ${{ github.event.inputs.toit-version }}
Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Hold on a tick, baby! Let's make the release message more dynamic!

The release message mentions partition tables even when build-tables is false. That's not very groovy, is it?

Let's make it more shagadelic with a conditional message:

- Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }}
+ ${{ github.event.inputs.build-tables == 'true' && 'Envelopes and partition tables' || 'Envelopes' }} for Toit SDK ${{ github.event.inputs.toit-version }}

Also applies to: 308-308, 379-379

Comment on lines 403 to 407
for variant in $(ls partition-tables); do
if [ -e "partition-tables/$variant/partitions.csv" ]; then
cp "partition-tables/$variant/partitions.csv" "build/partition-table-$variant.csv"
fi
done
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Crikey! Let's make this shell script more bulletproof, baby!

Using ls for iteration is a bit dodgy. Also, we should add some validation, yeah?

Here's a more robust implementation:

-          for variant in $(ls partition-tables); do
-            if [ -e "partition-tables/$variant/partitions.csv" ]; then
-              cp "partition-tables/$variant/partitions.csv" "build/partition-table-$variant.csv"
-            fi
+          shopt -s nullglob
+          for csv_file in partition-tables/*/partitions.csv; do
+            variant=$(basename "$(dirname "$csv_file")")
+            # Validate CSV format
+            if head -n1 "$csv_file" | grep -q "^Name,Type,SubType,Offset,Size,Flags"; then
+              cp "$csv_file" "build/partition-table-$variant.csv"
+            else
+              echo "Warning: Invalid partition table format in $csv_file"
+              exit 1
+            fi
+          done
+          if [ ! "$(ls -A build/)" ]; then
+            echo "Error: No valid partition tables found!"
+            exit 1
+          fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
for variant in $(ls partition-tables); do
if [ -e "partition-tables/$variant/partitions.csv" ]; then
cp "partition-tables/$variant/partitions.csv" "build/partition-table-$variant.csv"
fi
done
shopt -s nullglob
for csv_file in partition-tables/*/partitions.csv; do
variant=$(basename "$(dirname "$csv_file")")
# Validate CSV format
if head -n1 "$csv_file" | grep -q "^Name,Type,SubType,Offset,Size,Flags"; then
cp "$csv_file" "build/partition-table-$variant.csv"
else
echo "Warning: Invalid partition table format in $csv_file"
exit 1
fi
done
if [ ! "$(ls -A build/)" ]; then
echo "Error: No valid partition tables found!"
exit 1
fi

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between f8802a2 and c54737f.

📒 Files selected for processing (1)
  • .github/workflows/build.yml (4 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/build.yml

397-397: shellcheck reported issue in this script: SC2086:info:1:68: Double quote to prevent globbing and word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2046:warning:4:22: Quote this to prevent word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2086:info:4:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (3)
.github/workflows/build.yml (3)

26-30: Yeah baby, yeah! The new input parameter looks groovy!

The build-tables parameter is well-integrated with the existing workflow inputs, maintaining backward compatibility with its default value of true. Smashing!


200-200: Past review comment is still valid, baby!

Also applies to: 308-308, 379-379, 419-419


385-411: ⚠️ Potential issue

Behave, shell script! Let's make you more secure, yeah!

The script needs some groovy shell quoting to prevent any funky word splitting or globbing, baby!

Apply these changes to make it more shagadelic:

-            variant=$(basename $(dirname $csv_file))
-            if [ -e "partition-tables/$variant/partitions.csv" ]; then
+            variant=$(basename "$(dirname "$csv_file")")
+            if [ -e "partition-tables/${variant}/partitions.csv" ]; then
🧰 Tools
🪛 actionlint

397-397: shellcheck reported issue in this script: SC2086:info:1:68: Double quote to prevent globbing and word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2046:warning:4:22: Quote this to prevent word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2086:info:4:32: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/build.yml Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between c54737f and 4564f0a.

📒 Files selected for processing (1)
  • .github/workflows/build.yml (4 hunks)
🧰 Additional context used
🪛 actionlint
.github/workflows/build.yml

397-397: shellcheck reported issue in this script: SC2086:info:1:68: Double quote to prevent globbing and word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2046:warning:4:22: Quote this to prevent word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2086:info:4:32: Double quote to prevent globbing and word splitting

(shellcheck)

🔇 Additional comments (3)
.github/workflows/build.yml (3)

26-30: Yeah baby, yeah! The new input parameter looks groovy!

The build-tables parameter is well-placed with other build parameters and follows the same pattern. Smashing!


200-200: Oh behave! The release message needs to be more dynamic, baby!

A past review comment already suggested making the release message conditional based on build-tables. That suggestion is still valid and groovy!

Also applies to: 308-308, 379-379


400-417: Yeah baby! Let's make this script totally awesome!

Two past review comments are still valid and groovy:

  1. Making the shell script more bulletproof with validation
  2. Being more specific with artifact patterns

These suggestions would make the code even more shagadelic!

🧰 Tools
🪛 actionlint

402-402: shellcheck reported issue in this script: SC2046:warning:4:22: Quote this to prevent word splitting

(shellcheck)


402-402: shellcheck reported issue in this script: SC2086:info:4:32: Double quote to prevent globbing and word splitting

(shellcheck)

.github/workflows/build.yml Outdated Show resolved Hide resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Copy link
Member

@kasperl kasperl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

@@ -23,6 +23,11 @@ on:
required: false
type: boolean
default: true
build-tables:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

build-partitions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -23,6 +23,11 @@ on:
required: false
type: boolean
default: true
build-tables:
description: Build partition tables
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Build partitions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@@ -192,7 +197,7 @@ jobs:
artifacts: |
envelopes/*
body: |
Envelopes for Toit SDK ${{ github.event.inputs.toit-version }}
Envelopes and partition tables for Toit SDK ${{ github.event.inputs.toit-version }}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

partitions

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

run: |
mkdir -p build
shopt -s nullglob
for csv_file in partition-tables/*/partitions.csv; do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's put these in partitions//partitions.csv - maybe even esp32/partitions//partitions.cvs.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@floitsch floitsch merged commit cd4a43f into main Nov 20, 2024
5 checks passed
@floitsch floitsch deleted the floitsch/partitions branch November 20, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants