Clean up PKGBUILD dependencies #327
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build and test | |
on: | |
push: | |
schedule: | |
- cron: "0 0 7 * *" | |
jobs: | |
ubuntu: | |
runs-on: ubuntu-22.04 | |
container: | |
image: ubuntu:22.04 | |
env: | |
ARCH: ubuntu2204 | |
UNPRIVILEGED: ubuntu | |
TEST_OUTPUT_DIR: /tmp/tests | |
WORKDIR: /tmp/workdir | |
steps: | |
- name: Install minimal dependencies | |
run: | | |
apt-get update | |
apt-get install -y --no-install-recommends git sudo gettext-base ca-certificates | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Create an unprivileged user | |
run: | | |
useradd -m $UNPRIVILEGED | |
chown -R $UNPRIVILEGED:$UNPRIVILEGED . | |
echo "$UNPRIVILEGED ALL = NOPASSWD: $(which apt-get)" | tee -a /etc/sudoers | |
- name: Build package | |
run: sudo -u $UNPRIVILEGED --preserve-env=WORKDIR env SUDO=sudo build/ubuntu/mk | |
- name: Archive source package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: source-package.${{github.sha}}.${{env.ARCH}} | |
retention-days: 7 | |
path: build/ubuntu/out/*.tar | |
- name: Install package | |
run: apt-get install -y ./build/ubuntu/out/*.deb | |
- name: Test system installation | |
run: | | |
export TOOLS=$(readlink -f "$WORKDIR"/*/tools) | |
run() { | |
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS \ | |
env SUT=$(which $1) SHOW_IDS=1 \ | |
tools/test-harness -c $1 | |
} | |
run hlua | |
run hpython | |
run hnode | |
run hsh | |
- name: Archive test results | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: tests.${{github.sha}}.${{env.ARCH}} | |
retention-days: 7 | |
path: "${{env.TEST_OUTPUT_DIR}}/*-tests-*.tar.gz" | |
archlinux: | |
runs-on: ubuntu-22.04 | |
container: | |
image: archlinux:latest | |
env: | |
ARCH: archlinux | |
UNPRIVILEGED: arch | |
TEST_OUTPUT_DIR: /tmp/tests | |
steps: | |
- name: Install minimal dependencies | |
run: pacman -Suy --noconfirm sudo fakeroot binutils which wget git diffutils | |
- name: Check out repository code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Mark repository workspace as a safe.directory | |
run: git config --global --add safe.directory $(pwd) | |
- name: Create an unprivileged user | |
run: | | |
useradd -m $UNPRIVILEGED | |
chown -R $UNPRIVILEGED:$UNPRIVILEGED . | |
tee -a /etc/sudoers.d/$UNPRIVILEGED <<< "$UNPRIVILEGED ALL = NOPASSWD: $(which pacman)" | |
- name: Generate nodejs-shared's PKGBUILD | |
id: nodejs_shared_pkgbuild | |
run: | | |
PKG=$(build/archlinux/nodejs-shared/PKGBUILD.gen) | |
echo "pkg=$PKG" >> "$GITHUB_OUTPUT" | |
- name: Archive nodejs-shared's PKGBUILD | |
uses: actions/upload-artifact@v4 | |
with: | |
name: nodejs-shared.PKGBUILD | |
retention-days: 7 | |
path: "build/archlinux/nodejs-shared/PKGBUILD.shared" | |
- name: Restore nodejs-shared package | |
id: nodejs_shared_cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: build/archlinux/nodejs-shared/${{ steps.nodejs_shared_pkgbuild.outputs.pkg }} | |
key: ${{ steps.nodejs_shared_pkgbuild.outputs.pkg }} | |
- name: Build nodejs-shared | |
if: steps.nodejs_shared_cache.outputs.cache-hit != 'true' | |
run: sudo -u $UNPRIVILEGED build/archlinux/nodejs-shared/build | |
- name: Cache nodejs-shared package | |
if: steps.nodejs_shared_cache.outputs.cache-hit != 'true' | |
uses: actions/cache/save@v4 | |
with: | |
path: build/archlinux/nodejs-shared/${{ steps.nodejs_shared_pkgbuild.outputs.pkg }} | |
key: ${{ steps.nodejs_shared_pkgbuild.outputs.pkg }} | |
- name: Install nodejs-shared | |
run: pacman -U --noconfirm build/archlinux/nodejs-shared/${{ steps.nodejs_shared_pkgbuild.outputs.pkg }} | |
- name: Create PKGBUILD | |
run: sudo -u $UNPRIVILEGED build/archlinux/mk | |
- name: Archive PKGBUILD | |
uses: actions/upload-artifact@v4 | |
with: | |
name: PKGBUILD.${{github.sha}} | |
retention-days: 7 | |
path: "build/archlinux/PKGBUILD" | |
- name: Build package | |
run: sudo -u $UNPRIVILEGED makepkg -si --noconfirm | |
working-directory: build/archlinux | |
- name: Test system installation | |
run: | | |
export TOOLS=$(readlink -f build/archlinux/src/*/tools) | |
run() { | |
sudo -u $UNPRIVILEGED --preserve-env=TEST_OUTPUT_DIR,TOOLS \ | |
env SUT=$(which $1) SHOW_IDS=1 \ | |
tools/test-harness -c $1 | |
} | |
run hlua | |
run hpython | |
run hnode | |
run hsh | |
- name: Archive test results | |
uses: actions/upload-artifact@v4 | |
if: success() || failure() | |
with: | |
name: tests.${{github.sha}}.${{env.ARCH}} | |
retention-days: 7 | |
path: "${{env.TEST_OUTPUT_DIR}}/*-tests-*.tar.gz" |