Skip to content

Commit

Permalink
Merge pull request #20 from emfcamp/build-ota-images
Browse files Browse the repository at this point in the history
Build OTA images in GitHub actions
  • Loading branch information
MatthewWilkes authored May 6, 2024
2 parents 2273237 + 65bddc9 commit d97da14
Show file tree
Hide file tree
Showing 2 changed files with 89 additions and 4 deletions.
85 changes: 85 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build Micropython
on:
pull_request:
workflow_dispatch:
push:
tags:
- "v*"
env:
TARGET: esp32s3
IDF_TARGET: esp32s3
jobs:
Build-Firmware:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential python3-pip python3-pillow libusb-1.0-0-dev cmake
- name: Check out driver code
uses: actions/checkout@v2
with:
submodules: true
- name: Check out ESP IDF
uses: actions/checkout@v2
with:
repository: espressif/esp-idf
ref: v5.2.1
path: esp-idf
submodules: true
- name: Install SDK
run: |
cd esp-idf
./install.sh
source export.sh
python3 -m pip install pillow
- name: Patch submodule dependencies
run: |
./scripts/firstTime.sh
- name: Build cross compiler
run: |
source esp-idf/export.sh
cd micropython
make -C mpy-cross
- name: Link board definition
run: |
source esp-idf/export.sh
cd micropython/ports/esp32/boards
ln -sfn ../../../../tildagon ./tildagon
- name: Build firmware
run: |
source esp-idf/export.sh
ln -sfn $GITHUB_WORKSPACE/tildagon micropython/ports/esp32/boards/tildagon
cd micropython/ports/esp32
make submodules BOARD=tildagon USER_C_MODULES=$GITHUB_WORKSPACE/drivers/micropython.cmake TARGET=esp32s3
make BOARD=tildagon USER_C_MODULES=$GITHUB_WORKSPACE/drivers/micropython.cmake $@ TARGET=esp32s3
cd ../../..
echo "{\"build\":\"$(git describe --tags --always)\", \"name\":\"$(git describe --tags --always)\"}" > micropython/ports/esp32/build-tildagon/tildagon.txt
- name: Archive firmware
uses: actions/upload-artifact@v3
with:
name: firmware
path: |
micropython/ports/esp32/build-tildagon/micropython.bin
micropython/ports/esp32/build-tildagon/bootloader/bootloader.bin
micropython/ports/esp32/build-tildagon/partition_table/partition-table.bin
micropython/ports/esp32/build-tildagon/ota_data_initial.bin
micropython/ports/esp32/build-tildagon/tildagon.txt
- name: Create latest release for tags
uses: "marvinpinto/action-automatic-releases@latest"
if: github.event_name == 'push'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
title: "Latest release build"
files: |
micropython/ports/esp32/build-tildagon/micropython.bin
micropython/ports/esp32/build-tildagon/tildagon.txt
- name: Create specific release for tags
uses: "marvinpinto/action-automatic-releases@latest"
if: github.event_name == 'push'
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
files: |
micropython/ports/esp32/build-tildagon/micropython.bin
micropython/ports/esp32/build-tildagon/tildagon.txt
8 changes: 4 additions & 4 deletions components/st3m/host-tools/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@


def get_git_based_version():
os.chdir("/firmware")
root = os.environ.get('GITHUB_WORKSPACE', '/firmware')
os.chdir(root)
return subprocess.check_output(
["git", "describe", "--tags", "--always"]
).decode().strip()
Expand All @@ -27,10 +28,9 @@ def get_git_based_version():

v = None
if os.environ.get('CI') is not None:
tag = os.environ.get('CI_COMMIT_TAG')
if tag is not None:
if os.environ.get('GITHUB_REF_TYPE') == 'tag':
# If we're building a tag, just use that as a version.
v = tag
v = os.environ.get('GITHUB_REF_NAME')
if v is None:
v = get_git_based_version()

Expand Down

0 comments on commit d97da14

Please sign in to comment.