From 56b0da78d89d2c87d5090156c8bc6c6c26326f56 Mon Sep 17 00:00:00 2001 From: Rasmus Wejlgaard Date: Fri, 5 Sep 2025 10:55:03 +0000 Subject: [PATCH 1/2] add pr-check to verify things work on all distros --- .github/workflows/pr-test.yml | 33 ++++++++++++++++++++++++++ install-scripts/01-install-packages.sh | 10 +++++--- tests/Dockerfile-alpine | 9 +++++++ tests/Dockerfile-archlinux | 10 ++++++++ tests/Dockerfile-fedora | 10 ++++++++ tests/Dockerfile-ubuntu | 9 +++++++ 6 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/pr-test.yml create mode 100644 tests/Dockerfile-alpine create mode 100644 tests/Dockerfile-archlinux create mode 100644 tests/Dockerfile-fedora create mode 100644 tests/Dockerfile-ubuntu diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml new file mode 100644 index 0000000..46adb7a --- /dev/null +++ b/.github/workflows/pr-test.yml @@ -0,0 +1,33 @@ +name: PR Test + +on: + pull_request: + branches: + - master + - main + push: + branches: + - pr-checks + +jobs: + test: + strategy: + matrix: + distro: + - alpine + - archlinux + - fedora + - ubuntu + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Only build + run: | + docker buildx build --platform linux/amd64 --output "type=image,push=false" -f tests/Dockerfile-${{ matrix.distro }} . \ No newline at end of file diff --git a/install-scripts/01-install-packages.sh b/install-scripts/01-install-packages.sh index 089767e..16dc633 100755 --- a/install-scripts/01-install-packages.sh +++ b/install-scripts/01-install-packages.sh @@ -9,9 +9,7 @@ PACKAGES=( "curl" "bat" "go" - "npm" "ripgrep" - "exa" ) # if MacOS install Homebrew @@ -26,7 +24,7 @@ fi # if Arch install if [ -f /etc/arch-release ]; then # install yay - if [ -z $(which yay) ]; then + if [ -z "$(which yay)" ] && [ "$EUID" -ne 0 ]; then sudo pacman -S --noconfirm base-devel git clone https://aur.archlinux.org/yay.git cd yay @@ -61,3 +59,9 @@ if [ "$(uname)" == "FreeBSD" ]; then # install packages sudo pkg install -y "${PACKAGES[@]}" fi + +# if RHEL/CentOS/Fedora install +if [ -f /etc/redhat-release ]; then + # install packages + sudo dnf install -y "${PACKAGES[@]}" +fi diff --git a/tests/Dockerfile-alpine b/tests/Dockerfile-alpine new file mode 100644 index 0000000..321d742 --- /dev/null +++ b/tests/Dockerfile-alpine @@ -0,0 +1,9 @@ +FROM alpine:latest + +COPY . /workspace + +WORKDIR /workspace + +RUN apk add make shadow bash sudo + +RUN make \ No newline at end of file diff --git a/tests/Dockerfile-archlinux b/tests/Dockerfile-archlinux new file mode 100644 index 0000000..d752835 --- /dev/null +++ b/tests/Dockerfile-archlinux @@ -0,0 +1,10 @@ +FROM archlinux:latest + +COPY ../. /workspace + +WORKDIR /workspace + +RUN pacman -Syy +RUN pacman -S --noconfirm make sudo git which + +RUN make \ No newline at end of file diff --git a/tests/Dockerfile-fedora b/tests/Dockerfile-fedora new file mode 100644 index 0000000..cdbfafe --- /dev/null +++ b/tests/Dockerfile-fedora @@ -0,0 +1,10 @@ +FROM fedora:latest + +COPY ../. /workspace + +WORKDIR /workspace + +RUN dnf -y update +RUN dnf -y install make sudo + +RUN make \ No newline at end of file diff --git a/tests/Dockerfile-ubuntu b/tests/Dockerfile-ubuntu new file mode 100644 index 0000000..75c5885 --- /dev/null +++ b/tests/Dockerfile-ubuntu @@ -0,0 +1,9 @@ +FROM ubuntu:latest + +COPY ../. /workspace + +WORKDIR /workspace + +RUN apt install --update -y make sudo + +RUN make \ No newline at end of file From 67fe0e03e180022a8d8b53ec39ca70f401c1577a Mon Sep 17 00:00:00 2001 From: Rasmus Wejlgaard Date: Fri, 5 Sep 2025 10:59:52 +0000 Subject: [PATCH 2/2] remove on push to this branch --- .github/workflows/pr-test.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml index 46adb7a..ea73335 100644 --- a/.github/workflows/pr-test.yml +++ b/.github/workflows/pr-test.yml @@ -5,9 +5,6 @@ on: branches: - master - main - push: - branches: - - pr-checks jobs: test: