-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Optimize PG struct field ordering to eliminate alignment padding #11401
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
Draft
sensei-hacker
wants to merge
16
commits into
iNavFlight:maintenance-10.x
Choose a base branch
from
sensei-hacker:optimize/pg-struct-alignment
base: maintenance-10.x
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
c4d4d88
Remove legacy hdzero special case
mmosca cb834eb
NEW_HARDWARE_POLICY.md: Use Discord rather than email
sensei-hacker 1d370a6
Add SDMODELH7V2 target (STM32H743)
sensei-hacker 3a93f24
SDMODELH7V2: replace camera control with USER1/USER2 PINIO, preset UA…
sensei-hacker e17b50b
SDMODELH7V2: COnfigure PINIO and Bluetooth arming control
sensei-hacker 9e4bb24
Merge pull request #11341 from sensei-hacker/target/sdmodelh7v2
sensei-hacker d91f591
Merge pull request #11333 from iNavFlight/sensei-hacker-patch-6
sensei-hacker 7ec7f0d
Remove HD_3016 from resolutionType_e enum
sensei-hacker cfdcbeb
Merge pull request #10540 from iNavFlight/mmosca-remove-hdzero-specia…
sensei-hacker b52c6f7
CI: publish PR test builds to iNavFlight/pr-test-builds
sensei-hacker 37e02bd
CI: address code review findings in pr-test-builds workflow
sensei-hacker 7cbd46a
Merge pull request #11381 from sensei-hacker/feature/pr-test-builds
sensei-hacker 8099ece
Merge pull request #11382 from iNavFlight/maintenance-9.x
sensei-hacker c7edbc3
CI: fix YAML syntax error in pr-test-builds workflow
sensei-hacker 359c2c7
optimize: reorder PG struct fields to eliminate alignment padding
sensei-hacker c9c1905
optimize: remove redundant section label comments from pidProfile_s
sensei-hacker 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
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,153 @@ | ||
| name: PR Test Builds | ||
|
|
||
| # Runs after "Build firmware" completes. Uses workflow_run (rather than | ||
| # pull_request directly) so that secrets are available even for PRs from forks. | ||
| # | ||
| # Requires a repository secret PR_BUILDS_TOKEN with Contents: write access | ||
| # to iNavFlight/pr-test-builds (fine-grained PAT or classic PAT with repo scope). | ||
| on: | ||
| workflow_run: | ||
| workflows: ["Build firmware"] | ||
| types: [completed] | ||
|
|
||
| jobs: | ||
| publish: | ||
| runs-on: ubuntu-latest | ||
| # Only act on pull_request-triggered runs that succeeded. | ||
| if: > | ||
| github.event.workflow_run.event == 'pull_request' && | ||
| github.event.workflow_run.conclusion == 'success' | ||
| # Prevent concurrent runs for the same PR branch racing on the | ||
| # release delete/create cycle. | ||
| concurrency: | ||
| group: pr-test-build-${{ github.event.workflow_run.head_repository.full_name }}-${{ github.event.workflow_run.head_branch }} | ||
| cancel-in-progress: true | ||
| permissions: | ||
| actions: read # to download artifacts from the triggering workflow run | ||
| issues: write # github.rest.issues.* endpoints used to post PR comments | ||
| pull-requests: write # to post the PR comment | ||
|
|
||
| steps: | ||
| - name: Download PR number | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| name: pr-number | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Read PR number | ||
| id: pr | ||
| run: | | ||
| PR_NUM=$(tr -dc '0-9' < pr_number.txt) | ||
| if [ -z "$PR_NUM" ]; then | ||
| echo "::error::Invalid PR number in artifact" | ||
| exit 1 | ||
| fi | ||
| echo "number=${PR_NUM}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Download firmware artifacts | ||
| uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: matrix-inav-* | ||
| merge-multiple: true | ||
| path: hexes | ||
| run-id: ${{ github.event.workflow_run.id }} | ||
| github-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
|
||
| - name: Get build info | ||
| id: info | ||
| run: | | ||
| COUNT=$(find hexes -name '*.hex' -type f | wc -l) | ||
| if [ "$COUNT" -eq 0 ]; then | ||
| echo "::error::No .hex files found in downloaded artifacts" | ||
| exit 1 | ||
| fi | ||
| echo "count=${COUNT}" >> $GITHUB_OUTPUT | ||
| echo "short_sha=$(echo '${{ github.event.workflow_run.head_sha }}' | cut -c1-7)" >> $GITHUB_OUTPUT | ||
|
|
||
| # Delete the previous release for this PR (if any) so assets are replaced | ||
| # cleanly on each new commit. --cleanup-tag removes the old tag so it is | ||
| # recreated fresh pointing to the new commit. | ||
| - name: Delete existing PR release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.PR_BUILDS_TOKEN }} | ||
| run: | | ||
| gh release delete "pr-${{ steps.pr.outputs.number }}" \ | ||
| --repo iNavFlight/pr-test-builds --cleanup-tag --yes 2>/dev/null || true | ||
|
|
||
| - name: Create PR release | ||
| env: | ||
| GH_TOKEN: ${{ secrets.PR_BUILDS_TOKEN }} | ||
| PR_NUMBER: ${{ steps.pr.outputs.number }} | ||
| SHORT_SHA: ${{ steps.info.outputs.short_sha }} | ||
| HEX_COUNT: ${{ steps.info.outputs.count }} | ||
| HEAD_SHA: ${{ github.event.workflow_run.head_sha }} | ||
| REPO: ${{ github.repository }} | ||
| run: | | ||
| PR_URL="https://github.com/${REPO}/pull/${PR_NUMBER}" | ||
| printf '%s\n\n%s\n\n%s\n' \ | ||
| "Test build for [PR #${PR_NUMBER}](${PR_URL}) — commit \`${SHORT_SHA}\`" \ | ||
| "**${HEX_COUNT} targets built.** Find your board's \`.hex\` file by name (e.g. \`MATEKF405SE.hex\`)." \ | ||
| "> Development build for testing only. Use Full Chip Erase when flashing." \ | ||
| > release-notes.md | ||
| gh release create "pr-${PR_NUMBER}" hexes/*.hex \ | ||
| --repo iNavFlight/pr-test-builds \ | ||
| --prerelease \ | ||
| --target "${HEAD_SHA}" \ | ||
| --title "PR #${PR_NUMBER} (${SHORT_SHA})" \ | ||
| --notes-file release-notes.md | ||
|
|
||
| - name: Post or update PR comment | ||
| uses: actions/github-script@v7 | ||
| env: | ||
| PR_NUMBER: ${{ steps.pr.outputs.number }} | ||
| SHORT_SHA: ${{ steps.info.outputs.short_sha }} | ||
| HEX_COUNT: ${{ steps.info.outputs.count }} | ||
| with: | ||
| script: | | ||
| const prNumber = parseInt(process.env.PR_NUMBER, 10); | ||
| if (isNaN(prNumber)) throw new Error(`Invalid PR number: ${process.env.PR_NUMBER}`); | ||
| const shortSha = process.env.SHORT_SHA; | ||
| const count = process.env.HEX_COUNT; | ||
| const releaseUrl = `https://github.com/iNavFlight/pr-test-builds/releases/tag/pr-${prNumber}`; | ||
|
|
||
| const body = [ | ||
| '<!-- pr-test-build -->', | ||
| '**Test firmware build ready** — commit `' + shortSha + '`', | ||
| '', | ||
| `[Download firmware for PR #${prNumber}](${releaseUrl})`, | ||
| '', | ||
| `${count} targets built. Find your board's \`.hex\` file by name on that page ` + | ||
| '(e.g. `MATEKF405SE.hex`). Files are individually downloadable — no GitHub login required.', | ||
| '', | ||
| '> Development build for testing only. Use Full Chip Erase when flashing.', | ||
| ].join('\n'); | ||
|
|
||
| const comments = await github.paginate( | ||
| github.rest.issues.listComments, | ||
| { | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| } | ||
| ); | ||
|
|
||
| const existing = comments.find(c => | ||
| c.user.type === 'Bot' && c.body.includes('<!-- pr-test-build -->') | ||
| ); | ||
|
|
||
| if (existing) { | ||
| await github.rest.issues.updateComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| comment_id: existing.id, | ||
| body, | ||
| }); | ||
| } else { | ||
| await github.rest.issues.createComment({ | ||
| owner: context.repo.owner, | ||
| repo: context.repo.repo, | ||
| issue_number: prNumber, | ||
| body, | ||
| }); | ||
| } |
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
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
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.