Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
83 changes: 83 additions & 0 deletions .github/membrowse-targets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
[
{
"target_name": "stm32-nucleo-f103rb",
"board_config": "nucleo-f103rb:nsh",
"elf": "nuttx",
"ld": "boards/arm/stm32/nucleo-f103rb/scripts/ld.script",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "arduino-mega2560",
"board_config": "arduino-mega2560:nsh",
"elf": "nuttx.elf",
"ld": "boards/avr/atmega/arduino-mega2560/scripts/flash.ld",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "qemu-armv8a",
"board_config": "qemu-armv8a:nsh",
"elf": "nuttx",
"ld": "",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "mirtoo",
"board_config": "mirtoo:nsh",
"elf": "nuttx",
"ld": "boards/mips/pic32mx/mirtoo/scripts/pinguino-debug.ld",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": "-d MIPS32_TOOLCHAIN_GNU_ELF -e MIPS32_TOOLCHAIN_PINGUINOL"
},
{
"target_name": "hifive1-revb",
"board_config": "hifive1-revb:nsh",
"elf": "nuttx",
"ld": "boards/risc-v/fe310/hifive1-revb/scripts/ld.script",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "rx65n-rsk2mb",
"board_config": "rx65n-rsk2mb:nsh",
"elf": "nuttx",
"ld": "boards/renesas/rx65n/rx65n-rsk2mb/scripts/linker_script.ld",
"map_file": "",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "s698pm-dkit",
"board_config": "s698pm-dkit:nsh",
"elf": "nuttx",
"ld": "",
"map_file": "",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "qemu-intel64",
"board_config": "qemu-intel64:nsh",
"elf": "nuttx",
"ld": "",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
},
{
"target_name": "esp32-devkitc",
"board_config": "esp32-devkitc:nsh",
"elf": "nuttx",
"ld": "boards/xtensa/esp32/common/scripts/flat_memory.ld.tmp boards/xtensa/esp32/common/scripts/esp32_sections.ld.tmp",
"map_file": "nuttx.map",
"linker_vars": "",
"config_overrides": ""
}
]
42 changes: 42 additions & 0 deletions .github/workflows/membrowse-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: MemBrowse PR Comment

on:
workflow_run:
workflows: [MemBrowse Memory Report]
types:
- completed

jobs:
comment:
runs-on: ubuntu-latest
if: >
github.event.workflow_run.event == 'pull_request' &&
github.event.workflow_run.conclusion != 'cancelled'
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v5

- uses: actions/setup-python@v6
with:
python-version: '3.11'

- name: Install membrowse
run: pip install --no-cache-dir membrowse

- name: Post combined PR comment
if: ${{ env.MEMBROWSE_API_KEY != '' }}
env:
MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }}
MEMBROWSE_API_URL: ${{ vars.MEMBROWSE_API_URL }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
run: |
SUMMARY_ARGS=("$HEAD_SHA" --api-key "$MEMBROWSE_API_KEY" --json)
if [ -n "$MEMBROWSE_API_URL" ]; then
SUMMARY_ARGS+=(--api-url "$MEMBROWSE_API_URL")
fi
membrowse summary "${SUMMARY_ARGS[@]}" > /tmp/membrowse-summary.json
python -m membrowse.utils.github_comment --summary-json /tmp/membrowse-summary.json
98 changes: 98 additions & 0 deletions .github/workflows/membrowse-onboard.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: Onboard to MemBrowse

on:
workflow_dispatch:
inputs:
num_commits:
description: 'Number of commits to process'
required: true
default: '100'
type: string

jobs:
load-targets:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- uses: actions/checkout@v6
- id: set-matrix
run: echo "matrix=$(jq -c '.' .github/membrowse-targets.json)" >> $GITHUB_OUTPUT

onboard:
needs: load-targets
runs-on: ubuntu-latest
container:
image: ghcr.io/apache/nuttx/apache-nuttx-ci-linux
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.load-targets.outputs.matrix) }}

steps:
- name: Checkout nuttx
uses: actions/checkout@v6
with:
fetch-depth: 0

- name: Clone nuttx-apps
run: |
git config --global --add safe.directory '*'
git clone --depth=1 https://github.com/apache/nuttx-apps.git ../apps

- name: Install membrowse
run: python3 -m pip install --no-cache-dir membrowse

- name: Fetch full git history
run: |
git fetch --unshallow || true
git fetch --all

- name: Run MemBrowse Onboard
env:
MEMBROWSE_API_KEY: ${{ secrets.MEMBROWSE_API_KEY }}
MEMBROWSE_API_URL: ${{ vars.MEMBROWSE_API_URL }}
NUM_COMMITS: ${{ github.event.inputs.num_commits }}
TARGET_NAME: ${{ matrix.target_name }}
ELF: ${{ matrix.elf }}
LD: ${{ matrix.ld }}
MAP_FILE: ${{ matrix.map_file }}
LINKER_VARS: ${{ matrix.linker_vars }}
run: |
BUILD_SCRIPT=$(cat <<'BUILD_EOF'
./tools/configure.sh -l ${{ matrix.board_config }}
echo CONFIG_DEBUG_SYMBOLS=y >> .config
echo CONFIG_DEBUG_LINK_MAP=y >> .config
if [ -n "${{ matrix.config_overrides }}" ]; then
kconfig-tweak ${{ matrix.config_overrides }}
fi
make olddefconfig
find arch -name Makefile -exec sed -i '/DELFILE, $(addsuffix .tmp,$(ARCHSCRIPT))/d' {} +
trap 'git checkout -- arch/' EXIT
make -j$(nproc)
BUILD_EOF
)

ARGS=("$NUM_COMMITS" "$BUILD_SCRIPT" "$ELF" "$TARGET_NAME" "$MEMBROWSE_API_KEY")
if [ -n "$MEMBROWSE_API_URL" ]; then
ARGS+=(--api-url "$MEMBROWSE_API_URL")
fi
if [ -n "$LD" ]; then
ARGS+=(--ld-scripts "$LD")
fi
if [ -n "$LINKER_VARS" ]; then
set -f
for var in $LINKER_VARS; do
ARGS+=(--def "$var")
done
set +f
fi
if [ -n "$MAP_FILE" ]; then
ARGS+=(--map-file "$MAP_FILE")
fi
ARGS+=(--binary-search)

membrowse onboard "${ARGS[@]}"
Loading
Loading