Skip to content
Merged
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
205 changes: 0 additions & 205 deletions .github/workflows/firmware_build.yml

This file was deleted.

89 changes: 89 additions & 0 deletions .github/workflows/firmware_build_only.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: "Firmware Build and Test"

on:
workflow_call:
outputs:
artifact_name:
description: "Name of the uploaded artifact"
value: ${{ jobs.build.outputs.artifact_name }}
action_date:
description: "Build date timestamp"
value: ${{ jobs.build.outputs.action_date }}
release_version:
description: "Git tag version if exists"
value: ${{ jobs.build.outputs.release_version }}
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
outputs:
artifact_name: nightly_firmware
action_date: ${{ steps.set_env.outputs.action_date }}
release_version: ${{ steps.set_env.outputs.release_version }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
with:
submodules: 'recursive'

- name: Build Docker image containing toolchains
run: docker build -t my-image .

- name: Run script in Docker container
run: docker run -v $PWD:/project -w /project/ my-image sh -c "cd Firmware && idf.py build"

- name: Run Unit Tests
run: |
cd Firmware/components/knot_midi_translator/host_test/
./test.sh
./test.sh >> test.txt

- name: Convert to uf2
run: |
cd Firmware
sudo python3 ./tools/uf2conv.py -f ESP32S3 ./build/midi_host_fw.bin -b 0x0 -c -o ./output/midi_host_fw.uf2

- name: Set env
id: set_env
shell: bash
run: |
ACTION_DATE=$(date +'%Y-%m-%d-%H%M')
RELEASE_VERSION=$(git tag --contains ${{ github.sha }})
echo "ACTION_DATE=$ACTION_DATE" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "action_date=$ACTION_DATE" >> $GITHUB_OUTPUT
echo "release_version=$RELEASE_VERSION" >> $GITHUB_OUTPUT

- name: Copy and rename the artifacts
run: |
ls
cp Firmware/output/midi_host_fw.uf2 knot_esp32_release_${{ env.ACTION_DATE }}.uf2
cp Firmware/output/midi_host_fw.uf2 knot_esp32_nightly_${{ env.ACTION_DATE }}.uf2
cp Firmware/output/midi_host_fw.uf2 knot_esp32_nightly.uf2

- name: Upload nightly artifacts
uses: actions/upload-artifact@v4
with:
name: nightly_firmware
path: |
knot_esp32_nightly_${{ env.ACTION_DATE }}.uf2
knot_esp32_nightly.uf2

- name: Zipping artifacts for Github Release
uses: vimtor/action-zip@v1
if: ${{ env.RELEASE_VERSION != '' }}
with:
files: knot_esp32_release_${{ env.ACTION_DATE }}.uf2
dest: knot_release.zip

- name: Release
uses: softprops/action-gh-release@v1
if: ${{ env.RELEASE_VERSION != '' }}
with:
tag_name: ${{ env.RELEASE_VERSION }}
name: Knot ${{ env.RELEASE_VERSION }} (${{ env.ACTION_DATE }})
files: knot_release.zip
draft: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42 changes: 42 additions & 0 deletions .github/workflows/firmware_deploy_preview.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: "Firmware Deploy to Preview"

on:
workflow_call:
workflow_dispatch:

jobs:
deploy-results:
runs-on: ubuntu-latest
steps:
- name: Checkout preview branch
uses: actions/checkout@v2
with:
ref: preview

- name: Download reports' artifacts
uses: actions/download-artifact@v4
with:
path: download

- name: Collecting files
run: |

# Create the temp folder if it doesn't exist
mkdir -p Preview/Firmware

# Loop through each subdirectory in the download folder
for subdirectory in download/*; do
# Check if it is a directory
if [ -d "$subdirectory" ]; then
# Copy the contents of the subdirectory to the temp folder
cp -r "$subdirectory"/* "Preview/Firmware/"
fi
done

- name: Commit the files
run: |
git config --global user.name ${{ github.actor }}
git config --global user.email ${{ github.actor }}@users.noreply.github.com
git add Preview/*
git commit -m "BOT ${{ github.workflow }} ${{ github.sha }}"
git push
Loading