mirror of
https://github.com/sle118/squeezelite-esp32.git
synced 2025-12-11 22:17:17 +03:00
Expand GitHub Actions for build
This commit is contained in:
127
.github/workflows/I2S-4MBFlash.yml
vendored
127
.github/workflows/I2S-4MBFlash.yml
vendored
@@ -9,28 +9,127 @@ on:
|
|||||||
branches: [ master-cmake ]
|
branches: [ master-cmake ]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
job1:
|
||||||
|
name: Build Number
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
outputs:
|
||||||
|
build_number: ${{ steps.buildnumber.outputs.build_number }}
|
||||||
steps:
|
steps:
|
||||||
- name: Set target
|
- name: Generate common build number
|
||||||
run: echo "TARGET_BUILD_NAME=I2S-4MFlash" >> $GITHUB_ENV
|
|
||||||
id: target-name-generator
|
|
||||||
- name: Show Target
|
|
||||||
run: echo "Target is ${TARGET_BUILD_NAME}"
|
|
||||||
- uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
submodules: true
|
|
||||||
- name: Generate build number
|
|
||||||
id: buildnumber
|
id: buildnumber
|
||||||
uses: einaregilsson/build-number@v2
|
uses: einaregilsson/build-number@v2
|
||||||
with:
|
with:
|
||||||
token: ${{secrets.github_token}}
|
token: ${{secrets.github_token}}
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
needs: job1
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
node: [I2S-4MFlash, ESP32-A1S, SqueezeAmp]
|
||||||
|
steps:
|
||||||
|
- name: Set target name
|
||||||
|
run: |
|
||||||
|
echo "TARGET_BUILD_NAME=${{ matrix.node }}" >> $GITHUB_ENV
|
||||||
|
echo "build_version_prefix=V0." >> $GITHUB_ENV
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
- name: Cache build
|
- name: Cache build
|
||||||
id: cache-build
|
id: cache-build
|
||||||
uses: actions/cache@v1
|
uses: actions/cache@v1
|
||||||
with:
|
with:
|
||||||
path: ${{github.workspace}}/build
|
path: ${{github.RUNNER_WORKSPACE}}/build
|
||||||
key: ${{ runner.os }}-${TARGET_BUILD_NAME}
|
key: ${{ runner.os }}-${TARGET_BUILD_NAME}
|
||||||
- name: Build the firmware
|
- name: Set build parameters
|
||||||
run: |
|
run: |
|
||||||
docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.0 /bin/bash -c "cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig && export PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} && idf.py build"
|
shopt -s nocasematch
|
||||||
|
branch_name="${GITHUB_REF//refs\/heads\//}"
|
||||||
|
branch_name="${branch_name//[^a-zA-Z0-9\-~!@_\.]/}"
|
||||||
|
BUILD_NUMBER=${{ needs.job1.outputs.build_number }}
|
||||||
|
echo "BUILD_NUMBER=${BUILD_NUMBER}" >> $GITHUB_ENV
|
||||||
|
tag="${build_version_prefix}${BUILD_NUMBER}-${TARGET_BUILD_NAME}-${branch_name}"
|
||||||
|
last_commit="$(git log --pretty=format:'%s' --max-count=1)"
|
||||||
|
if [[ "$last_commit" =~ .*"Release".* ]]; then echo "release_flag=1" >> $GITHUB_ENV; else echo "release_flag=0" >> $GITHUB_ENV; fi
|
||||||
|
name="${build_version_prefix}${BUILD_NUMBER}.${branch_name}#v4.0#${TARGET_BUILD_NAME}#${branch_name}"
|
||||||
|
artifact_prefix="squeezelite-esp32-${branch_name}-${TARGET_BUILD_NAME}-${build_version_prefix}${BUILD_NUMBER}"
|
||||||
|
artifact_file_name="${artifact_prefix}.zip"
|
||||||
|
artifact_bin_file_name="${artifact_prefix}.bin"
|
||||||
|
echo "name=${name}" >> $GITHUB_ENV
|
||||||
|
echo "last_commit=${last_commit}" >> $GITHUB_ENV
|
||||||
|
echo "artifact_file_name=${artifact_file_name}" >> $GITHUB_ENV
|
||||||
|
echo "artifact_bin_file_name=${artifact_bin_file_name}" >> $GITHUB_ENV
|
||||||
|
description=""
|
||||||
|
description=${description}$'------------------------------\n### Revision Log\n\n'
|
||||||
|
description="$description$(git log --pretty=format:'%h %s (%cI) <%an>' --abbrev-commit --max-count=15 | sed --r 's/(^[\*]+)/\\\1/g') "
|
||||||
|
echo ${description}
|
||||||
|
echo ${description} >>release_desc.txt
|
||||||
|
echo "description=${description}" >> $GITHUB_ENV
|
||||||
|
cat release_desc.txt
|
||||||
|
- name: Show Target
|
||||||
|
run: |
|
||||||
|
echo "Target is ${TARGET_BUILD_NAME}"
|
||||||
|
env
|
||||||
|
- name: Build the firmware
|
||||||
|
if: env.release_flag == 1 && env.release_flag == 0
|
||||||
|
run: |
|
||||||
|
docker run --rm -v $PWD:/project -w /project espressif/idf:release-v4.0 /bin/bash -c "cp build-scripts/${TARGET_BUILD_NAME}-sdkconfig.defaults sdkconfig && export PROJECT_VER=${TARGET_BUILD_NAME}-${{ steps.buildnumber.outputs.build_number }} && idf.py build && zip ${artifact_file_name} ../partitions*.csv *.bin ./bootloader/bootloader.bin ./partition_table/partition-table.bin flash_project_args ./size_*.txt"
|
||||||
|
- name: Build Mock firmware
|
||||||
|
run: |
|
||||||
|
mkdir -p build
|
||||||
|
cd build
|
||||||
|
mkdir -p partition_table
|
||||||
|
mkdir -p bootloader
|
||||||
|
echo "mock content"> squeezelite.bin
|
||||||
|
echo "mock content"> recovery.bin
|
||||||
|
echo "mock content"> ./bootloader/bootloader.bin
|
||||||
|
echo "mock content"> ./partition_table/partition-table.bin
|
||||||
|
echo "mock content"> flash_project_args
|
||||||
|
echo "mock content"> size_comp1.txt
|
||||||
|
echo "mock content"> size_comp2.txt
|
||||||
|
echo "mock content"> ../partitions.csv
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.artifact_file_name }}
|
||||||
|
path: |
|
||||||
|
build/*.bin
|
||||||
|
build/bootloader/bootloader.bin
|
||||||
|
build/partition_table/partition-table.bin
|
||||||
|
build/flash_project_args
|
||||||
|
build/size_comp1.txt
|
||||||
|
build/size_comp2.txt
|
||||||
|
partitions.csv
|
||||||
|
- uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: ${{ env.artifact_bin_file_name }}
|
||||||
|
path: |
|
||||||
|
build/squeezelite.bin
|
||||||
|
|
||||||
|
- name: Create Release
|
||||||
|
if: env.release_flag == 1
|
||||||
|
id: create_release
|
||||||
|
uses: actions/create-release@v1
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
|
||||||
|
with:
|
||||||
|
tag_name: ${{ env.tag }}
|
||||||
|
|
||||||
|
release_name: ${{ env.name }}
|
||||||
|
body: ${{ env.description }}
|
||||||
|
draft: false
|
||||||
|
prerelease: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
- name: Prepare release
|
||||||
|
if: env.release_flag == 1
|
||||||
|
run: |
|
||||||
|
description=""
|
||||||
|
description=${description}$'------------------------------\n### Revision Log\n\n'
|
||||||
|
description="$description$(git -C ${RUNNER_WORKSPACE} log --pretty=format:'%h %s (%cI) <%an>' --abbrev-commit --max-count=15 | sed --r 's/(^[\*]+)/\\\1/g') "
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user