Skip to content
Draft
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
112 changes: 0 additions & 112 deletions .github/workflows/auto-updates.yaml

This file was deleted.

28 changes: 0 additions & 28 deletions .github/workflows/automatic-doc-checks.yml

This file was deleted.

196 changes: 1 addition & 195 deletions .github/workflows/build-deb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
uses: actions/checkout@v6

- name: Build debian packages and sources
uses: canonical/desktop-engineering/gh-actions/common/build-debian@main
uses: canonical/desktop-engineering/gh-actions/common/build-debian@licenserecon
with:
docker-image: ubuntu:${{ matrix.ubuntu-version }}
# Add the Go backports PPA if we're testing a Ubuntu release which
Expand Down Expand Up @@ -94,197 +94,3 @@ jobs:
echo "pkg-dsc-${{ matrix.ubuntu-version }}=${{ env.PKG_DSC }}"
echo "pkg-src-changes-${{ matrix.ubuntu-version }}=${{ env.PKG_SOURCE_CHANGES }}"
) >> "${GITHUB_OUTPUT}"

check-modified-files:
name: Check modified files
runs-on: ubuntu-latest
needs:
- build-deb-package
outputs:
list: ${{ fromJSON(steps.git-diff.outputs.modified_files) }}

steps:
- name: Checkout authd code
uses: actions/checkout@v6
with:
fetch-depth: 100

- id: git-diff
name: Check modified files
run: |
set -ue

base_ref=${{ github.event.pull_request.base.sha }}
if [ -z "${base_ref}" ]; then
base_ref=${{ github.event.before }}
fi
if [ -z "${base_ref}" ]; then
base_ref=$(git log --root --reverse -n1 --format=%H)
fi

# Build a JSON array of modified paths.
modified_files=$(git diff --name-only "${base_ref}" HEAD | \
while read line; do
jq -n --arg path "$line" '$path'
done | jq -n '. |= [inputs]')
echo "${modified_files}"

escaped_json=$(echo "${modified_files}" | jq '.| tostring')
echo "modified_files=${escaped_json}" >> "${GITHUB_OUTPUT}"

synchronize-packaging-branches:
name: Update packaging branch
runs-on: ubuntu-latest
needs:
- define-versions
- build-deb-package
permissions:
contents: write
strategy:
fail-fast: false
matrix:
ubuntu-version: ${{ fromJSON(needs.define-versions.outputs.ubuntu-versions) }}
env:
PACKAGING_BRANCH: ubuntu-packaging-${{ matrix.ubuntu-version }}

# Run only on:
# - Push events to main
# - On github release
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
github.event_name == 'release' }}

steps:
# FIXME: Use dynamic outputs when possible: https://github.com/actions/runner/pull/2477
- name: Setup job variables
run: |
set -exuo pipefail

json_output='${{ toJSON(needs.build-deb-package.outputs) }}'
for var in $(echo "${json_output}" | jq -r 'keys | .[]'); do
if [[ "${var}" != *"-${{ matrix.ubuntu-version }}" ]]; then
continue;
fi

v=$(echo "${json_output}" | jq -r ".\"${var}\"")
var="${var%-${{ matrix.ubuntu-version }}}"
echo "${var//-/_}=${v}" >> "${GITHUB_ENV}"
done

- name: Download artifacts
uses: actions/download-artifact@v7
with:
run-id: ${{ needs.build-deb-package.outputs.run-id }}
merge-multiple: true

- name: Install dependencies
run: |
set -euo pipefail

sudo apt-get update -y
sudo apt-get install -y --no-install-suggests --no-install-recommends \
dpkg-dev devscripts

- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 100
path: repo

- name: Extract the debian sources
run: |
set -euo pipefail

dpkg-source -x ${{ env.pkg_dsc }} sources

- name: Commit packaging sources
run: |
set -exuo pipefail

# Create or switch to the packaging branch
if git -C repo fetch --depth=1 origin "${{ env.PACKAGING_BRANCH }}:${{ env.PACKAGING_BRANCH }}"; then
git -C repo checkout "${{ env.PACKAGING_BRANCH }}"
else
git -C repo checkout -b "${{ env.PACKAGING_BRANCH }}"
fi

# Replace the repository content with the package sources
mv repo/.git sources/
cd sources

# Drop the ubuntu version, as the PPA recipe will add it anyways
version=$(dpkg-parsechangelog -SVersion)
sanitized_version=$(echo "${version}" | sed "s,~[0-9.]\+\$,,")
perl -pe "s|\Q${version}\E|${sanitized_version}|" debian/changelog > \
debian/changelog.sanitized
mv debian/changelog.sanitized debian/changelog
dpkg-parsechangelog

git config --global user.name "Ubuntu Enterprise Desktop"
git config --global user.email "[email protected]"

git add --all
git commit \
--allow-empty \
-m "Update ubuntu ${{ matrix.ubuntu-version }} package sources" \
-m "Use upstream commit ${GITHUB_SHA}"

- name: Push to packaging branch
run: |
set -exuo pipefail

git -C sources push origin "${{ env.PACKAGING_BRANCH }}:${{ env.PACKAGING_BRANCH }}"

run-autopkgtests:
name: Run autopkgtests
runs-on: ubuntu-latest
needs:
- define-versions
- build-deb-package
- check-modified-files
strategy:
fail-fast: false
matrix:
ubuntu-version: ${{ fromJSON(needs.define-versions.outputs.ubuntu-versions) }}

# Run autopkgtests only on:
# - Push events to main
# - When a file in the debian subdir is modified
# - When this file is modified
# - On new tags
# - On github release
if: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') ||
contains(needs.check-modified-files.outputs.list, 'debian/') ||
contains(needs.check-modified-files.outputs.list, '.github/workflows/build-deb.yaml') ||
startsWith(github.ref, 'refs/tags/') ||
github.event_name == 'release' }}

steps:
# FIXME: Use dynamic outputs when possible: https://github.com/actions/runner/pull/2477
- name: Setup job variables
run: |
set -exuo pipefail

json_output='${{ toJSON(needs.build-deb-package.outputs) }}'
for var in $(echo "${json_output}" | jq -r 'keys | .[]'); do
if [[ "${var}" != *"-${{ matrix.ubuntu-version }}" ]]; then
continue;
fi

v=$(echo "${json_output}" | jq -r ".\"${var}\"")
var="${var%-${{ matrix.ubuntu-version }}}"
echo "${var//-/_}=${v}" >> "${GITHUB_ENV}"
done

- name: Download artifacts
uses: actions/download-artifact@v7
with:
run-id: ${{ needs.build-deb-package.outputs.run-id }}
pattern: ${{ needs.build-deb-package.outputs.pkg-name }}_${{ env.pkg_version }}-*
merge-multiple: true

- name: Run autopkgtests
uses: canonical/desktop-engineering/gh-actions/common/run-autopkgtest@main
with:
lxd-image: ubuntu:${{ matrix.ubuntu-version }}
source-changes: ${{ env.pkg_src_changes }}
autopkgtest-args: --add-apt-source=ppa:ubuntu-enterprise-desktop/golang
16 changes: 0 additions & 16 deletions .github/workflows/cla-check.yaml

This file was deleted.

25 changes: 0 additions & 25 deletions .github/workflows/git.yml

This file was deleted.

Loading
Loading