Skip to content

Commit cd52a4c

Browse files
committed
Add a ci check for building w/ component
1 parent c758473 commit cd52a4c

File tree

2 files changed

+39
-10
lines changed

2 files changed

+39
-10
lines changed

.github/workflows/ci.yml

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,12 @@ on:
1111

1212
jobs:
1313
build:
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-latest
1515
container:
16-
image: espressif/idf:release-v5.0
16+
image: espressif/idf:release-v5.3
1717

1818
steps:
19-
- uses: actions/checkout@v3
19+
- uses: actions/checkout@v4
2020
with:
2121
submodules: recursive
2222

@@ -28,7 +28,32 @@ jobs:
2828
idf.py build
2929
3030
- name: Archive release
31-
uses: actions/upload-artifact@v3
31+
uses: actions/upload-artifact@v4
3232
with:
3333
name: elf
3434
path: build/*.elf.memfault_log_fmt
35+
36+
build-with-component:
37+
runs-on: ubuntu-latest
38+
container:
39+
image: espressif/idf:release-v5.3
40+
41+
steps:
42+
- uses: actions/checkout@v4
43+
44+
- name: Build
45+
run: |
46+
# set a phony project key
47+
echo "CONFIG_MEMFAULT_PROJECT_KEY=\"1234\"" >> sdkconfig.defaults
48+
. ${IDF_PATH}/export.sh
49+
50+
# add the Memfaut component
51+
idf.py add-dependency "memfault/memfault-firmware-sdk^1.15.0"
52+
53+
MEMFAULT_SDK_COMPONENT=1 idf.py build
54+
55+
- name: Archive release
56+
uses: actions/upload-artifact@v4
57+
with:
58+
name: elf.component
59+
path: build/*.elf.memfault_log_fmt

CMakeLists.txt

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,17 @@ if(DEFINED IDF_VERSION_MAJOR)
1515
endif()
1616
endif()
1717

18-
# Look for the Memfault SDK in a subdirectory first, when this app is used
19-
# standalone (not from within the Memfault SDK)
20-
get_filename_component(memfault_firmware_sdk_dir third-party/memfault-firmware-sdk ABSOLUTE)
21-
if(NOT EXISTS ${memfault_firmware_sdk_dir})
22-
get_filename_component(memfault_firmware_sdk_dir ../../../../ ABSOLUTE)
18+
# Pull in the Memfault SDK if we're not building as a component, indicated by
19+
# the absence of the MEMFAULT_SDK_COMPONENT env var.
20+
if(NOT DEFINED ENV{MEMFAULT_SDK_COMPONENT})
21+
# Look for the Memfault SDK in a subdirectory first, when this app is used
22+
# standalone (not from within the Memfault SDK)
23+
get_filename_component(memfault_firmware_sdk_dir third-party/memfault-firmware-sdk ABSOLUTE)
24+
if(NOT EXISTS ${memfault_firmware_sdk_dir})
25+
get_filename_component(memfault_firmware_sdk_dir ../../../../ ABSOLUTE)
26+
endif()
27+
include(${memfault_firmware_sdk_dir}/ports/esp_idf/memfault.cmake)
2328
endif()
24-
include(${memfault_firmware_sdk_dir}/ports/esp_idf/memfault.cmake)
2529

2630
# NOTE: This include also applies global compiler options, make sure
2731
# this happens first before defining other targets!

0 commit comments

Comments
 (0)