diff --git a/.github/workflows/PreRelease_task.yml b/.github/workflows/PreRelease_task.yml new file mode 100644 index 00000000..d7576d15 --- /dev/null +++ b/.github/workflows/PreRelease_task.yml @@ -0,0 +1,279 @@ +# This is the name of the workflow, visible on GitHub UI. +name: PreRelease_Build_Task + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the main branch + push: + branches: [ develop ] + #pull_request: + # branches: [ main ] + +# This is the list of jobs that will be run concurrently. +# Since we use a build matrix, the actual number of jobs +# started depends on how many configurations the matrix +# will produce. +jobs: + + + BuildFirmware: + #runs-on: ubuntu-latest + runs-on: windows-latest + + steps: + + # Prepare environment + - uses: actions/checkout@main + - uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - uses: actions/setup-python@v4 + with: + python-version: '3.11' + - name: Install PlatformIO Core + run: pip install --upgrade platformio + + + + + + # Build ESP code + - name: Build PlatformIO Project ESP32 + working-directory: ./ESP32 + run: | + pio system info + pio run --environment esp32 + pio run --environment esp32s3usbotg + pio run --environment esp32-speedcrafter + + + + + + + + + # copy files to dir + - name: Copy files to packing dir + run: | + copy ${{ github.workspace }}/ESP32/.pio/build/esp32/firmware.bin ${{ github.workspace }}/Helper/bins/esp32 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32/partitions.bin ${{ github.workspace }}/Helper/bins/esp32 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/firmware.bin ${{ github.workspace }}/Helper/bins/esp32s3 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32s3 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/partitions.bin ${{ github.workspace }}/Helper/bins/esp32s3 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/firmware.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/partitions.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4 + + + + + + + + # copy files to dir + - name: List files in dir + run: | + dir ${{ github.workspace }}/Helper/bins/esp32 + + + + + + + # zip plugin binaries + - name: ZIP files + run: | + 7z a ${{ github.workspace }}/Helper/zip/esp32.zip ${{ github.workspace }}/Helper/bins/esp32/ + 7z a ${{ github.workspace }}/Helper/zip/esp32s3.zip ${{ github.workspace }}/Helper/bins/esp32s3/ + 7z a ${{ github.workspace }}/Helper/zip/esp32_speedcrafter.zip ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4/ + # 7z a ./Helper/zip/esp32.zip @./Helper/zip/filelist_esp32.txt + # 7z a ./Helper/zip/esp32s3.zip @Helper/zip/filelist_esp32s3.txt + # 7z a./Helper/zip/esp32_speedcrafter.zip @Helper/zip/filelist_esp32_speedcrafter.txt + # Publish as build artifact + - name: Attach artifact + uses: actions/upload-artifact@v2 + with: + name: firmware_esp32 + path: | + ./Helper/zip/esp32.zip + ./Helper/zip/esp32s3.zip + ./Helper/zip/esp32_speedcrafter.zip + + # create a Prerelease + # see https://www.youtube.com/watch?v=_ueJ3LrRqPU + - name: Create PreRelease + id: create-new-PreRelease + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: PreRelease${{ github.run_number }} + release_name: develop_package_not_stable ${{ github.run_number }} + prerelease: true + + # upload release asset + # Arduino binaries + - name: Upload ESP release assets + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-new-PreRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./Helper/zip/esp32.zip + asset_name: esp32_0.zip + asset_content_type: application/zip + + - name: Upload ESP32S3 release assets + id: upload-release-asset-ESP32S3 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-new-PreRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./Helper/zip/esp32s3.zip + asset_name: esp32s3.zip + asset_content_type: application/zip + + - name: Upload ESP release assets speedcrafter PCB V1p4 + id: upload-release-asset-speedcrafter-pcb-v1p4 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-new-PreRelease.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./Helper/zip/esp32_speedcrafter.zip + asset_name: esp32_speedcrafter.zip + asset_content_type: application/zip + + + +######################################################################## +# Build SimHub plugin +######################################################################## + buildSimhubPlugin: + runs-on: windows-2019 + needs: BuildFirmware + steps: + - uses: actions/checkout@v2 + - name: Setup MSBuild + uses: microsoft/setup-msbuild@v1 + + - name: Setup NuGet + uses: NuGet/setup-nuget@v1.0.5 + + - name: Setup MS Build Systems + uses: microsoft/setup-msbuild@v1.1 + + - uses: actions/cache@v3 + name: Restore Caches + id: cache + with: + path: | + innounp050.rar + SimHub.8.01.2.zip + key: SimHub.8.01.2 + + - name: Download Requirements # Used to download the SimHub DLLs - only if not in cache. + if: steps.cache.outputs.cache-hit != 'true' + run: | + aria2c -j1 -o innounp050.rar "https://sourceforge.net/projects/innounp/files/innounp/innounp%200.50/innounp050.rar/download" + aria2c -j1 -o SimHub.8.01.2.zip "https://github.com/SHWotever/SimHub/releases/download/9.1.22/SimHub.9.01.22.zip" + + - name: Extract Requirements # Used to extract the SimHub DLLs + run: | + 7z x innounp050.rar + 7z x SimHub.8.01.2.zip + dir + mkdir "C:\Program Files (x86)\SimHub\" + ${{ github.workspace }}\innounp.exe -v -x -b -e -d"C:\Program Files (x86)\SimHub\" SimHubSetup_9.1.22.exe + - name: List files in dir + run: | + ls "C:\Program Files (x86)\SimHub\" + + #- name: List files in dir 2 + # run: | + # ls ${{ github.workspace }} + - name: Restore Packages + run: nuget restore "SimHubPlugin/User.PluginSdkDemo.sln" + + - name: Build solution + run: msbuild "SimHubPlugin/User.PluginSdkDemo.sln" -t:rebuild -property:Configuration=Release + + + + + # zip plugin binaries + - name: ZIP files + run: | + 7z a ./SimHubPlugin/bin/SimHub_plugin.zip ./SimHubPlugin/bin/* + + + #- name: List files in dir 3 + # run: | + # ls ${{ github.workspace }}/SimHubPlugin + #- name: List files in dir 4 + # run: | + # ls ${{ github.workspace }}/SimHubPlugin/bin + + # create a release + # see https://www.youtube.com/watch?v=_ueJ3LrRqPU + #- name: Create Release + # id: create-new-release + # uses: actions/create-release@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # tag_name: ${{ github.run_number }} + # release_name: Release ${{ github.run_number }} + + + # # SimHub plugin binaries + #- name: Upload SimHub release assets + # id: upload-release-asset-plugin + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + # asset_path: ./SimHubPlugin/bin/SimHub_plugin.zip + # asset_name: SimHub_plugin.zip + # asset_content_type: application/zip + + + + # zip plugin binaries + #- uses: montudor/action-zip@v1 + # with: + # args: zip -qq -r ./SimHubPlugin/bin/SimHub_plugin.zip ./SimHubPlugin/bin/ + + + - name: Upload Artifact + uses: ncipollo/release-action@v1 + with: + artifacts: '${{ github.workspace }}\SimHubPlugin\bin\DiyActivePedal.dll' + prerelease: ${{ github.event.inputs.is-pre-release }} + replacesArtifacts: true + allowUpdates: true + name: develop_package_not_stable ${{ github.run_number }} + tag: PreRelease${{ github.run_number }} + + # SimHub plugin binaries + #- name: Upload SimHub release assets + # id: upload-release-asset-plugin + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + # asset_path: ./SimHubPlugin/bin/SimHub_plugin.zip + # asset_name: SimHub_plugin.zip + # asset_content_type: application/zip + + + diff --git a/.github/workflows/arduino.yml b/.github/workflows/arduino.yml index 5a5953a2..e26d7529 100644 --- a/.github/workflows/arduino.yml +++ b/.github/workflows/arduino.yml @@ -1,5 +1,5 @@ # This is the name of the workflow, visible on GitHub UI. -name: Arduino Build +name: Release_Build_Task # Controls when the action will run. on: @@ -16,93 +16,93 @@ on: jobs: -######################################################################## -# Build ESP binaries -######################################################################## - buildEspCode: - # Here we tell GitHub that the jobs must be determined - # dynamically depending on a matrix configuration. - strategy: - matrix: - # The matrix will produce one job for each configuration - # parameter of type `arduino-platform`, in this case, it - # is only 1. - arduino-platform: ["esp32:esp32"] - # This is usually optional but we need to statically define the - # FQBN of the boards we want to test for each platform. In the - # future the CLI might automatically detect and download the core - # needed to compile against a certain FQBN, at that point the - # following `include` section will be useless. - include: - # This works like this: when the platformn is "arduino:avr", the - # variable `fqbn` is set to "arduino:avr:uno". - - arduino-platform: "esp32:esp32" - fqbn: "esp32:esp32:fm-devkit" - - # This is the platform GitHub will use to run our workflow, - # I picked ubuntu. - runs-on: ubuntu-latest + BuildFirmware: + #runs-on: ubuntu-latest + runs-on: windows-latest - # This is the list of steps this job will run. steps: - # First of all, we clone the repo using the `checkout` action. - - name: Checkout - uses: actions/checkout@main + + # Prepare environment + - uses: actions/checkout@main + - uses: actions/cache@v3 + with: + path: | + ~/.cache/pip + ~/.platformio/.cache + key: ${{ runner.os }}-pio + - uses: actions/setup-python@v4 with: - submodules: recursive + python-version: '3.11' + - name: Install PlatformIO Core + run: pip install --upgrade platformio - # We use the `arduino/setup-arduino-cli` action to install and - # configure the Arduino CLI on the system. - - name: Setup Arduino CLI - uses: arduino/setup-arduino-cli@v1 - - - # We then install the platform, which one will be determined - # dynamically by the build matrix. - - name: Install platform - run: | - arduino-cli core update-index --additional-urls https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json - arduino-cli core install esp32:esp32 - - name: List Arduino libs - run: | - ls ${{ github.workspace }}/Arduino/libs/ - - - name: List files in Kalman lib - run: | - ls ${{ github.workspace }}/Arduino/libs/Kalman - - # Finally, we compile the sketch, using the FQBN that was set - # in the build matrix. - - name: Compile Sketch - run: arduino-cli compile --fqbn esp32:esp32:fm-devkit --output-dir ./Arduino/Esp32/bin --libraries ./Arduino/libs/ ./Arduino/Esp32/Main - - # list of boards https://forum.arduino.cc/t/how-to-figure-out-which-board-i-am-using-on-arduino-cli/1148944/2 - # build flags https://arduino.github.io/arduino-cli/0.19/commands/arduino-cli_compile/ - - name: Compile Sketch_speedcrafter_PCB_V1p4 - run: arduino-cli compile --fqbn esp32:esp32:esp32wrover --output-dir ./Arduino/Esp32/bin_speedcrafter_PCB_V1p4 --libraries ./Arduino/libs/ --build-property build.extra_flags=-DPCB_VERSION=5 ./Arduino/Esp32/Main - # upload the build artifacts - # see https://thecurve.io/production-arduino-binary-builds-with-github-actions/ - # see https://github.com/actions/upload-artifact - - name: Upload Arduino artifacts - uses: actions/upload-artifact@v2 - with: - name: arduino_artifacts - path: ./Arduino/Esp32/bin/ - # zip binaries - - uses: montudor/action-zip@v1 - with: - args: zip -qq -r ./Arduino/Esp32/bin/esp32_0.zip ./Arduino/Esp32/bin/ + # Build ESP code + - name: Build PlatformIO Project ESP32 + working-directory: ./ESP32 + run: | + pio system info + pio run --environment esp32 + pio run --environment esp32s3usbotg + pio run --environment esp32-speedcrafter + + + + + + + + + # copy files to dir + - name: Copy files to packing dir + run: | + copy ${{ github.workspace }}/ESP32/.pio/build/esp32/firmware.bin ${{ github.workspace }}/Helper/bins/esp32 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32/partitions.bin ${{ github.workspace }}/Helper/bins/esp32 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/firmware.bin ${{ github.workspace }}/Helper/bins/esp32s3 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32s3 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32s3usbotg/partitions.bin ${{ github.workspace }}/Helper/bins/esp32s3 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/firmware.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/bootloader.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4 + copy ${{ github.workspace }}/ESP32/.pio/build/esp32-speedcrafter/partitions.bin ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4 + + + + + + + + # copy files to dir + - name: List files in dir + run: | + dir ${{ github.workspace }}/Helper/bins/esp32 + + + + + - - # zip binaries - - uses: montudor/action-zip@v1 + # zip plugin binaries + - name: ZIP files + run: | + 7z a ${{ github.workspace }}/Helper/zip/esp32.zip ${{ github.workspace }}/Helper/bins/esp32/ + 7z a ${{ github.workspace }}/Helper/zip/esp32s3.zip ${{ github.workspace }}/Helper/bins/esp32s3/ + 7z a ${{ github.workspace }}/Helper/zip/esp32_speedcrafter.zip ${{ github.workspace }}/Helper/bins/esp32_speedcrafter_PCB_V1p4/ + # 7z a ./Helper/zip/esp32.zip @./Helper/zip/filelist_esp32.txt + # 7z a ./Helper/zip/esp32s3.zip @Helper/zip/filelist_esp32s3.txt + # 7z a./Helper/zip/esp32_speedcrafter.zip @Helper/zip/filelist_esp32_speedcrafter.txt + # Publish as build artifact + - name: Attach artifact + uses: actions/upload-artifact@v2 with: - args: zip -qq -r ./Arduino/Esp32/bin/esp32_speedcrafter_PCB_V1p4.zip ./Arduino/Esp32/bin_speedcrafter_PCB_V1p4/ - + name: firmware_esp32 + path: | + ./Helper/zip/esp32.zip + ./Helper/zip/esp32s3.zip + ./Helper/zip/esp32_speedcrafter.zip # create a release # see https://www.youtube.com/watch?v=_ueJ3LrRqPU - name: Create Release @@ -123,10 +123,20 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./Arduino/Esp32/bin/esp32_0.zip + asset_path: ./Helper/zip/esp32.zip asset_name: esp32_0.zip asset_content_type: application/zip + - name: Upload ESP32S3 release assets + id: upload-release-asset-ESP32S3 + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps + asset_path: ./Helper/zip/esp32s3.zip + asset_name: esp32s3.zip + asset_content_type: application/zip - name: Upload ESP release assets speedcrafter PCB V1p4 id: upload-release-asset-speedcrafter-pcb-v1p4 @@ -135,8 +145,8 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: upload_url: ${{ steps.create-new-release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ./Arduino/Esp32/bin/esp32_speedcrafter_PCB_V1p4.zip - asset_name: esp32_speedcrafter_PCB_V1p4.zip + asset_path: ./Helper/zip/esp32_speedcrafter.zip + asset_name: esp32_speedcrafter.zip asset_content_type: application/zip @@ -146,8 +156,7 @@ jobs: ######################################################################## buildSimhubPlugin: runs-on: windows-2019 - needs: buildEspCode - + needs: BuildFirmware steps: - uses: actions/checkout@v2 - name: Setup MSBuild