Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .github/actions/abi_checker/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ description: |
inputs:
version:
description: The specific version to run the ABI checker against. If not defined, defaults to latest
requred: false
required: false

runs:
using: "composite"
Expand Down Expand Up @@ -86,7 +86,6 @@ runs:
if (( RET & 8 )); then
echo "⚠️ ABI check failed because the PPA did not contained an old version for the package."
echo "Assumption is that this is the first time the package was build."
echo "INITIAL_UPLOAD_TO_PPA=true" >> $GITHUB_ENV
fi

if (( RET & 16 )); then
Expand Down
89 changes: 89 additions & 0 deletions .github/actions/build_package/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Build Debian Package
description: |
This Github Actions builds the package

inputs:
pkg-dir:
description: The directory where the debian package source is
required: true
build-dir:
description: The directory where the package is built
required: true
run-lintian:
description: Run lintian or not during the build
default: false

runs:
using: "composite"

steps:

- name: Validate Or Create Chroot Environment
shell: bash
run: |
./qcom-build-utils/scripts/prep_chroot_env.py \
--arch ${{env.ARCH}} \
--os-codename ${{env.UBUNTU_CODENAME}} \
--suffix ${{env.DISTRO}}

- name: Prepare Workspace Structure For The Build
shell: bash
run: |
echo "Listing the content of the workspace :"; tree

mkdir ${{inputs.build-dir}}

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 Package
shell: bash
run: |
cd ${{inputs.pkg-dir}}

if [[ "${{inputs.run-lintian}}" == "true" ]]; then
lintian_flag="--run-lintian"
else
lintian_flag="--no-run-lintian"
fi

if curl -sfI "http://pkg.qualcomm.com/dists/${{env.UBUNTU_CODENAME}}/Release" > /dev/null; then
EXTRA_REPO="--extra-repository='deb [arch=${{env.ARCH}} trusted=yes] http://pkg.qualcomm.com ${{env.UBUNTU_CODENAME}}/stable main'"
else
EXTRA_REPO=""
fi

set +e

# ℹ️ --git-ignore-branch is necessary because the debian branch actually checked out can be any (ex, debian/1.0.0) because we can build any previous tag
gbp buildpackage \
--git-ignore-branch \
--git-builder="sbuild --arch=${{env.ARCH}} \
--dist=${{env.UBUNTU_CODENAME}}-${{env.ARCH}}-${{env.DISTRO}} \
$lintian_flag \
--build-dir ../${{inputs.build-dir}} \
--build-dep-resolver=apt \
$EXTRA_REPO"

RET=$?

if (( RET == 0 )); then
echo "✅ Successfully built package"
else
BUILD_LOG=$(find ../${{inputs.build-dir}} -maxdepth 1 -name "*.build" ! -type l)

if [[ -n "$BUILD_LOG" ]]; then
tail -n 500 "$BUILD_LOG"
echo "❌ Build failed, printed the last 500 lines of the build log file"
else
echo "❌ Build failed, but no .build log file was found to print"
fi

exit 1
fi
1 change: 0 additions & 1 deletion .github/actions/push_to_repo/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ runs:

steps:


- name: Extract built package name
shell: bash
run: |
Expand Down
98 changes: 29 additions & 69 deletions .github/workflows/qcom-build-debian-package-reusable-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ on:
type: boolean
default: false

abi-checker:
run-abi-checker:
description: Run the ABI checker or not
type: boolean
default: false
Expand All @@ -38,6 +38,11 @@ on:
type: boolean
default: false

is-post-merge:
description: true if this build has been triggered by a merge into debian/latest. Will ensure PR branch is deleted
type: boolean
default: false

secrets:
TOKEN:
required: true
Expand Down Expand Up @@ -82,88 +87,43 @@ jobs:
token: ${{secrets.TOKEN}}
path: ./qcom-build-utils
fetch-depth: 1
sparse-checkout: |
.github
scripts

- 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.TOKEN}}
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: Validate Or Create Chroot Environment
run: |
./qcom-build-utils/scripts/prep_chroot_env.py \
--arch ${{env.ARCH}} \
--os-codename ${{env.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
fetch-depth: 0 # <- Important for the tags fetching to work
fetch-tags: true # <- Important

- name: Build Debian Packages
run: |
cd package-repo

if [[ "${{inputs.run-lintian}}" == "true" ]]; then
lintian_flag="--run-lintian"
else
lintian_flag="--no-run-lintian"
fi

if curl -sfI "http://pkg.qualcomm.com/dists/${{env.UBUNTU_CODENAME}}/Release" > /dev/null; then
EXTRA_REPO="--extra-repository='deb [arch=${{env.ARCH}} trusted=yes] http://pkg.qualcomm.com ${{env.UBUNTU_CODENAME}}/stable main'"
else
EXTRA_REPO=""
fi
uses: ./qcom-build-utils/.github/actions/build_package
with:
pkg-dir: package-repo
build-dir: build-area
run-lintian: ${{inputs.run-lintian}}

set +e
gbp buildpackage --git-ignore-branch \
--git-builder="sbuild --arch=${{env.ARCH}} \
--dist=${{env.UBUNTU_CODENAME}}-${{env.ARCH}}-${{env.DISTRO}} \
$lintian_flag \
--build-dir ../build-area \
--build-dep-resolver=apt \
$EXTRA_REPO"

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-area -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}}
- name: Run ABI (Application Binary Interface) Check
if: ${{inputs.run-abi-checker == true}}
uses: ./qcom-build-utils/.github/actions/abi_checker

- name: Push package to repo
if: ${{inputs.push-to-repo == true}}
uses: ./qcom-build-utils/.github/actions/push_to_repo
with:
force-override: false
token: ${{secrets.TOKEN}}
token: ${{secrets.TOKEN}}

- name: Push debian/<version> tag
if: ${{inputs.is-post-merge == true}}
run: |
cd ./package-repo

version=$(dpkg-parsechangelog --show-field Version)
git tag debian/${version}

git push origin debian/${version}
Loading
Loading