Skip to content

Brycey92 is building both firmware and emulator #276

Brycey92 is building both firmware and emulator

Brycey92 is building both firmware and emulator #276

name: Build Firmware and Emulator
run-name: ${{ github.actor }} is building both firmware and emulator
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
FIRMWARE_ARTIFACT: swadge2024-firmware
EMULATOR_ARTIFACT: swadge2024-emulator
jobs:
Build-Firmware-And-Emulator:
runs-on: windows-latest
steps:
# - name: Debug print event
# run: echo '${{ toJSON(github.event) }}'
- name: Check out repository code
uses: actions/checkout@v3
- name: Create a version file
run: |
printf "Commit: https://github.com/AEFeinstein/Swadge-IDF-5.0/commit/$(git rev-parse HEAD) \nBuilt at: $(date)" >> version.txt
- name: Install msys64 packages
run: |
C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -S base-devel mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-clang zip'
- name: Compile the Emulator
run: |
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
make -j2
- name: Upload Emulator artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.EMULATOR_ARTIFACT }}
path: |
swadge_emulator.exe
spiffs_image
version.txt
- name: Add DLL to Emulator artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.EMULATOR_ARTIFACT }}
path: |
C:\msys64\mingw64\bin\libwinpthread-1.dll
- name: Set up the IDF
run: |
git clone -b v5.1.1 --recurse-submodules https://github.com/espressif/esp-idf.git ${{ runner.temp }}/esp-idf -j2
${{ runner.temp }}/esp-idf/install.ps1
- name: Compile the firmware
run: |
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
${{ runner.temp }}/esp-idf/export.ps1
idf.py build dfu
- name: Add build files to firmware artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.FIRMWARE_ARTIFACT }}
path: |
build/swadge2024.elf
build/swadge2024.bin
build/storage.bin
build/dfu.bin
- name: Add bootloader file to firmware artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.FIRMWARE_ARTIFACT }}
path: |
build/bootloader/bootloader.bin
- name: Add partition table file to firmware artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.FIRMWARE_ARTIFACT }}
path: |
build/partition_table/partition-table.bin
- name: Add version file to firmware artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.FIRMWARE_ARTIFACT }}
path: |
version.txt
- name: Add pyFlashGui.py to firmware artifact
uses: actions/upload-artifact@v3
with:
name: ${{ env.FIRMWARE_ARTIFACT }}
path: |
tools/pyFlashGui/pyFlashGui.py
- name: Post to a Slack channel
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.ref_name == 'main')
id: slack
uses: slackapi/[email protected]
with:
# Slack channel id, channel name, or user id to post message.
# See also: https://api.slack.com/methods/chat.postMessage#channels
# You can pass in multiple channels to post to by providing a comma-delimited list of channel IDs.
channel-id: 'C6FNXU6KX'
# For posting a simple plain text message
slack-message: "*Build Result*: ${{ job.status }}\n*Author*: ${{ github.event.head_commit.author.username }}\n*Head Commit Message*:\n```\n${{ github.event.head_commit.message }}\n```\n*Comparison*: ${{ github.event.compare }}\n*Artifacts*: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}