Skip to content

Commit

Permalink
Merge pull request #272 from AEFeinstein/create-latest-release-on-main
Browse files Browse the repository at this point in the history
Create snapshot release with downloads when merging into main
dylwhich authored Sep 7, 2024
2 parents 0a1c505 + ea30de1 commit f38c864
Showing 3 changed files with 127 additions and 61 deletions.
156 changes: 101 additions & 55 deletions .github/workflows/build-firmware-and-emulator.yml
Original file line number Diff line number Diff line change
@@ -24,29 +24,37 @@ jobs:
family: windows
emulator: true
firmware: true
emu_binary: swadge_emulator.exe
emu_artifacts:
- swadge_emulator.exe
- version.txt
# TODO: What variable can we use to not hardcode this???
idf_install: C:\Users\runneradmin\.espressif
- os: osx-arm
runner: macos-latest
family: osx
emulator: true
firmware: false
emu_binary: SwadgeEmulator.zip
emu_artifacts:
- SwadgeEmulator.app
- version.txt
idf_install: ~/.espressif
- os: osx-intel
runner: macos-13
family: osx
emulator: true
firmware: false
emu_binary: SwadgeEmulator.zip
emu_artifacts:
- SwadgeEmulator.app
- version.txt
idf_install: ~/.espressif
- os: linux
runner: ubuntu-latest
family: linux
emulator: true
firmware: false
emu_binary: swadge_emulator
emu_artifacts:
- swadge_emulator
- version.txt
idf_install: ~/.espressif

runs-on: ${{ matrix.runner }}
@@ -66,11 +74,6 @@ jobs:
printf "Commit: https://github.com/AEFeinstein/Super-2024-Swadge-FW/commit/$(git rev-parse HEAD) \nBuilt on ${{ matrix.os }} at: $(date)" >> version.txt
#### Platform-specific Dependencies
- name: Install msys64 packages
if: matrix.family == 'windows'
run: |
C:\msys64\usr\bin\bash -lc 'pacman --noconfirm -S base-devel gcc gdb zip mingw-w64-x86_64-graphviz mingw-w64-x86_64-cppcheck doxygen'
- name: Install homebrew packages
if: matrix.family == 'osx'
run: |
@@ -82,52 +85,6 @@ jobs:
run: |
sudo apt install build-essential xorg-dev libx11-dev libxinerama-dev libxext-dev mesa-common-dev libglu1-mesa-dev libasound2-dev libpulse-dev git libasan8 cppcheck python3 python3-pip python3-venv cmake libusb-1.0-0-dev lcov gdb graphviz
#### Platform-specific Emulator Builds
- name: Compile the Emulator
if: matrix.emulator && matrix.family == 'windows'
run: |
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
make -j2
- name: Compile the Emulator
if: matrix.emulator && matrix.family != 'windows'
run: |
make -j3
- name: Build OSX Bundle
if: matrix.emulator && matrix.family == 'osx'
run: |
make SwadgeEmulator.app
zip -r SwadgeEmulator.zip SwadgeEmulator.app
#### Generic Emulator Upload
- name: Upload Emulator Binary
if: matrix.emulator
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.EMULATOR_ARTIFACT }}-${{ matrix.os }}-exe
path: |
${{ matrix.emu_binary }}
version.txt
## Platform-specific Emulator Uploads
- name: Upload Emulator DLL
if: matrix.emulator && matrix.family == 'windows'
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.EMULATOR_ARTIFACT }}-${{ matrix.os }}-dll
path: |
C:\msys64\mingw64\bin\libwinpthread-1.dll
# Merge all emulator artifacts for each OS into one
- name: Merge Emulator Artifacts
if: matrix.emulator
uses: actions/upload-artifact/merge@v4.3.3
with:
name: ${{ env.EMULATOR_ARTIFACT }}-${{ matrix.os }}
pattern: ${{ env.EMULATOR_ARTIFACT }}-${{ matrix.os }}-*
delete-merged: true

## Firmware
- name: Restore IDF Cache
id: cache-esp-idf
@@ -179,6 +136,95 @@ jobs:
version.txt
tools/pyFlashGui/pyFlashGui.py
#### Platform-specific Emulator Builds
- name: Install msys64 packages
id: install-msys64
if: matrix.emulator && matrix.family == 'windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
location: C:\msys64
install: >-
base-devel
gcc
gdb
zip
mingw-w64-x86_64-graphviz
mingw-w64-x86_64-cppcheck
doxygen
- name: Compile the Emulator
if: matrix.emulator && matrix.family == 'windows'
run: |
$env:path = $env:path.Insert($env:path.ToLower().IndexOf("c:\windows\system32"), "C:\msys64\mingw64\bin;C:\msys64\usr\bin;")
make -j2
- name: Compile the Emulator
if: matrix.emulator && matrix.family != 'windows'
run: |
make -j3
- name: Build OSX Bundle
if: matrix.emulator && matrix.family == 'osx'
run: |
make SwadgeEmulator.app
- name: Create Emulator zip
if: matrix.emulator && matrix.family != 'windows'
run: |
zip -r SwadgeEmulator.zip ${{ join(matrix.emu_artifacts, ' ') }}
- name: Create Emulator zip with 7zip
if: matrix.emulator && matrix.family == 'windows'
run: |
7z a -tzip SwadgeEmulator.zip ${{ join(matrix.emu_artifacts, ' ') }} -r
#### Generic Emulator Upload
- name: Upload Emulator Binary
if: matrix.emulator
uses: actions/upload-artifact@v4.3.3
with:
name: ${{ env.EMULATOR_ARTIFACT }}-${{ matrix.os }}
path: SwadgeEmulator.zip

Create-Snapshot-Release:
runs-on: ubuntu-latest
needs: Build-Firmware-And-Emulator
permissions:
contents: write
steps:
- name: Download all previous build artifacts
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.ref_name == 'main')
uses: actions/download-artifact@v4
with:
merge-multiple: false

- name: Rename artifacts
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.ref_name == 'main')
run: |
for os in osx-arm osx-intel linux windows ; do
mv ${{ env.EMULATOR_ARTIFACT }}-${os}/SwadgeEmulator.zip SwadgeEmulator-${os}.zip
done
mkdir firmware-zip
find ${{ env.FIRMWARE_ARTIFACT }}/ -type f -exec mv {} firmware-zip/ \;
cd firmware-zip
zip ../${{ env.FIRMWARE_ARTIFACT }}.zip *
- name: Create release for latest artifacts
if: (github.event_name == 'pull_request' && github.event.action == 'closed' && github.event.pull_request.merged == true) || (github.event_name == 'push' && github.ref_name == 'main')
uses: ncipollo/release-action@v1
with:
# Allow the release to be updated, since it's not a "final" release
prerelease: true
allowUpdates: true
replacesArtifacts: true
artifacts: "${{ env.FIRMWARE_ARTIFACT }}.zip,SwadgeEmulator-*"
commit: main
tag: snapshot
name: Snapshot
body: |
# Latest Development Snapshot
Post-Slack-Message:
runs-on: windows-latest
needs: Build-Firmware-And-Emulator
28 changes: 22 additions & 6 deletions docs/EMULATOR.md
Original file line number Diff line number Diff line change
@@ -5,20 +5,24 @@ environment setup instructions, see [Configuring a Development Environment](#set

## Installing

To install the emulator, go to the project's [releases page](https://github.com/AEFeinstein/Super-2024-Swadge-FW/releases)
and download the appropriate `...-emulator.zip` for your operating system. Windows, Linux, and
To install the emulator, go to the project's [releases page](https://github.com/AEFeinstein/Super-2024-Swadge-FW/releases/tags/snapshot)
and download the appropriate `SwadgeEmulator-<os-type>.zip` for your operating system. Windows, Linux, and
Mac (both Intel and ARM) are supported. Then, follow the instructions for your platform below.

### Windows

The Windows version of the emulator does not require any other software to operate. Simply extract the
`.zip` file anywhere you like and double-click on `swadge_emulator.exe`. Note that the
`libwinpthread-1.dll` file included with the emulator download should be kept in the same folder.
`.zip` file anywhere you like and double-click on `swadge_emulator.exe`. The first time you open the
application, you may be warned about running applications from the internet and will need to click
"Run" to continue. You might also be prompted by the Windows firewall when starting certain Swadge modes.
This is only required if you wish to run two emulators at the same time using the simulated ESPNOW
wireless connection.

### Linux

After extracting the `.zip` file, you may need to mark the `swadge_emulator` binary as executable,
which can be done with the command `chmod +x swadge_emulator`.
The Linux version of the emulator does not require any other software to operate. Simply extract the
`.zip` file anywhere you like and run the `swadge_emulator` program, either by opening it from your
file browser or by running `./swadge_emulator` from the command-line.

### Mac

@@ -234,6 +238,18 @@ If the emulator opens to the factory test mode instead of either the main menu o
is because it is unable to write to the `nvs.json` file in the current directory.


## Simulated ESPNOW Networking

The Swadge Emulator is capable of simulating the wireless ESPNOW connection between two swadges. This
functionality is enabled automatically by simply running two swadge emulator programs at the same time.
For best results, you should start each Swadge Emulator from a different directory, to avoid potential
corruption caused by two instances attempting to save data to the same `nvs.json` file at the same time.

**Note**: This functionality only supports local connections between two Swadge Emulators running on the
same machine. Networking between Swadge Emulators running on different machines is not supported at this
time.


## MIDI Instructions

The Swadge Emulator includes MIDI support, which simulates the USB-MIDI behavior of the real Swadge
4 changes: 4 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -292,6 +292,10 @@ ifeq ($(ENABLE_GCOV),true)
endif
endif

ifeq ($(HOST_OS),Windows)
LIBRARY_FLAGS += -Wl,-Bstatic -lpthread
endif

################################################################################
# Build Filenames
################################################################################

0 comments on commit f38c864

Please sign in to comment.