Skip to content

ci: try to build deb package #2

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

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
62 changes: 62 additions & 0 deletions .github/workflows/build-deb.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: build

on:
push:
branches:
- main
- github-ci

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
build-amd64:
runs-on: ubuntu-latest
container: debian:12
steps:
- name: install dependencies
run: |
echo "MIRRORSITE=http://deb.debian.org/debian" > /etc/pbuilderrc
apt update
apt install -y git-buildpackage build-essential debhelper-compat default-libmysqlclient-dev krb5-multidev libapparmor-dev libbz2-dev libcap-dev libdb-dev libexpat-dev libexttextcat-dev libicu-dev libldap2-dev liblua5.4-dev liblz4-dev liblzma-dev libpam0g-dev libpq-dev libsasl2-dev libsodium-dev libsqlite3-dev libssl-dev libstemmer-dev libsystemd-dev libwrap0-dev libzstd-dev pkg-config zlib1g-dev git libunwind-dev rsync

- name: clone repository
run: git clone https://github.com/chatmail/dovecot
Copy link

Choose a reason for hiding this comment

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

This should ideally use actions/checkout so it checks out the PR commit and not whatever commit is on main now.
Apparently it should just work, the only problems users seems to have here are due to insufficient privileges:
https://stackoverflow.com/questions/68578638/how-to-checkout-repo-inside-the-docker-in-github-action

Copy link
Author

Choose a reason for hiding this comment

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

The problem is that the checkout action doesn't create the .git directory, but gbp expects it to be there...

Also, I'd only want to publish builds from main to https://download.delta.chat/dovecot/, as we don't have a staging environment where we could upload builds from other branches.

Copy link

Choose a reason for hiding this comment

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

The problem is that the checkout action doesn't create the .git directory

I just tested in #3, checkout action creates .git directory.

Now there is a problem that gbp is unhappy about changes on top of master (committing .github) that are not in the changelog. This will fail when merged on master, currently it only works because the workflow is not on the master branch yet.


- name: build
run: |
cd dovecot
DEB_BUILD_OPTIONS=nocheck gbp buildpackage --git-no-pristine-tar -us -uc

- name: upload .deb files
run: |
mkdir -p "$HOME/.ssh"
echo "${{ secrets.KEY }}" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
rsync -rILvh -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no" $GITHUB_WORKSPACE/build-area/ "${{ secrets.USERNAME }}@download.delta.chat:/var/www/html/download/dovecot/"

build-arm:
runs-on: ubuntu-24.04-arm
container: debian:12
steps:
- name: install dependencies
run: |
echo "MIRRORSITE=http://deb.debian.org/debian" > /etc/pbuilderrc
apt update
apt install -y git-buildpackage build-essential debhelper-compat default-libmysqlclient-dev krb5-multidev libapparmor-dev libbz2-dev libcap-dev libdb-dev libexpat-dev libexttextcat-dev libicu-dev libldap2-dev liblua5.4-dev liblz4-dev liblzma-dev libpam0g-dev libpq-dev libsasl2-dev libsodium-dev libsqlite3-dev libssl-dev libstemmer-dev libsystemd-dev libwrap0-dev libzstd-dev pkg-config zlib1g-dev git libunwind-dev rsync

- name: clone repository
run: git clone https://github.com/chatmail/dovecot

- name: build
run: |
cd dovecot
DEB_BUILD_OPTIONS=nocheck gbp buildpackage --git-no-pristine-tar -us -uc

- name: upload .deb files
run: |
mkdir -p "$HOME/.ssh"
echo "${{ secrets.KEY }}" > "$HOME/.ssh/key"
chmod 600 "$HOME/.ssh/key"
rsync -rILvh -e "ssh -i $HOME/.ssh/key -o StrictHostKeyChecking=no" $GITHUB_WORKSPACE/build-area/ "${{ secrets.USERNAME }}@download.delta.chat:/var/www/html/download/dovecot/"