Decouple abi check and push into actions #1
This file contains hidden or 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: Qualcomm Build Debian Package Reusable Workflow | ||
Check failure on line 1 in .github/workflows/qcom-build-debian-package-reusable-workflow.yml
|
||
description: | | ||
This reusable workflow is called by debian-packaging repos to offer a consistent build process. | ||
Package repos will adhere to a git-buildpackage structure and contain the small "build-debian-package.yml" | ||
caller workflow in its .github/workflows folder. | ||
on: | ||
workflow_call: | ||
inputs: | ||
qcom-build-utils-ref: | ||
description: The ref name that was used to invoke this reusable workflow | ||
type: string | ||
required: true | ||
debian-ref: | ||
description: The debian ref to build. For example branch "debian/latest" or tag "debian/1.0.0-1" | ||
type: string | ||
required: true | ||
default: debian/latest | ||
ubuntu-codename: | ||
description: The ubuntu codename to build for. Ex noble, jammy, etc | ||
type: string | ||
default: noble | ||
run-lintian: | ||
description: Run lintian or not during the build | ||
type: boolean | ||
default: false | ||
abi-checker: | ||
description: Run the ABI checker or not | ||
type: boolean | ||
default: false | ||
push-to-repo: | ||
description: Whether or not to push the built package to the repository if the compiled version is not already in it | ||
type: boolean | ||
default: false | ||
secrets: | ||
PAT: | ||
required: true | ||
permissions: | ||
contents: read | ||
security-events: write | ||
env: | ||
REPO_URL: https://qualcomm-linux.github.io/pkg-oss-staging-repo/ | ||
# This variable is set to true below if the ABI check is not able to find an initial | ||
# version of the package in the PPA. | ||
INITIAL_UPLOAD_TO_PPA: 'false' | ||
ABI_CHECK_RETURN_VALUE: 0 | ||
DISTRO: ubuntu | ||
ARCH: arm64 | ||
PPA_PACKAGES_FILE_REPO_PATH: null | ||
jobs: | ||
build-debian-package: | ||
runs-on: [self-hosted, Linux, ARM64] | ||
# runs-on: [self-hosted, lecore-stg-u2404-arm64-xlrg-od-ephem] | ||
# container: | ||
# image: ubuntu:noble | ||
# options: --volume /srv/chroot:/srv/chroot | ||
steps: | ||
# - name: Install dependencies | ||
# run: | | ||
# apt-get update | ||
# apt-get install -y git git-buildpackage sbuild debootstrap tree | ||
- name: Ensure Workspace Is Clean | ||
run: rm -rf * | ||
- name: Checkout qcom-build-utils | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: qualcomm-linux/qcom-build-utils | ||
ref: ${{inputs.qcom-build-utils-ref}} | ||
token: ${{secrets.PAT}} | ||
path: ./qcom-build-utils | ||
fetch-depth: 1 | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{inputs.debian-ref}} | ||
clean: false # A rm -rf * was done first, don't clean otherwise this would delete qcom-build-utils cloned above | ||
token: ${{secrets.PAT}} | ||
path: ./package-repo | ||
fetch-depth: 1 | ||
- name: Fetch All Branches and Tags | ||
run: | | ||
cd ./package-repo | ||
git fetch --depth=1 origin "+refs/heads/*:refs/remotes/origin/*" "+refs/tags/*:refs/tags/*" | ||
- name: Exctract Product Configuration From qcom-product.conf | ||
run: | | ||
echo "PPA_PACKAGES_FILE_REPO_PATH=dists/$CODENAME/stable/main/binary-$ARCH" >> $GITHUB_ENV | ||
- name: Validate Or Create Chroot Environment | ||
run: | | ||
./qcom-build-utils/scripts/prep_chroot_env.py \ | ||
--arch ${{env.ARCH}} \ | ||
--os-codename ${{inputs.ubuntu-codename}} \ | ||
--suffix ${{env.DISTRO}} | ||
- name: Prepare Workspace Structure For The Build | ||
run: | | ||
echo "Listing the content of the workspace :"; tree | ||
mkdir build-area | ||
if grep -q 'quilt' ./package-repo/debian/source/format; then | ||
echo "Source format is quilt" | ||
elif grep -q 'native' ./package-repo/debian/source/format; then | ||
echo "Source format is native" | ||
else | ||
echo "Source format is unknown or unsupported" | ||
exit 1 | ||
fi | ||
- name: Build Debian Packages | ||
run: | | ||
set +e | ||
cd package-repo | ||
if [[ "${{inputs.run-lintian}}" == "true" ]]; then | ||
lintian_flag="--run-lintian" | ||
else | ||
lintian_flag="--no-run-lintian" | ||
fi | ||
gbp buildpackage --git-ignore-branch \ | ||
--git-builder="sbuild --arch=${{env.ARCH}} \ | ||
--dist=${{inputs.ubuntu-codename}}-${{env.ARCH}}-${{env.DISTRO}} \ | ||
$lintian_flag \ | ||
--build-dir ../build-area \ | ||
--build-dep-resolver=apt \ | ||
--extra-repository='deb [arch=${{env.ARCH}} trusted=yes] http://pkg.qualcomm.com ${{inputs.ubuntu-codename}}/stable main'" | ||
RET=$? | ||
set -e | ||
if (( RET == 0 )); then | ||
echo "✅ Successfully built package" | ||
else | ||
# Print the real .build log, not the symlink | ||
tail -n 500 $(find ../build -maxdepth 1 -name "*.build" ! -type l) | ||
echo "❌ Build failed, printed the last 500 lines of the build log file" | ||
exit 1 | ||
fi | ||
- name: Run ABI Check | ||
if: ${{inputs.abi-checker == true}} | ||
uses: .github/actions/abi_check.yml | ||
with: | ||
repo_url : ${{env.REPO_URL}} | ||
- name: Push package to repo | ||
if: ${{inputs.push-to-repo == true}} | ||
uses: .github/actions/push_to_repo.yml | ||