diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b457bcbf692f..fdb2925a91f9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,18 +11,38 @@ on: description: 'Publish to repository' required: false default: 'false' + add_srm12_builds: + description: 'Include SRM 1.2 archs' + required: false + default: 'false' + add_dsm52_builds: + description: 'Include DSM 5.2 archs' + required: false + default: 'false' + add_dsm62_builds: + description: 'Include DSM 6.2 archs' + required: false + default: 'true' + add_dsm71_builds: + description: 'Include DSM 7.1 archs' + required: false + default: 'true' + add_dsm72_builds: + description: 'Include DSM 7.2 archs' + required: false + default: 'false' pull_request: paths: - - 'spk/**' - - 'cross/**' - - 'native/**' + - 'spk/**' + - 'cross/**' + - 'native/**' push: branches: - "**" paths: - - 'spk/**' - - 'cross/**' - - 'native/**' + - 'spk/**' + - 'cross/**' + - 'native/**' jobs: prepare: @@ -30,14 +50,14 @@ jobs: runs-on: ubuntu-latest # provide results to other jobs outputs: - arch_packages: ${{ steps.dependencies.outputs.arch_packages }} - noarch_packages: ${{ steps.dependencies.outputs.noarch_packages }} + arch_packages: ${{ steps.dependencies.outputs.arch_packages }} + noarch_packages: ${{ steps.dependencies.outputs.noarch_packages }} steps: - name: Checkout repository uses: actions/checkout@v4 with: - fetch-depth: 0 - persist-credentials: false + fetch-depth: 0 + persist-credentials: false - name: Get changed files for pull request if: github.event_name == 'pull_request' @@ -74,17 +94,61 @@ jobs: ARCH_PACKAGES: ${{ needs.prepare.outputs.arch_packages }} NOARCH_PACKAGES: ${{ needs.prepare.outputs.noarch_packages }} + generate_matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + steps: + - id: set-matrix + run: | + # Start with the noarch architectures at the top + matrix='{"include": [' + matrix+='{"arch": "noarch"},' + matrix+='{"arch": "noarch-6.1"},' + matrix+='{"arch": "noarch-7.0"},' + + # Add other architectures based on input flags + if [ "${{ github.event.inputs.add_dsm52_builds }}" == "true" ]; then + matrix+='{"arch": "x86-5.2"},' + matrix+='{"arch": "88f6281-5.2"},' + matrix+='{"arch": "ppc853x-5.2"},' + fi + if [ "${{ github.event.inputs.add_dsm62_builds }}" == "true" ]; then + matrix+='{"arch": "x64-6.2.4"},' + matrix+='{"arch": "aarch64-6.2.4"},' + matrix+='{"arch": "evansport-6.2.4"},' + matrix+='{"arch": "armv7-6.2.4"},' + matrix+='{"arch": "hi3535-6.2.4"},' + matrix+='{"arch": "88f6281-6.2.4"},' + matrix+='{"arch": "qoriq-6.2.4"},' + fi + if [ "${{ github.event.inputs.add_dsm71_builds }}" == "true" ]; then + matrix+='{"arch": "x64-7.1"},' + matrix+='{"arch": "aarch64-7.1"},' + matrix+='{"arch": "evansport-7.1"},' + matrix+='{"arch": "armv7-7.1"},' + matrix+='{"arch": "comcerto2k-7.1"},' + fi + if [ "${{ github.event.inputs.add_dsm72_builds }}" == "true" ]; then + matrix+='{"arch": "x64-7.2"},' + matrix+='{"arch": "aarch64-7.2"},' + fi + if [ "${{ github.event.inputs.add_srm12_builds }}" == "true" ]; then + matrix+='{"arch": "armv7-1.2"},' + fi + + # Remove trailing comma and close the matrix + matrix=$(echo $matrix | sed 's/,$//') + matrix+=']}' + echo "matrix=$matrix" >> $GITHUB_OUTPUT + build: name: Build - needs: prepare + needs: [prepare, generate_matrix] runs-on: ubuntu-latest strategy: fail-fast: false - matrix: - # x64=x86_64, evansport=i686, aarch64=armv8, armv7, hi3535=armv7l, 88f6281=armv5, qoriq=ppc - # https://github.com/SynoCommunity/spksrc/wiki/Synology-and-SynoCommunity-Package-Architectures - arch: [noarch, noarch-6.1, noarch-7.0, x64-6.2.4, x64-7.1, evansport-6.2.4, evansport-7.1, aarch64-6.2.4, aarch64-7.1, armv7-6.2.4, armv7-7.1, hi3535-6.2.4, 88f6281-6.2.4, qoriq-6.2.4, comcerto2k-7.1] - + matrix: ${{ fromJSON(needs.generate_matrix.outputs.matrix) }} steps: - name: Checkout repository uses: actions/checkout@v4