add project build automation
This commit is contained in:
parent
39411efb87
commit
399afa8828
7 changed files with 229 additions and 0 deletions
60
.github/workflows/build.yml
vendored
Normal file
60
.github/workflows/build.yml
vendored
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
name: Build ESP32 Application
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
board:
|
||||
description: 'Board to build for (all or specific board name)'
|
||||
required: true
|
||||
default: 'all'
|
||||
prefix:
|
||||
description: 'Prefix for binary name'
|
||||
required: true
|
||||
default: 'esp32-c3-lua-test'
|
||||
flash_size:
|
||||
description: 'Size of the Flash storage'
|
||||
required: true
|
||||
default: '4MB'
|
||||
data_partition:
|
||||
description: 'Name of data partition'
|
||||
required: true
|
||||
default: 'assets'
|
||||
|
||||
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
board: [esp32c3-devkit, esp32c2-devkit]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout repo
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set Target for ESP-IDF
|
||||
run: |
|
||||
echo "TARGET=$(case ${{ matrix.board }} in
|
||||
esp32c3-devkit) echo 'esp32c3';;
|
||||
esp32c3-devkit) echo 'esp32c2';;
|
||||
*) echo 'Unknown target'; exit 1;;
|
||||
esac)" >> $GITHUB_ENV
|
||||
|
||||
- name: esp-idf build and merge binaries
|
||||
uses: espressif/esp-idf-ci-action@v1.1.0
|
||||
with:
|
||||
esp_idf_version: latest
|
||||
target: ${{ env.TARGET }}
|
||||
path: '.'
|
||||
command: |
|
||||
idf.py build &&
|
||||
cd build.${{ matrix.board }} &&
|
||||
esptool.py --chip ${{ env.TARGET }} merge_bin -o ${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin "@flash_args"
|
||||
|
||||
- name: Upload Build Artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin
|
||||
path: build.${{ matrix.board }}/${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin
|
||||
75
.github/workflows/release.yml
vendored
Normal file
75
.github/workflows/release.yml
vendored
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
name: Create GitHub Release
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
release_name:
|
||||
description: 'Name of the GitHub Release'
|
||||
required: true
|
||||
default: 'v1.0.0'
|
||||
release_tag:
|
||||
description: 'Tag for the GitHub Release'
|
||||
required: true
|
||||
default: 'v1.0.0'
|
||||
prefix:
|
||||
description: 'Prefix for binary name'
|
||||
required: true
|
||||
default: 'esp32-c3-lua-test'
|
||||
|
||||
jobs:
|
||||
create-release:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install GitHub CLI
|
||||
run: sudo apt-get install gh
|
||||
|
||||
- name: Authenticate GitHub CLI
|
||||
run: gh auth login --with-token <<< "${{ secrets.GITHUB_TOKEN }}"
|
||||
|
||||
- name: Check if Release Exists
|
||||
id: check_release
|
||||
run: |
|
||||
set +e
|
||||
gh release view ${{ github.event.inputs.release_tag }} > /dev/null 2>&1
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Release already exists."
|
||||
echo "release_exists=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "Release does not exist."
|
||||
echo "release_exists=false" >> $GITHUB_ENV
|
||||
fi
|
||||
set -e
|
||||
|
||||
- name: Create Release
|
||||
if: env.release_exists == 'false'
|
||||
run: |
|
||||
gh release create ${{ github.event.inputs.release_tag }} --title "${{ github.event.inputs.release_name }}" --prerelease
|
||||
|
||||
- name: Download Build Artifacts
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: build.yml
|
||||
path: artifacts
|
||||
|
||||
- name: List Downloaded Files
|
||||
run: |
|
||||
echo "Listing all files in the artifacts directory:"
|
||||
find artifacts -type f
|
||||
|
||||
- name: Rename and Upload Assets to Release
|
||||
run: |
|
||||
# List all binary files in the artifacts directory
|
||||
for file in $(find artifacts -type f -name "*.bin"); do
|
||||
# Extract board name from the directory structure
|
||||
board_name=$(basename "$file" | sed -n "s/${{ github.event.inputs.prefix }}-\(.*\)\.bin/\1/p")
|
||||
# Define the versioned asset name
|
||||
asset_name="${{ github.event.inputs.prefix }}-${{ github.event.inputs.release_tag }}-${board_name}.bin"
|
||||
# Upload the artifact to the release
|
||||
gh release upload "${{ github.event.inputs.release_tag }}" "$file#${asset_name}" --clobber
|
||||
done
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
46
.github/workflows/test.yml
vendored
Normal file
46
.github/workflows/test.yml
vendored
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
name: Test ESP32 Application
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
prefix:
|
||||
description: 'Prefix for binary name'
|
||||
required: true
|
||||
default: 'esp32-c3-lua-test'
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
board: [esp32c3-devkit]
|
||||
fail-fast: false
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Download artifact
|
||||
id: download-artifact
|
||||
uses: dawidd6/action-download-artifact@v6
|
||||
with:
|
||||
workflow: build.yml
|
||||
name: ${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin
|
||||
path: build.${{ matrix.board }}
|
||||
|
||||
- name: Setup Wokwi CLI
|
||||
uses: wokwi/wokwi-ci-action@v1
|
||||
with:
|
||||
token: ${{ secrets.WOKWI_CLI_TOKEN }}
|
||||
path: boards/${{ matrix.board }}
|
||||
elf: build.${{ matrix.board }}/${{ github.event.inputs.prefix }}-${{ matrix.board }}.bin
|
||||
timeout: 30000
|
||||
expect_text: 'Closing Lua'
|
||||
fail_text: 'Error'
|
||||
serial_log_file: 'wokwi-logs-${{ matrix.board }}.txt'
|
||||
|
||||
- name: Upload Wokwi Logs
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: wokwi-logs-${{ matrix.board }}
|
||||
path: wokwi-logs-${{ matrix.board }}.txt
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -1,3 +1,6 @@
|
|||
|
||||
build/
|
||||
managed_components/
|
||||
dependencies.lock
|
||||
sdkconfig
|
||||
|
||||
|
|
|
|||
15
.vscode/launch.json
vendored
Normal file
15
.vscode/launch.json
vendored
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Wokwi GDB",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceFolder}/build/esp32-c3-lua-test.elf",
|
||||
"cwd": "${workspaceFolder}",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "${command:espIdf.getToolchainGdb}",
|
||||
"miDebuggerServerAddress": "localhost:3333"
|
||||
}
|
||||
]
|
||||
}
|
||||
23
diagram.json
Normal file
23
diagram.json
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
{
|
||||
"version": 1,
|
||||
"author": "Uri Shaked",
|
||||
"editor": "wokwi",
|
||||
"parts": [
|
||||
{
|
||||
"type": "board-esp32-c3-devkitm-1",
|
||||
"id": "esp"
|
||||
}
|
||||
],
|
||||
"connections": [
|
||||
[
|
||||
"esp:TX",
|
||||
"$serialMonitor:RX",
|
||||
""
|
||||
],
|
||||
[
|
||||
"esp:RX",
|
||||
"$serialMonitor:TX",
|
||||
""
|
||||
]
|
||||
]
|
||||
}
|
||||
7
wokwi.toml
Normal file
7
wokwi.toml
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Wokwi Configuration File
|
||||
# Reference: https://docs.wokwi.com/vscode/project-config
|
||||
[wokwi]
|
||||
version = 1
|
||||
firmware = 'build/flasher_args.json'
|
||||
elf = 'build/esp32-c3-lua-test.elf'
|
||||
gdbServerPort=3333
|
||||
Loading…
Add table
Add a link
Reference in a new issue