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

CI: Build debian packages and run autopackage tests #130

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
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: 112 additions & 0 deletions .github/workflows/build-deb.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
name: Build debian packages

on:
push:
branches:
- main
pull_request:

Comment on lines +1 to +8
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not a big fan of having this running on every single PR and push to main, tbh. I think it's better to trigger this only if there were any changes on debian/, otherwise it will increase our CI time to run even more for little gain.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh... I would agree on that, if it wouldn't that test may fail in different conditions, and having it tested in a properly isolated testbed is the way.

I think also @didrocks agree'd as per #130 (comment).

However, one thing we could do is limit to changes on **/**_test.go file maybe?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there's a way in github to run only a workflow when a PR is approved? As that would be a way to prevent problems to hit to main without having to test all the PR's from the very first moment.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a job that relies on the completion of another one by setting the needs: field, but I still think that this is not something we need to constantly watch for.

Copy link
Member

@denisonbarbosa denisonbarbosa Feb 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, I'm afraid this kind of action might give users the wrong impression that the code in main is always "ready to use" when, in reality, this kind of project relies a lot on manual tests to ensure none of our dependencies regressed.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, well that's not the point IMHO but at the same it's useful for testing having packages ready all the time.

But well, if someone think that, then is wrong as it would be wrong in any other project doing nightly builds.

However, I can see if can change this to reduce the scope of its action. I guess we'll do this after FF though since this still depends on canonical/desktop-engineering#28

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a CI related PR, so it can definitely wait and be done after FF.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the reason for that was to get this early to be confident on uploading things working stuff to the distro, but we can still append these commits to temporary branches to check things for now.

env:
DEBIAN_FRONTEND: noninteractive
DEBCONF_NONINTERACTIVE_SEEN: true
TERM: dumb

jobs:
build-deb-package:
name: Build ubuntu package
runs-on: ubuntu-latest
outputs:
run-id: ${{ github.run_id }}
pkg-name: ${{ env.PKG_NAME }}
pkg-version: ${{ env.PKG_VERSION }}

steps:
- name: Checkout authd code
uses: actions/checkout@v4

- name: Build debian packages and sources
uses: 3v1n0/desktop-engineering/gh-actions/common/build-debian@build-deb-docker
with:
docker-image: ubuntu:devel
extra-source-build-deps: |
ca-certificates
git

run-lintian:
name: Run lintian
needs: build-deb-package
runs-on: ubuntu-latest

container:
image: ubuntu:devel

steps:
- name: Prepare container
run: |
set -eu

echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90aptyes
apt update

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

- name: Install dependencies
run: |
apt install lintian

- name: Create test user
run: |
apt install adduser
adduser --disabled-password --gecos "" tester
chown tester:tester . -R

- name: Run lintian on source package
run: |
runuser -u tester -- lintian --pedantic --fail-on error \
./*-debian-source/${{ needs.build-deb-package.outputs.pkg-name }}_${{ needs.build-deb-package.outputs.pkg-version }}_source.changes

- name: Run lintian on binary packages
run: |
runuser -u tester -- lintian --pedantic --fail-on error \
./*-debian-packages/*_${{ needs.build-deb-package.outputs.pkg-version }}_*.deb

run-autopkgtests:
name: Run autopkgtests
needs: build-deb-package
runs-on: ubuntu-latest

container:
image: ubuntu:devel

steps:
- name: Prepare container
run: |
set -eu

echo 'APT::Get::Assume-Yes "true";' > /etc/apt/apt.conf.d/90aptyes
apt update

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

- name: Install dependencies
run: |
apt install autopkgtest

- name: Create test user
run: |
apt install adduser
adduser --disabled-password --gecos "" tester

- name: Run autopkgtests
run: |
mv -v ./*-debian-source/* .
mv -v ./*-debian-packages/* .
autopkgtest --apt-pocket proposed --apt-upgrade --no-built-binaries --user=tester \
*_${{ needs.build-deb-package.outputs.pkg-version }}*.deb \
${{ needs.build-deb-package.outputs.pkg-name }}_${{ needs.build-deb-package.outputs.pkg-version }}_source.changes -- null
Loading