Skip to content

Commit

Permalink
Build on latest ubuntu and archlinux as well
Browse files Browse the repository at this point in the history
  • Loading branch information
rootmos committed Nov 15, 2023
1 parent 874b206 commit 7bd4776
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
19 changes: 17 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,28 @@ on:

jobs:
build:
strategy:
matrix:
image: [ "ubuntu:latest", "ubuntu:22.04", "archlinux:latest" ]
continue-on-error: true
runs-on: ubuntu-latest
container:
image: ${{ matrix.image }}
steps:
- name: Check out repository code
- name: Checkout prepare script
uses: actions/checkout@v4
with:
sparse-checkout: prepare.sh
sparse-checkout-cone-mode: false

- name: Prepare build environment
run: ./prepare.sh -us | tee -a "$GITHUB_ENV"
run: ./prepare.sh -u | tee -a "$GITHUB_ENV"

- name: Check out repository code
uses: actions/checkout@v4

- name: Correct ownership of repository
run: chown -R $(id -u):$(id -g) .

- name: Build
run: make build
Expand Down
31 changes: 24 additions & 7 deletions prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,38 @@ done
shift $((OPTIND-1))

if [ -z "$DISTRO" ]; then
DISTRO=$(lsb_release -is)
if command -v lsb_release; then
DISTRO=$(lsb_release -is)
elif command -v pacman >/dev/null; then
DISTRO="Arch"
elif command -v apt-get >/dev/null; then
# TODO: debian
DISTRO="Ubuntu"
else
echo "unable to figure out distribution: $DISTRO" 1>&2
exit 1
fi
fi
echo "distro: $DISTRO" 1>&2

if [ "$DISTRO" = "Arch" ]; then
if [ "$DISTRO" = "Arch" ] || command -v pacman >/dev/null; then
if [ -n "$UPDATE" ]; then
$SUDO pacman -Sy
$SUDO pacman -Sy 1>&2
fi
$SUDO pacman -S lua libxrandr
elif [ "$DISTRO" = "Ubuntu" ]; then
$SUDO pacman -S --noconfirm 1>&2 \
git \
make gcc pkgconf \
python gawk \
lua libxrandr
elif [ "$DISTRO" = "Ubuntu" ] || command -v apt-get >/dev/null; then
if [ -n "$UPDATE" ]; then
$SUDO apt-get update 1>&2
fi
$SUDO apt-get install --yes --no-install-recommends 1>&2 \
make \
$SUDO apt-get install --yes 1>&2 \
--no-install-recommends --no-install-suggests \
git ca-certificates \
make gcc pkg-config \
python3 gawk \
liblua5.4-dev libxrandr-dev
echo "LUA_PKG=lua54"
else
Expand Down

0 comments on commit 7bd4776

Please sign in to comment.