diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml new file mode 100644 index 0000000..ea73335 --- /dev/null +++ b/.github/workflows/pr-test.yml @@ -0,0 +1,30 @@ +name: PR Test + +on: + pull_request: + branches: + - master + - main + +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