Skip to content

feat(gh-actions): Add an action for checking C format #175

feat(gh-actions): Add an action for checking C format

feat(gh-actions): Add an action for checking C format #175

Workflow file for this run

name: Test build debian package
on:
push:
branches:
- main
paths:
- gh-actions/common/build-debian/**
- .github/workflows/test-build-deb*
pull_request:
env:
DEBIAN_FRONTEND: noninteractive
DEBCONF_NONINTERACTIVE_SEEN: true
jobs:
build_native_deb:
name: Test build native debian package
runs-on: ubuntu-latest
outputs:
pkg-name: ${{ env.PKG_NAME }}
pkg-version: ${{ env.PKG_VERSION }}
steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install ubuntu-dev-tools
- name: Get and prepare package source
run: |
set -eu
echo "::group::Get source"
pull-lp-source --download-only hello
dpkg-source -x hello*.dsc hello-src
rm -rf hello_*
mv -v hello-src/* .
echo "::endgroup::"
echo "::group::Mark package as a native package"
echo "3.0 (native)" > debian/source/format
dch -v$(dpkg-parsechangelog -S Version | cut -f1 -d-).1 \
"Mark as native package"
echo "::endgroup::"
- name: Checkout code
uses: actions/checkout@v4
with:
path: .source
- name: Build package
uses: ./.source/gh-actions/common/build-debian
with:
docker-image: ubuntu:devel
build_source_deb:
name: Test build quilt debian package
runs-on: ubuntu-latest
outputs:
pkg-name: ${{ env.PKG_NAME }}
pkg-version: ${{ env.PKG_VERSION }}
source-pkg: ${{ steps.build-debian-source-package-upload-step.outputs.artifact-url }}
binaries: ${{ steps.build-debian-binary-packages-upload-step.outputs.artifact-url }}
steps:
- name: Install dependencies
run: |
sudo apt update
sudo apt install ubuntu-dev-tools
- name: Get package source
run: |
set -eu
pull-lp-source --download-only hello
dpkg-source -x hello*.dsc hello-src
- name: Checkout code
uses: actions/checkout@v4
with:
path: .source
- name: Build package
uses: ./.source/gh-actions/common/build-debian
with:
source-dir: ./hello-src
docker-image: ubuntu:devel
lintian: --fail-on error
extra-source-build-deps: ''
lintian-to-md:
name: Test lintian results parser to markdown
runs-on: ubuntu-latest
container:
image: ubuntu:rolling
steps:
- name: Install dependencies
env:
DEBIAN_FRONTEND: noninteractive
run: |
set -eu
apt update -y
apt install -y lintian
- name: Checkout code
uses: actions/checkout@v4
- name: Create test input
shell: bash
env:
NUMBER_OF_RANDOM_TAGS: 50
run: |
set -eu
test_tags=$(mktemp)
mapfile -t tags < <(lintian-explain-tags -l | shuf | head -n${NUMBER_OF_RANDOM_TAGS})
tags+=(
# Tags with edge cases to test
debhelper-compat-level
init.d-script-missing-lsb-keyword
team/pkg-js/testsuite/no-testsuite-header
)
for tag in "${tags[@]}"; do
lintian_line=$(lintian-explain-tags "${tag}" --output-width 80 | \
sed -n "s/^\([^N]\): \(.*\)/\1: package-$RANDOM: \2/p");
if [ $((RANDOM%2)) -ne 0 ]; then
lintian_line+=" with some random data [$RANDOM]"
fi
echo "${lintian_line}" | tee -a "${test_tags}"
test "${PIPESTATUS[1]}" -eq 0
done
echo TEST_TAGS="${test_tags}" >> "${GITHUB_ENV}"
- name: Test lintian markdown parser
shell: bash
run: |
set -eu
cat "${{ env.TEST_TAGS }}" | \
./gh-actions/common/build-debian/lintian-to-md.sh |
tee -a "${GITHUB_STEP_SUMMARY}"
pipe_status=(${PIPESTATUS[@]})
for s in ${pipe_status[@]}; do
echo "Pipe return value: $s"
test "${s}" -eq 0
done