Skip to content

Commit 295d976

Browse files
committed
Add Github Actions CI and Docker test functionality
1 parent 20e6fa3 commit 295d976

4 files changed

Lines changed: 66 additions & 13 deletions

File tree

.github/workflows/autopkgtest.yaml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
name: autopkgtest
2+
on:
3+
push
4+
5+
concurrency:
6+
group: "${{ github.workflow }}-${{ github.ref }}"
7+
cancel-in-progress: true
8+
9+
jobs:
10+
test-debian:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v6
14+
- run: ./docker_run_autopkgtest
15+
name: "Test privleap on Debian trixie"

Dockerfile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## Copyright (C) 2026 - 2026 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
2+
## See the file COPYING for copying conditions.
3+
4+
## Note that this file is in the root directory of the privleap source code
5+
## because 'docker build' needs to be able to copy the whole source directory
6+
## into the image, but it appears 'docker build' prevents directory traversal.
7+
8+
FROM debian:13
9+
RUN apt-get update
10+
RUN apt-get install -y debhelper debhelper-compat python3 python3-pam python3-sdnotify autopkgtest mmdebstrap debian-archive-keyring sudo zstd
11+
RUN useradd -m user
12+
RUN adduser user sudo
13+
RUN passwd -d user
14+
COPY . /home/user/privleap
15+
RUN chown -R user:user /home/user/privleap
16+
#LABEL org.opencontainers.image.title="privleap-test-docker"
17+
ENTRYPOINT ["/bin/bash", "-l", "-c"]

docker_run_autopkgtest

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
3+
## Copyright (C) 2026 - 2026 ENCRYPTED SUPPORT LLC <adrelanos@whonix.org>
4+
## See the file COPYING for copying conditions.
5+
6+
set -x
7+
set -o errexit
8+
set -o nounset
9+
set -o errtrace
10+
set -o pipefail
11+
12+
run-docker-autopkgtest() {
13+
docker build --tag "privleap-test-docker:latest" .
14+
docker run -i --rm --privileged privleap-test-docker:latest 'setpriv --reuid $(id -u user) --regid $(id -g user) --init-groups --reset-env -- /home/user/privleap/run_autopkgtest'
15+
docker rmi privleap-test-docker:latest
16+
}
17+
18+
run-docker-autopkgtest

run_autopkgtest

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,27 @@ Options:
5757
}
5858

5959
run_autopkgtest() {
60-
local arg
61-
arg="${1:-}"
62-
if [ "${arg}" = '--help' ] || [ "${arg}" = '-h' ] || [ "${arg}" = '-?' ]; then
63-
print_usage
64-
exit 0
65-
fi
66-
6760
if [ "$(id -u)" = '0' ]; then
6861
1>&2 echo 'Do not run this script as root!'
6962
exit 1
7063
fi
7164

72-
if [ "${arg}" = '--reset-tarball' ]; then
73-
rm -f "${autopkgtest_tarball_path}"
74-
elif [ -n "${arg}" ]; then
75-
1>&2 echo "Unrecognized argument: '${arg}'. Try 'run_autopkgtest --help' for usage info."
76-
exit 1
77-
fi
65+
while [ -n "${1:-}" ]; do
66+
case "$1" in
67+
--help|-h|-?)
68+
print_usage
69+
exit 0
70+
;;
71+
--reset-tarball)
72+
rm -f "${autopkgtest_tarball_path}"
73+
shift
74+
;;
75+
*)
76+
1>&2 echo "Unrecognized argument: '$1'. Try 'run_autopkgtest --help' for usage info."
77+
exit 1
78+
;;
79+
esac
80+
done
7881

7982
## Dependency checks
8083
if ! [ -x '/usr/bin/unshare' ]; then

0 commit comments

Comments
 (0)