Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(gh-actions/build-debian): Support running a workflow script at build-source phase #54

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
6 changes: 6 additions & 0 deletions .github/workflows/test-build-deb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,12 @@ jobs:
docker-image: ubuntu:devel
lintian: --fail-on error
extra-source-build-deps: ''
extra-source-build-script: |
echo '$HOME' is "${HOME}"
echo "::group::Get some system information"
uname -a
cat /etc/os-release
echo "::endgroup::"

lintian-to-md:
name: Test lintian results parser to markdown
Expand Down
27 changes: 25 additions & 2 deletions gh-actions/common/build-debian/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@ inputs:
description: A list of extra build dependencies required during source build.
required: false
# FIXME: this should default to '', but we don't want to break job depending on us for now
default: 'ca-certificates git'
default: 'ca-certificates'
extra-source-build-script:
description: |
A script to run to prepare the source build machine.
This happens after the dependencies have been installed, but before
running `dpkg-buildpackage -S`.
required: false
default: ''
lintian:
required: false
description: Arguments to pass to lintian, if any. Set to `skip` to skip the lintian check.
Expand Down Expand Up @@ -133,9 +140,17 @@ runs:

echo "::group::Install build dependencies"
apt build-dep .

GITHUB_TOKEN="${{ inputs.token }}"

if [ -n "${{ inputs.extra-source-build-deps }}" ]; then
# Install extra packages for build-deps, to allow downloading vendored sources
deps=(${{ inputs.extra-source-build-deps }})

if [ -n "${GITHUB_TOKEN}" ]; then
deps+=(git)
fi

apt install ${deps[@]}
fi
echo "::endgroup::"
Expand All @@ -144,11 +159,19 @@ runs:
git config --system --add safe.directory "${{ github.workspace }}"
fi

GITHUB_TOKEN="${{ inputs.token }}"
if [ -n "${GITHUB_TOKEN}" ]; then
git config --system url."https://api:${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"
fi

if [ -n "${{ inputs.extra-source-build-script != '' && 'true' || '' }}" ]; then
echo "::group::Run source build script"
(
set -eux
${{ inputs.extra-source-build-script }}
)
echo "::endgroup::"
fi

echo "::group::Build debian source package"
dpkg-buildpackage -D -S --sanitize-env
echo "::endgroup::"
Expand Down
Loading