cops, bicbucstriim: update to depend on DSM 7.2 (#6340) #120
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
name: Build | |
on: | |
workflow_dispatch: | |
inputs: | |
package: | |
description: 'Package to build' | |
required: true | |
default: 'adminer' | |
publish: | |
description: 'Publish to repository' | |
required: false | |
default: 'false' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_noarch_builds: | |
description: 'Include noarch packages' | |
required: false | |
default: 'true' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_noarch_dsm72_builds: | |
description: 'Include noarch DSM 7.2 packages' | |
required: false | |
default: 'false' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_dsm72_builds: | |
description: 'Include DSM 7.2 archs' | |
required: false | |
default: 'false' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_dsm71_builds: | |
description: 'Include DSM 7.1 archs' | |
required: false | |
default: 'true' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_dsm62_builds: | |
description: 'Include DSM 6.2 archs' | |
required: false | |
default: 'true' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_dsm52_builds: | |
description: 'Include DSM 5.2 archs' | |
required: false | |
default: 'false' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
add_srm12_builds: | |
description: 'Include SRM 1.2 archs' | |
required: false | |
default: 'false' | |
type: choice | |
options: | |
- 'true' | |
- 'false' | |
pull_request: | |
paths: | |
- 'spk/**' | |
- 'cross/**' | |
- 'native/**' | |
push: | |
branches: | |
- "**" | |
paths: | |
- 'spk/**' | |
- 'cross/**' | |
- 'native/**' | |
jobs: | |
prepare: | |
name: Prepare for Build | |
runs-on: ubuntu-latest | |
# provide results to other jobs | |
outputs: | |
arch_packages: ${{ steps.dependencies.outputs.arch_packages }} | |
noarch_packages: ${{ steps.dependencies.outputs.noarch_packages }} | |
add_noarch_builds: ${{ steps.set-defaults.outputs.add_noarch_builds }} | |
add_noarch_dsm72_builds: ${{ steps.set-defaults.outputs.add_noarch_dsm72_builds }} | |
add_dsm72_builds: ${{ steps.set-defaults.outputs.add_dsm72_builds }} | |
add_dsm71_builds: ${{ steps.set-defaults.outputs.add_dsm71_builds }} | |
add_dsm62_builds: ${{ steps.set-defaults.outputs.add_dsm62_builds }} | |
add_dsm52_builds: ${{ steps.set-defaults.outputs.add_dsm52_builds }} | |
add_srm12_builds: ${{ steps.set-defaults.outputs.add_srm12_builds }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
persist-credentials: false | |
- name: Get changed files for pull request | |
if: github.event_name == 'pull_request' | |
id: getfile_pr | |
run: | | |
git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs | |
echo "files=$(git diff --no-commit-id --name-only -r origin/master...${{github.event.pull_request.head.sha}} | xargs)" >> $GITHUB_OUTPUT | |
- name: Get changed files for push | |
if: github.event_name == 'push' | |
id: getfile | |
run: | | |
git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs | |
echo "files=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }} | xargs)" >> $GITHUB_OUTPUT | |
- name: Evaluate dependencies | |
id: dependencies | |
run: ./.github/actions/prepare.sh | |
env: | |
GH_FILES: ${{ steps.getfile.outputs.files }} ${{ steps.getfile_pr.outputs.files }} | |
SPK_TO_BUILD: ${{ github.event.inputs.package }} | |
# Set default values for all builds (manual or automated) | |
- name: Set default values for generate matrix | |
id: set-defaults | |
run: | | |
echo "add_noarch_builds=${{ github.event.inputs.add_noarch_builds || steps.dependencies.outputs.has_noarch_packages }}" >> $GITHUB_OUTPUT | |
echo "add_noarch_dsm72_builds=${{ github.event.inputs.add_noarch_dsm72_builds || (steps.dependencies.outputs.has_noarch_packages && steps.dependencies.outputs.has_min_dsm72_packages) }}" >> $GITHUB_OUTPUT | |
echo "add_dsm72_builds=${{ github.event.inputs.add_dsm72_builds || (steps.dependencies.outputs.has_arch_packages && steps.dependencies.outputs.has_min_dsm72_packages) }}" >> $GITHUB_OUTPUT | |
echo "add_dsm71_builds=${{ github.event.inputs.add_dsm71_builds || steps.dependencies.outputs.has_arch_packages }}" >> $GITHUB_OUTPUT | |
echo "add_dsm62_builds=${{ github.event.inputs.add_dsm62_builds || steps.dependencies.outputs.has_arch_packages }}" >> $GITHUB_OUTPUT | |
echo "add_dsm52_builds=${{ github.event.inputs.add_dsm52_builds || 'false' }}" >> $GITHUB_OUTPUT | |
echo "add_srm12_builds=${{ github.event.inputs.add_srm12_builds || 'false' }}" >> $GITHUB_OUTPUT | |
- name: Cache downloaded files | |
uses: actions/cache@v4 | |
with: | |
path: distrib | |
# use run_id in key to cache within workflow only. | |
key: distrib-${{ github.run_id }} | |
- name: Download source files | |
run: ./.github/actions/download.sh | |
env: | |
DOWNLOAD_PACKAGES: ${{ steps.dependencies.outputs.download_packages }} | |
ARCH_PACKAGES: ${{ needs.prepare.outputs.arch_packages }} | |
NOARCH_PACKAGES: ${{ needs.prepare.outputs.noarch_packages }} | |
generate_matrix: | |
name: Generate Matrix | |
needs: prepare | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- id: set-matrix | |
run: | | |
# Use the default values passed from the prepare step | |
add_noarch_builds=${{ needs.prepare.outputs.add_noarch_builds }} | |
add_noarch_dsm72_builds=${{ needs.prepare.outputs.add_noarch_dsm72_builds }} | |
add_dsm72_builds=${{ needs.prepare.outputs.add_dsm72_builds }} | |
add_dsm71_builds=${{ needs.prepare.outputs.add_dsm71_builds }} | |
add_dsm62_builds=${{ needs.prepare.outputs.add_dsm62_builds }} | |
add_dsm52_builds=${{ needs.prepare.outputs.add_dsm52_builds }} | |
add_srm12_builds=${{ needs.prepare.outputs.add_srm12_builds }} | |
# Create matrix as a JSON object | |
matrix='{"include": [' | |
if [ "$add_noarch_builds" == "true" ]; then | |
matrix+='{"arch": "noarch-1.1"},' | |
matrix+='{"arch": "noarch-3.1"},' | |
matrix+='{"arch": "noarch-6.1"},' | |
matrix+='{"arch": "noarch-7.0"},' | |
if [ "$add_noarch_dsm72_builds" == "true" ]; then | |
matrix+='{"arch": "noarch-7.2"},' | |
fi | |
fi | |
if [ "$add_dsm72_builds" == "true" ]; then | |
matrix+='{"arch": "x64-7.2"},' | |
matrix+='{"arch": "aarch64-7.2"},' | |
matrix+='{"arch": "armv7-7.2"},' | |
fi | |
if [ "$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 [ "$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 [ "$add_dsm52_builds" == "true" ]; then | |
matrix+='{"arch": "x86-5.2"},' | |
matrix+='{"arch": "88f6281-5.2"},' | |
matrix+='{"arch": "ppc853x-5.2"},' | |
fi | |
if [ "$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, generate_matrix] | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: ${{ fromJSON(needs.generate_matrix.outputs.matrix) }} | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Cache toolchains | |
uses: actions/cache@v4 | |
# Do not cache qoriq toolchain. It must be built every time to install custom rust toolchain | |
if: ${{ contains(matrix.arch,'qoriq') == false }} | |
with: | |
path: toolchain/*/work | |
key: toolchain-${{ matrix.arch }}-v3-${{ hashFiles(format('toolchain/syno-{0}/digests',matrix.arch)) }} | |
- name: Use cache of downloaded files | |
uses: actions/cache@v4 | |
with: | |
path: distrib | |
key: distrib-${{ github.run_id }} | |
- name: Build Package (based on changed files) | |
# We don't want to stop the build on errors. | |
# Errors are reported in "Build Status" | |
continue-on-error: true | |
uses: docker://ghcr.io/synocommunity/spksrc:latest | |
with: | |
entrypoint: ./.github/actions/build.sh | |
env: | |
ARCH_PACKAGES: ${{ needs.prepare.outputs.arch_packages }} | |
NOARCH_PACKAGES: ${{ needs.prepare.outputs.noarch_packages }} | |
PUBLISH: ${{ github.event.inputs.publish }} | |
API_KEY: ${{ secrets.PUBLISH_API_KEY }} | |
PACKAGE_TO_PUBLISH: ${{ github.event.inputs.package }} | |
# https://github.com/SynoCommunity/spksrc/wiki/Compile-and-build-rules | |
GH_ARCH: ${{ matrix.arch }} | |
BUILD_ERROR_FILE: /github/workspace/build_errors.txt | |
BUILD_ERROR_LOGFILE: /github/workspace/build_log_errors.txt | |
BUILD_UNSUPPORTED_FILE: /github/workspace/build_unsupported.txt | |
BUILD_SUCCESS_FILE: /github/workspace/build_success.txt | |
- name: Build Status | |
id: build_status | |
# We need this status since we don't want to stop the build on errors. | |
# Here we fail on build errors found in the build error file. | |
uses: docker://ghcr.io/synocommunity/spksrc:latest | |
with: | |
entrypoint: ./.github/actions/build_status.sh | |
env: | |
BUILD_ERROR_FILE: /github/workspace/build_errors.txt | |
BUILD_ERROR_LOGFILE: /github/workspace/build_log_errors.txt | |
BUILD_UNSUPPORTED_FILE: /github/workspace/build_unsupported.txt | |
BUILD_SUCCESS_FILE: /github/workspace/build_success.txt | |
- name: Upload artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: Packages for ${{ matrix.arch }} | |
path: packages/*.spk | |
if-no-files-found: ignore |