Skip to content

Commit

Permalink
CI: Fix Arch package build step
Browse files Browse the repository at this point in the history
Fixes #72.

- Create and use a 'builder' user instead of 'nobody'
- Add --privileged to 'docker run'

Restores some changes from b25d4de
  • Loading branch information
lah7 committed May 22, 2022
1 parent 9be248a commit f57e24e
Showing 1 changed file with 31 additions and 10 deletions.
41 changes: 31 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
build:
# Perform a generic build in case of any critical errors
name: Build
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
# Checks out under $GITHUB_WORKSPACE
- name: Checkout
Expand Down Expand Up @@ -80,6 +80,14 @@ jobs:
source PKGBUILD
echo "GTK_VERSION=${_gtkver}" >> $GITHUB_ENV
- name: Cache Pacman Packages
uses: actions/cache@v2
env:
cache-name: pacman-cache
with:
path: ~/pacman-cache
key: pacman-cache

- name: Cache GTK Source
uses: actions/cache@v2
id: gtksrc
Expand All @@ -92,20 +100,33 @@ jobs:
cp PKGBUILD PKGBUILD.before
md5sum PKGBUILD >> PKGBUILD.md5
- name: Validate Package
- name: Start Arch Linux
run: |
# makepkg cannot run as root
sudo chown -R nobody .
# Start Arch using Docker
docker run -d -t -v $GITHUB_WORKSPACE:/workspace --name archlinux archlinux:base-devel
# Start and update Arch Linux within a Docker container
docker run --privileged -d -t -v ~/pacman-cache/pkg:/var/cache/pacman/pkg -v $GITHUB_WORKSPACE:/workspace --name archlinux archlinux:base-devel
docker exec archlinux pacman -Sy --noconfirm namcap
# Add user
docker exec archlinux useradd builder
docker exec archlinux /bin/bash -c "echo 'builder ALL=(ALL:ALL) NOPASSWD:ALL' >> /etc/sudoers"
docker exec archlinux chown -R builder /workspace
# Enable 32-bit lib support
docker exec archlinux /bin/bash -c "echo -e '\n[multilib]\nInclude = /etc/pacman.d/mirrorlist' >> /etc/pacman.conf"
docker exec archlinux pacman -Syu --noconfirm
- name: Validate Package
run: |
# Validate the PKGBUILD is the same and free from errors
docker exec --workdir=/workspace --user nobody archlinux makepkg --geninteg
docker exec --workdir=/workspace --user nobody archlinux namcap -i PKGBUILD
docker exec --workdir=/workspace --user builder archlinux makepkg --geninteg
docker exec --workdir=/workspace --user builder archlinux namcap -i PKGBUILD
# Stop containers
- name: Build Arch Package
run: |
docker exec --workdir=/workspace --user builder archlinux makepkg -s --noconfirm
- name: Stop Arch Linux
run: |
docker stop archlinux -t 1
docker rm archlinux
Expand Down

0 comments on commit f57e24e

Please sign in to comment.