Update Debian Package Services and Config Directory #313
Workflow file for this run
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
# This action originally modeled off of the Debian build action: | |
# https://salsa.debian.org/wouter/ola/-/blob/a38a396f6994b2b1af8efec9e208aee4e67f77aa/.gitlab-ci.yml | |
name: debian | |
on: [push, pull_request] | |
jobs: | |
debian-build: | |
name: 'Debian Build ${{ matrix.image_tag }} ${{ matrix.architecture }}' | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image_tag: [bullseye, bookworm, trixie, sid] | |
architecture: [amd64] | |
container: debian:${{ matrix.image_tag }} | |
steps: | |
- name: Get number of CPU cores | |
run: echo "NUM_CPU_CORES=$(grep -c processor /proc/cpuinfo)" >> $GITHUB_OUTPUT | |
id: num-cpu-cores | |
- name: Update package database | |
run: apt-get update -y | |
# See comments beginning at | |
# https://github.com/actions/runner/issues/763#issuecomment-1435474884 | |
# Without Git, actions/checkout@v4 will resort to REST and will not | |
# create a .git folder or .git.config. The Problem Matcher looks for | |
# .git/config to find where the root of the repo is, so it must be | |
# present. | |
- name: Install Git and lsb-release | |
run: apt-get -y install git lsb-release | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all tags for generating OLA_BUILD_NAME | |
- name: Generate build name | |
shell: bash | |
run: | | |
chown root:root . # workaround Git security precaution, see https://github.com/actions/runner-images/issues/6775 | |
export OLA_BUILD_NAME=$(./scripts/build_name.sh) | |
# No docker number tag for testing, so must use lsb_release | |
export OLA_DEBIAN_BUILD_VERSION=$(./scripts/build_name.sh --debian) | |
echo "OLA_BUILD_NAME=$OLA_BUILD_NAME" >> $GITHUB_OUTPUT | |
echo "OLA_BUILD_NAME=$OLA_BUILD_NAME" >> $GITHUB_ENV # Set build name globally so that modifications don't cause -dirty | |
echo "OLA_DEBIAN_BUILD_VERSION=$OLA_DEBIAN_BUILD_VERSION" >> $GITHUB_OUTPUT | |
echo "Build name: $OLA_BUILD_NAME" | |
echo "Debian Build Version: $OLA_DEBIAN_BUILD_VERSION" | |
id: generate-build-name | |
- name: Install build tools | |
run: apt-get -y install devscripts adduser fakeroot sudo | |
- name: Create Debian version for build | |
shell: bash | |
run: | | |
DEBFULLNAME="GitHub Actions" [email protected] \ | |
debchange --force-bad-version \ | |
--newversion ${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }} \ | |
"GitHub Actions Build \ | |
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" | |
- name: Install build dependencies | |
run: mk-build-deps -t "apt-get -y -o Debug::pkgProblemResolver=yes --no-install-recommends" -i -r | |
- name: Set up build user | |
run: | | |
adduser --disabled-password --gecos "" builduser | |
chown -R builduser:builduser . | |
chown builduser:builduser .. | |
- name: Build | |
run: sudo -u builduser env "OLA_BUILD_NAME=$OLA_BUILD_NAME" dpkg-buildpackage -v${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }} -b -rfakeroot -j${{ steps.num-cpu-cores.outputs.NUM_CPU_CORES }} | |
- name: Move built files | |
if: always() | |
run: | | |
mkdir built | |
dcmd mv ../*ges built/ | |
- name: Display structure of built files | |
if: always() | |
run: ls -alR | |
working-directory: built | |
- name: SHA256 built files | |
if: always() | |
shell: bash | |
run: find . -type f -exec sha256sum {} \; | |
working-directory: built | |
- uses: actions/upload-artifact@v3 | |
if: always() | |
with: | |
name: ola-built-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }} | |
path: ./built | |
debian-test: | |
name: 'Debian Test ${{ matrix.image_tag }} ${{ matrix.architecture }}' | |
needs: debian-build | |
if: "always()" # Run if some builds fail but ensure they all complete first | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
image_tag: [bullseye, bookworm, trixie, sid] | |
architecture: [amd64] | |
container: debian:${{ matrix.image_tag }} | |
steps: | |
- name: Update package database | |
run: apt-get update -y | |
- name: Install Git and lsb-release | |
run: apt-get -y install git lsb-release | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Fetch all tags for generating OLA_DEBIAN_BUILD_VERSION | |
- name: Generate build name # Job step outputs can't be passed between builds for matrix jobs, so we re-generate | |
shell: bash | |
run: | | |
chown root:root . # workaround Git security precaution, see https://github.com/actions/runner-images/issues/6775 | |
# No docker number tag for testing, so must use lsb_release | |
export OLA_DEBIAN_BUILD_VERSION=$(./scripts/build_name.sh --debian) | |
echo "OLA_DEBIAN_BUILD_VERSION=$OLA_DEBIAN_BUILD_VERSION" >> $GITHUB_OUTPUT | |
echo "Debian Build Version: $OLA_DEBIAN_BUILD_VERSION" | |
id: generate-build-name | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: ola-built-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }} | |
path: built | |
- name: Display structure of artifact files | |
run: ls -alR | |
working-directory: built | |
- name: Update package database | |
run: apt-get update -y | |
- name: Install test tools | |
run: apt-get -y install autopkgtest | |
- name: Test | |
run: autopkgtest --output-dir=test-output built/*ges -- null | |
- uses: actions/upload-artifact@v3 | |
if: always() # Always upload the test output, even on failed tests | |
with: | |
name: ola-test-output-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }} | |
path: test-output |