diff --git a/.github/workflows/BuildTest.yml b/.github/workflows/Platform_build.yml similarity index 77% rename from .github/workflows/BuildTest.yml rename to .github/workflows/Platform_build.yml index eb7733c8..722a4ad1 100644 --- a/.github/workflows/BuildTest.yml +++ b/.github/workflows/Platform_build.yml @@ -1,19 +1,18 @@ -# This is a basic workflow to help you get started with Actions -name: Manually executable test for ESP-IDF v4.3.1 +name: Platform Build on: + push: + branches: + - '**4.3' workflow_dispatch: inputs: - ui_build: - description: 'Rebuild UI' - required: true - type: boolean - release_build: - description: 'Release' - required: true - type: boolean - # push: - # branches: - # - '**4.3' + ui_build: + description: 'Force Rebuilding the UI. When not forced, the system will check for [ui-build] in the last commit message to trigger a ui rebuild' + required: true + type: boolean + release_build: + description: 'Force a Release build. When not forced, the system will check for release word in the last commit message to trigger a release' + required: true + type: boolean jobs: bootstrap: @@ -27,12 +26,6 @@ jobs: release_flag: ${{ steps.build_flags.outputs.release_flag }} mock: ${{ steps.build_flags.outputs.mock }} steps: - - name: Set Build options from workflow dispatch event - run: | - ui_build_option="" && [[ ${{ inputs.ui_build }} ]] && ui_build_option="--ui_build" - release_build_option="" && [[ ${{ inputs.release_build }} ]] && release_build_option="--force" - echo "ui_build_option=$ui_build_option" >> $GITHUB_ENV - echo "release_build_option=$release_build_option" >> $GITHUB_ENV - uses: actions/checkout@v2 with: fetch-depth: 0 @@ -46,6 +39,10 @@ jobs: id: build_flags run: | git config --global --add safe.directory /__w/squeezelite-esp32/squeezelite-esp32 + [ ${{github.event.inputs.ui_build}} ] && ui_build_option="--ui_build" || ui_build_option="" + [ ${{github.event.inputs.release_build}} ] && release_build_option="--force" || release_build_option="" + echo "ui_build_option=$ui_build_option" >> $GITHUB_ENV + echo "release_build_option=$release_build_option" >> $GITHUB_ENV echo "Dumping environment" env . /opt/esp/python_env/idf4.3_py3.8_env/bin/activate @@ -53,26 +50,15 @@ jobs: # --mock - to mock the compilation part - this is to be used for testing only # --force - to force a release build even if the last commit message doesn't contain the word "release" # --ui_build - to force a ui_build even if the last commit message doesn't contain "[ui-build]" - build_tools.py build_flags ${{ env.ui_build_option }} ${{ env.release_build_option }} - preparation: - name: Preparation - needs: bootstrap - runs-on: ubuntu-latest - container: - image: sle118/squeezelite-esp32-idfv43 - steps: + build_tools.py build_flags $ui_build_option $release_build_option - name: Show Build Flags run: | echo "Running with the following options" - echo "Web Build Flag=${{needs.bootstrap.outputs.ui_build}}" - echo "Mock flag=${{needs.bootstrap.outputs.mock}}" - echo "Release Flag=${{needs.bootstrap.outputs.release_flag}}" - git config --global --add safe.directory /__w/squeezelite-esp32/squeezelite-esp32 - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: true + echo "Web Build Flag=${{steps.build_flags.outputs.ui_build}}" + echo "Mock flag=${{steps.build_flags.outputs.mock}}" + echo "Release Flag=${{steps.build_flags.outputs.release_flag}}" - name: Refresh certificates + if: ${{ steps.build_flags.outputs.release_flag }} run: | git update-index --chmod=+x ./server_certs/getcert.sh cd server_certs;./getcert.sh;cat github.pem;cd .. @@ -84,13 +70,13 @@ jobs: cache: 'npm' cache-dependency-path: components/wifi-manager/webapp/package.json - name: Build Web Application - if: ${{ needs.bootstrap.outputs.ui_build == 1 }} + if: ${{ steps.build_flags.outputs.ui_build == 1 }} run: | cd components/wifi-manager/webapp/ npm install npm run-script build - name: Update repository with prebuilt items - if: ${{ needs.bootstrap.outputs.ui_build == 1 || needs.bootstrap.outputs.release_flag == 1 }} + if: ${{ steps.build_flags.outputs.ui_build == 1 || steps.build_flags.outputs.release_flag == 1 }} run: | git config user.name github-actions git config user.email github-actions@github.com @@ -115,7 +101,7 @@ jobs: runs-on: ubuntu-latest container: image: sle118/squeezelite-esp32-idfv43 - needs: [preparation,bootstrap] + needs: [bootstrap] strategy: matrix: node: [I2S-4MFlash, SqueezeAmp, Muse] @@ -189,7 +175,7 @@ jobs: zip -r build_output.zip build zip build/${artifact_file_name} partitions*.csv components/ build/*.bin build/bootloader/bootloader.bin build/partition_table/partition-table.bin build/flash_project_args build/size_*.txt fi - - name: Upload Artifacts + - name: Upload Build Artifacts uses: actions/upload-artifact@v3 if: ${{ needs.bootstrap.outputs.mock == 0 }} with: @@ -201,17 +187,10 @@ jobs: partitions.csv sdkconfig server_certs/github.pem + build/*.bin + build/bootloader/bootloader.bin + build/partition_table/partition-table.bin build_output.zip - - name: Save Last Build - if: ${{ needs.bootstrap.outputs.mock == 0 }} - uses: actions/upload-artifact@v3 - with: - name: build_parms - path: | - build/flash_project_args - build/flasher_args.json - partitions.csv - sdkconfig - name: Create Release if: ${{ needs.bootstrap.outputs.release_flag == 1 && needs.bootstrap.outputs.mock == 0 }} id: create_release @@ -245,25 +224,9 @@ jobs: upload_url: ${{ steps.create_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: build/${{ env.artifact_file_name }} asset_name: ${{ env.artifact_file_name }} - asset_content_type: application/octet-stream + asset_content_type: application/octet-stream update_web_installer: - name: Web Installer - if: ${{ needs.bootstrap.outputs.release_flag == 1 && needs.bootstrap.outputs.mock == 0 }} - needs: [build, preparation,bootstrap] - runs-on: ubuntu-latest - container: - image: sle118/squeezelite-esp32-idfv43 - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - submodules: true - - uses: actions/download-artifact@master - name: Restore last build - with: - name: build_parms - - name: Update Web Installer Project - run: | - . /opt/esp/python_env/idf4.3_py3.8_env/bin/activate - build_tools.py manifest --flash_file "./build/flasher_args.json" --outdir "./bin_files" --manif_name "manifest" --max_count 3 - build_tools.py pushinstaller --source "./bin_files" --manif_name "manifest" --target "web-installer" --url "https://github.com/sle118/squeezelite-esp32-installer.git" --artifacts "artifacts" --web_installer_branch "main" --token "${{secrets.github_token}}" + name: Update Web Installer After Release + needs: [ bootstrap, build ] + if: ${{( always() && !cancelled() ) && needs.bootstrap.outputs.release_flag == 1 && needs.bootstrap.outputs.mock == 0 }} + uses: ./.github/workflows/web_deploy.yml