Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
noahp committed Jul 19, 2024
0 parents commit cb61d42
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Stub main to generate a tiny, valid symbol file for testing upload.
// To generate the symbol file, run:
//
// arm-none-eabi-gcc -Os -g1 -mcpu=cortex-m4 -ffreestanding -nostdlib -Wl,--entry=main main.c -o test.elf
//
// NOTE: the above command uses "-g1" to omit macros from the .debug_str
// sections. "-g3" is always preferred for real world use cases.

int main() {
return 0;
}
Binary file added .github/workflows/test.elf
Binary file not shown.
28 changes: 28 additions & 0 deletions .github/workflows/test_action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Test Action
# Run on PRs targeting main, and push to main
on:
pull_request:
branches:
- main
push:
branches:
- main
# also support on workflow_dispatch
workflow_dispatch:

jobs:
test-action:
runs-on: ubuntu-latest
name: Run a test of the action
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Test action
id: test_action
uses: ./ # Uses an action in the root directory
with:
MEMFAULT_ORG_TOKEN: ${{ secrets.MEMFAULT_ORG_TOKEN }}
MEMFAULT_ORG_SLUG: ${{ secrets.MEMFAULT_ORG_SLUG }}
MEMFAULT_PROJECT_SLUG: ${{ secrets.MEMFAULT_PROJECT_SLUG }}
symbol_file: ./github/workflows/test.elf
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Memfault Upload Symbol File GitHub Action

This action uploads a symbol file to Memfault's symbol file service.

## Inputs

> [!TIP]
>
> The `MEMFAULT_ORG_TOKEN`, `MEMFAULT_ORG_SLUG`, and `MEMFAULT_PROJECT_SLUG`
> should be set as GitHub secrets.
| Name | Description | Required | Default |
| ----------------------- | -------------------------------------------------------------------------------------------------------------- | -------- | ------- |
| `MEMFAULT_ORG_TOKEN` | Organization Auth Token. Generate one [here](https://app.memfault.com/organizations/-/settings/auth-tokens) | true | |
| `MEMFAULT_ORG_SLUG` | Memfault Org Slug | true | |
| `MEMFAULT_PROJECT_SLUG` | Memfault Project Slug | true | |
| `symbol_file` | Path to the symbol file | true | |
| `memfault_cli_version` | Memfault CLI Version | true | 1.0.11 |

Find more documentation here: [Memfault Docs](https://docs.memfault.com/docs/ci/uploading-symbols).
43 changes: 43 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: 'Memfault Upload Symbol Files Action'

description: 'Upload symbol files to Memfault'

inputs:
MEMFAULT_ORG_TOKEN:
description: 'Organization Auth Token. Generate one at https://app.memfault.com/organizations/-/settings/auth-tokens'
required: true
MEMFAULT_ORG_SLUG:
description: 'Memfault Org Slug'
required: true
MEMFAULT_PROJECT_SLUG:
description: 'Memfault Project Slug'
required: true

symbol_file:
description: 'Path to the symbol file'
required: true
memfault_cli_version:
description: 'Memfault CLI Version'
required: true
default: "1.0.11"

runs:
using: 'composite'
steps:
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.10'

- name: Install Dependencies
shell: bash
run: pip install memfault-cli==${{ inputs.memfault_cli_version }}

- name: Upload the symbol file
shell: bash
run: |
memfault \
--org-token ${{ inputs.MEMFAULT_ORG_TOKEN }} \
--org ${{ inputs.MEMFAULT_ORG_SLUG }} \
--project ${{ inputs.MEMFAULT_PROJECT_SLUG }} \
upload-mcu-symbols ${{ inputs.symbol_file }}

0 comments on commit cb61d42

Please sign in to comment.