Unify baudrates list, add support for 115200 bauds #166
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Workflow tuningTrainer | |
name: QBrainwaveOSC | |
on: | |
pull_request: | |
branches: [ ] | |
push: | |
branches: [ main ] | |
create: | |
tags: ['v*'] # Push events to matching v*, i.e. v1.0, v20.15.10 | |
workflow_dispatch: | |
publish-www: | |
description: 'Publish on WWW' | |
required: false | |
type: boolean | |
publish-github: | |
description: 'Publish on GitHub' | |
required: false | |
type: boolean | |
env: | |
pkgname: QBrainwaveOSC | |
IDENTITY_NAME: ${{ secrets.IDENTITY_NAME }} | |
jobs: | |
build: | |
strategy: | |
matrix: | |
include: | |
- { name: "windows", os: windows-latest, flags: '-G"Visual Studio 17 2022"', shell: 'msys2 {0}', deps-prefix: "/opt/deps", aqt-os: "windows", aqt-arch: "win64_msvc2019_64", aqt-prefix: "/opt/Qt", aqt-subdir: "msvc2019_64", qt-version: '6.5.1', msystem: 'UCRT64' } | |
- { name: "windows-legacy", os: windows-latest, flags: "", shell: 'msys2 {0}', deps-prefix: "/opt/deps", aqt-os: "windows", aqt-arch: "win64_mingw81", aqt-prefix: "/opt/Qt", aqt-subdir: "mingw81_64", qt-version: '5.15.2', msystem: 'MINGW64' } | |
- { name: "linux", os: ubuntu-latest, flags: "", shell: 'bash', deps-prefix: "/home/runner/deps", aqt-os: "linux", aqt-arch: "gcc_64", aqt-prefix: "/home/runner/Qt", aqt-subdir: "gcc_64", qt-version: '6.5.1'} | |
- { name: "macos-universal", os: macos-latest, flags: "-DCMAKE_OSX_ARCHITECTURES=\"x86_64;arm64\"", shell: 'bash', deps-prefix: "/Users/runner/deps", aqt-os: "mac", aqt-arch: "", aqt-prefix: "/Users/runner/Qt", aqt-subdir: "macos", qt-version: '6.5.1'} | |
- { name: "macos-legacy", os: macos-latest, flags: "-DCMAKE_OSX_DEPLOYMENT_TARGET=\"10.13\" -DCMAKE_OSX_ARCHITECTURES=\"x86_64\"", shell: 'bash', deps-prefix: "/Users/runner/deps", aqt-os: "mac", aqt-arch: "", aqt-prefix: "/Users/runner/Qt", aqt-subdir: "clang_64", qt-version: '5.15.2' } | |
runs-on: ${{matrix.os}} | |
defaults: | |
run: | |
shell: ${{matrix.shell}} | |
steps: | |
- name: Install the Apple certificate and provisioning profile | |
if: ${{runner.os == 'macOS'}} | |
env: | |
P12_CERTIFICATE_BASE64: ${{ secrets.P12_CERTIFICATE_BASE64 }} | |
P12_PASSWORD: ${{ secrets.P12_PASSWORD }} | |
KEYCHAIN_PASSWORD: ${{ secrets.KEYCHAIN_PASSWORD }} | |
run: | | |
CERTIFICATE_PATH=$RUNNER_TEMP/build_certificate.p12 | |
KEYCHAIN_PATH=$RUNNER_TEMP/app-signing.keychain-db | |
echo -n "$P12_CERTIFICATE_BASE64" | base64 --decode -o $CERTIFICATE_PATH | |
security create-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security set-keychain-settings -lut 21600 $KEYCHAIN_PATH | |
security default-keychain -s $KEYCHAIN_PATH | |
security unlock-keychain -p "$KEYCHAIN_PASSWORD" $KEYCHAIN_PATH | |
security import $CERTIFICATE_PATH -P "$P12_PASSWORD" -A -t cert -f pkcs12 -k $KEYCHAIN_PATH -T /usr/bin/codesign -T /usr/bin/productsign | |
security list-keychain -d user -s $KEYCHAIN_PATH | |
security set-key-partition-list -S apple-tool:,apple: -s -k $KEYCHAIN_PASSWORD $KEYCHAIN_PATH | |
security find-identity | |
- if: ${{runner.os == 'Windows'}} | |
name: Install MinGW | |
uses: msys2/setup-msys2@v2 | |
with: | |
msystem: ${{ matrix.msystem }} | |
update: true | |
install: | | |
base base-devel p7zip zip git | |
- if: ${{runner.os == 'Windows'}} | |
name: Prepare MinGW | |
run: | | |
pacman -S --noconfirm \ | |
${MINGW_PACKAGE_PREFIX}-toolchain \ | |
${MINGW_PACKAGE_PREFIX}-python-pip \ | |
${MINGW_PACKAGE_PREFIX}-python-distutils-extra \ | |
${MINGW_PACKAGE_PREFIX}-python-psutil \ | |
${MINGW_PACKAGE_PREFIX}-cmake \ | |
${MINGW_PACKAGE_PREFIX}-nsis | |
- name: Setup windows env | |
if: ${{runner.os == 'Windows'}} | |
run: | | |
echo "::notify:: Upgrading pip" | |
python3 -m pip install -U pip | |
echo "SETUPTOOLS_USE_DISTUTILS=stdlib" >> $GITHUB_ENV | |
- name: Install Linux Dependencies | |
if: ${{runner.os == 'Linux'}} | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y cmake-extras libasound2-dev \ | |
libegl1-mesa-dev libfuse2 libpulse-dev | |
sudo apt-get install -y libunwind-dev \ | |
libgstreamer1.0-dev \ | |
libgstreamer-plugins-base1.0-0 \ | |
libgstreamer-plugins-base1.0-dev \ | |
gstreamer1.0-libav \ | |
gstreamer1.0-plugins-good \ | |
gstreamer1.0-plugins-bad | |
sudo apt-get install -y libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 \ | |
libxcb-cursor0 libxcb-cursor-dev \ | |
libxcb-keysyms1-dev libxcb-randr0 \ | |
libxcb-render-util0 libxcb-shape0 | |
- name: Create empty dependencies directory | |
run: | | |
mkdir -p ${{ matrix.deps-prefix }} | |
- name: Install AQT | |
run: | | |
if [[ ${{matrix.os}} == "macos-latest" ]]; then | |
PIPFLAGS="--break-system-packages --user" | |
fi | |
python3 -m pip install ${PIPFLAGS} aqtinstall | |
- name: Install Qt | |
run: | | |
AQT_INSTALL="python3 -m aqt install-qt -O ${{matrix.aqt-prefix}} ${{matrix.aqt-os}} desktop ${{matrix.qt-version}} ${{matrix.aqt-arch}}" | |
QT6_MODULES=(qtconnectivity qtserialport qtcharts) | |
QT5_MODULES=(qtcharts) | |
${AQT_INSTALL} | |
if [[ ${{matrix.qt-version}} == 6.* ]]; then | |
for i in ${QT6_MODULES[@]}; do | |
${AQT_INSTALL} -m $i | |
done | |
else | |
for i in ${QT5_MODULES[@]}; do | |
${AQT_INSTALL} -m $i | |
done | |
fi | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Prepare Packages names | |
run: | | |
PACKAGE_NAME=${{env.pkgname}}-${{matrix.name}} | |
echo "PACKAGE_NAME=$PACKAGE_NAME" >> ${GITHUB_ENV} | |
- name: Prepare workdir (UNIX) | |
if: ${{runner.os != 'Windows'}} | |
run: | | |
export WORKDIR="${{github.workspace}}" | |
export AQTPATH="${{matrix.aqt-prefix}}" | |
export DEPSPATH="${{matrix.deps-prefix}}" | |
echo "WORKDIR=${WORKDIR}" >> $GITHUB_ENV | |
echo "AQTPATH=${AQTPATH}" >> $GITHUB_ENV | |
echo "DEPSPATH=${DEPSPATH}" >> $GITHUB_ENV | |
- name: Prepare workdir (MINGW) | |
if: ${{runner.os == 'Windows'}} | |
run: | | |
export WORKDIR="$(cygpath -m "${{github.workspace}}")" | |
export AQTPATH="$(cygpath -m "${{matrix.aqt-prefix}}")" | |
export DEPSPATH="$(cygpath -m "${{matrix.deps-prefix}}")" | |
echo "WORKDIR=${WORKDIR}" >> $GITHUB_ENV | |
echo "AQTPATH=${AQTPATH}" >> $GITHUB_ENV | |
echo "DEPSPATH=${DEPSPATH}" >> $GITHUB_ENV | |
- name: Prepare macOS temp disk | |
if: ${{runner.os == 'macOS'}} | |
run: | | |
export TEMP_DMGFILE=temp.dmg | |
hdiutil create -size 700m -fs HFS+ -volname "${PACKAGE_NAME}" "${TEMP_DMGFILE}" | |
hdiutil attach "${TEMP_DMGFILE}" | |
TEMP_DMGPOINT="/Volumes/${PACKAGE_NAME}" | |
echo "TEMP_DMGNAME=\"${TEMP_DMGNAME}\"" >> $GITHUB_ENV | |
echo "TEMP_DMGFILE=\"${TEMP_DMGFILE}\"" >> $GITHUB_ENV | |
echo "TEMP_DMGPOINT=\"${TEMP_DMGPOINT}\"" >> $GITHUB_ENV | |
- name: Setup install prefix | |
run: | | |
if [ ${{ runner.os }} == "Linux" ]; then | |
export INSTALL_PREFIX=${{env.WORKDIR}}/${{env.pkgname}}-appdir/usr | |
elif [ ${{ runner.os }} == "macOS" ]; then | |
export INSTALL_PREFIX="${{env.TEMP_DMGPOINT}}" | |
else | |
export INSTALL_PREFIX=${{env.WORKDIR}}/${{env.pkgname}}-appdir | |
fi | |
echo "INSTALL_PREFIX=$INSTALL_PREFIX" >> $GITHUB_ENV | |
- name: Run Configure | |
run: | | |
cmake -S "${{env.WORKDIR}}" \ | |
-B "${{env.WORKDIR}}/build" ${{matrix.flags}} \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_INSTALL_PREFIX="${{env.INSTALL_PREFIX}}" \ | |
-DCMAKE_PREFIX_PATH="${{env.AQTPATH}}/${{matrix.qt-version}}/${{matrix.aqt-subdir}};${{env.DEPSPATH}}" | |
- name: Compile Code (POSIX) | |
if: ${{matrix.name != 'windows'}} | |
run: cmake --build ${{env.WORKDIR}}/build | |
- name: Compile Code (WINDOWS) | |
if: ${{matrix.name == 'windows'}} | |
shell: pwsh | |
run: cmake --build ${{github.workspace}}/build --config Release | |
- name: Prepare appdir | |
run: | | |
if [ ${{ runner.os }} == "Windows" ]; then export SUFFIX="${{env.pkgname}}" | |
elif [ ${{ runner.os }} == "macOS" ]; then export SUFFIX="${{env.pkgname}}.app" | |
else export SUFFIX="" | |
fi | |
export APPDIR="${{env.INSTALL_PREFIX}}/${SUFFIX}" | |
echo "APPDIR=${APPDIR}" >> $GITHUB_ENV | |
- name: Install | |
run: | | |
cmake --install ${{env.WORKDIR}}/build --prefix "${{ env.INSTALL_PREFIX }}" | |
- name: Create MacOS Package | |
if: ${{runner.os == 'macOS'}} | |
run: | | |
DESTINATION_DIR=${PACKAGE_NAME} | |
DIST_DMG=${PACKAGE_NAME}.dmg | |
mkdir ${DESTINATION_DIR} || echo "::warning:: ${DESTINATION_DIR} already exists" | |
${{matrix.aqt-prefix}}/${{matrix.qt-version}}/${{matrix.aqt-subdir}}/bin/macdeployqt \ | |
"${{env.APPDIR}}" | |
find ${{env.DEPSPATH}} -name "*.dylib" -exec cp {} "${{env.APPDIR}}"/Contents/Frameworks \; | |
codesign --verbose --strict --continue --timestamp --force --deep -s ${IDENTITY_NAME} "${{env.APPDIR}}" | |
ln -s /Applications/ "${{ env.TEMP_DMGPOINT }}"/Applications | |
hdiutil detach "${{ env.TEMP_DMGPOINT }}" | |
hdiutil convert "${{ env.TEMP_DMGFILE }}" -format UDBZ \ | |
-o ${DESTINATION_DIR}/${DIST_DMG} | |
shasum -a 256 ${DESTINATION_DIR}/${DIST_DMG} | |
- name: Create Windows Package | |
if: ${{runner.os == 'Windows'}} | |
run: | | |
export ARTIFACT_DIR=${{env.WORKDIR}}/${PACKAGE_NAME} | |
find "${{env.DEPSPATH}}" -name "*.dll" -exec cp {} ${{env.APPDIR}}/ \; | |
${{matrix.aqt-prefix}}/${{matrix.qt-version}}/${{matrix.aqt-subdir}}/bin/windeployqt.exe ${{env.APPDIR}}/ | |
mkdir $ARTIFACT_DIR || echo "::warning::${ARTIFACT_DIR} already exists" | |
cd $ARTIFACT_DIR | |
cpack --config ${{env.WORKDIR}}/build/CPackConfig.cmake -G NSIS -V | |
mv ${{env.pkgname}}*.exe ${PACKAGE_NAME}-Installer.exe | |
cpack --config ${{env.WORKDIR}}/build/CPackConfig.cmake -G 7Z | |
mv ${{env.pkgname}}*.7z ${PACKAGE_NAME}-Portable.7z | |
rm -Rf _CPack_Packages/ | |
- name: Create AppImage | |
if: ${{runner.os == 'Linux'}} | |
env: | |
QTDIR: ${{matrix.aqt-prefix}}/${{matrix.qt-version}}/${{matrix.aqt-subdir}} | |
QMAKE: ${{matrix.aqt-prefix}}/${{matrix.qt-version}}/${{matrix.aqt-subdir}}/bin/qmake | |
run: | | |
echo "::notice:: QMAKE=${QMAKE}" | |
sudo bash -c "echo ${{matrix.aqt-prefix}}/${{matrix.qt-version}}/${{matrix.aqt-subdir}}/lib > /etc/ld.so.conf.d/aqt.conf" | |
sudo bash -c "echo ${{matrix.deps-prefix}}/lib > /etc/ld.so.conf.d/deps.conf" | |
sudo rm /etc/ld.so.cache | |
sudo ldconfig | |
echo "::group:: Downloading linux deploy" | |
wget -q https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-x86_64.AppImage | |
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-qt/releases/download/continuous/linuxdeploy-plugin-qt-x86_64.AppImage | |
wget -q https://github.com/linuxdeploy/linuxdeploy-plugin-appimage/releases/download/continuous/linuxdeploy-plugin-appimage-x86_64.AppImage | |
echo "::endgroup::" | |
LINUXDEPLOY=linuxdeploy-x86_64.AppImage | |
chmod +x *.AppImage | |
APPDIR=${{env.pkgname}}.AppDir | |
ICONFILE=$(find ${{ env.APPDIR }} -name *.png) | |
DESKTOPFILE=$(find ${{env.APPDIR}} -name *.desktop) | |
EXECFILE=$(find ${{env.APPDIR}} -name ${{env.pkgname}} -type f -executable) | |
export PATH=${QTDIR}/bin:${PATH} | |
export QT_INSTALL_PLUGINS=${QTDIR}/plugins/ | |
echo "::group:: Linux deploy QT" | |
./${LINUXDEPLOY} \ | |
--appdir=${APPDIR} \ | |
--executable=${EXECFILE} \ | |
--icon-file=${ICONFILE} \ | |
--desktop-file=${DESKTOPFILE} \ | |
--plugin qt | |
cp -Rv $QT_INSTALL_PLUGINS/generic ${APPDIR}/usr/plugins/ || echo "::warning:: generic plugin not found" | |
echo "::endgroup::" | |
echo "::group:: Creating AppImage" | |
./${LINUXDEPLOY} --appdir=${APPDIR} --output=appimage | |
mv ${{env.pkgname}}*.AppImage ${PACKAGE_NAME}.AppImage | |
export APPIMAGEDIR=${{github.workspace}}/${PACKAGE_NAME} | |
mkdir $APPIMAGEDIR || echo "::warning::${APPIMAGEDIR} already exists" | |
cp ${PACKAGE_NAME}.AppImage ${PACKAGE_NAME} | |
echo "::endgroup::" | |
# - name: Setup tmate session | |
# uses: mxschmitt/action-tmate@v3 | |
# if: ${{ failure() }} | |
# with: | |
# limit-access-to-actor: true | |
# #install-dependencies: false | |
# timeout-minutes: 60 | |
- name: Upload All Binaries | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{env.pkgname}}-${{matrix.name}} | |
path: ${{github.workspace}}/${{env.pkgname}}-${{matrix.name}} | |
publish: | |
needs: build | |
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')) | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Get Build Tag | |
id: get_tag | |
run: | | |
DATE=$(date +'%Y%m%d-%H%M') | |
BUILD_TAG="${{env.pkgname}}-snapshot-${DATE}" | |
echo "BUILD_TAG=${BUILD_TAG}" >> $GITHUB_OUTPUT | |
echo DATE=$DATE >> $GITHUB_ENV | |
- name: Get macOS universal binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.pkgname}}-macos-universal | |
path: ${{github.workspace}}/${{env.pkgname}}-macos-universal | |
- name: Get macOS legacy binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.pkgname}}-macos-legacy | |
path: ${{github.workspace}}/${{env.pkgname}}-macos-legacy | |
- name: Get Linux binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.pkgname}}-linux | |
path: ${{github.workspace}}/${{env.pkgname}}-linux | |
- name: Get Windows binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.pkgname}}-windows | |
path: ${{github.workspace}}/${{env.pkgname}}-windows | |
- name: Get Windows legacy binary | |
uses: actions/download-artifact@v3 | |
with: | |
name: ${{env.pkgname}}-windows-legacy | |
path: ${{github.workspace}}/${{env.pkgname}}-windows-legacy | |
- if: github.event_name == 'push' # this is a snapshot build. create a release and upload binaries | |
name: Create Snapshot Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ steps.get_tag.outputs.BUILD_TAG }} | |
tag_name: ${{ steps.get_tag.outputs.BUILD_TAG }} | |
generate_release_notes: true | |
prerelease: true | |
files: | | |
${{github.workspace}}/${{env.pkgname}}-macos-universal/* | |
${{github.workspace}}/${{env.pkgname}}-macos-legacy/* | |
${{github.workspace}}/${{env.pkgname}}-linux/* | |
${{github.workspace}}/${{env.pkgname}}-windows/* | |
${{github.workspace}}/${{env.pkgname}}-windows-legacy/* | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') # this is a versioned build. check if release already exists | |
name: Find Existing Release | |
id: find_release | |
uses: cardinalby/git-get-release-action@v1 | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
doNotFailIfNotFound: true | |
tag: ${{ github.ref_name }} | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') && steps.find_release.outputs.id != 0 # release exists - upload macOS binary | |
name: Update Tagged Release (macOS universal) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.find_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/${{env.pkgname}}-macos-universal | |
asset_name: ${{env.pkgname}}-macos-universal | |
asset_content_type: application/octet-stream | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') && steps.find_release.outputs.id != 0 # release exists - upload macOS binary | |
name: Update Tagged Release (macOS legacy) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.find_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/${{env.pkgname}}-macos-legacy | |
asset_name: ${{env.pkgname}}-macos-legacy | |
asset_content_type: application/octet-stream | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') && steps.find_release.outputs.id != 0 # release exists - upload Linux binary | |
name: Update Tagged Release (Linux) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.find_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/${{env.pkgname}}-linux | |
asset_name: ${{env.pkgname}}-linux-x86_64 | |
asset_content_type: application/octet-stream | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') && steps.find_release.outputs.id != 0 # release exists - upload Windows binary | |
name: Update Tagged Release (Windows) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.find_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/${{env.pkgname}}-windows | |
asset_name: ${{env.pkgname}}-win-x86_64 | |
asset_content_type: application/octet-stream | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') && steps.find_release.outputs.id != 0 # release exists - upload Windows binary | |
name: Update Tagged Release (Windows legacy) | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
with: | |
upload_url: ${{ steps.find_release.outputs.upload_url }} | |
asset_path: ${{github.workspace}}/${{env.pkgname}}-windows-legacy | |
asset_name: ${{env.pkgname}}-win7-x86_64 | |
asset_content_type: application/octet-stream | |
- if: github.event_name == 'create' && startsWith(github.ref, 'refs/tags/v') && steps.find_release.outputs.id == 0 # otherwise release does not exist, create one and upload binaries | |
name: Create Tagged Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
name: ${{ github.ref_name }} | |
tag_name: ${{ github.ref_name }} | |
generate_release_notes: true | |
prerelease: false | |
files: | | |
${{github.workspace}}/${{env.pkgname}}-macos-universal* | |
${{github.workspace}}/${{env.pkgname}}-macos-legacy* | |
${{github.workspace}}/${{env.pkgname}}-windows* | |
${{github.workspace}}/${{env.pkgname}}-windows-legacy* | |
${{github.workspace}}/${{env.pkgname}}-linux* |