From ecef487b4e23e5e6efb49e731aac821ae57ae5f4 Mon Sep 17 00:00:00 2001 From: primeapple Date: Sun, 26 Nov 2023 21:50:32 +0100 Subject: [PATCH] Try Github actions for bootstrap test --- .github/Dockerfile | 13 +++++++++++++ .github/workflows/yadm-test.yml | 18 ++++++++++++++++++ .github/yadm-test.sh | 26 ++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .github/Dockerfile create mode 100644 .github/workflows/yadm-test.yml create mode 100755 .github/yadm-test.sh diff --git a/.github/Dockerfile b/.github/Dockerfile new file mode 100644 index 0000000..28c67cf --- /dev/null +++ b/.github/Dockerfile @@ -0,0 +1,13 @@ +FROM archlinux:base + +RUN pacman -Syu --noconfirm \ + && pacman -S --noconfirm fish yadm + +RUN useradd --create-home --shell /bin/bash primeapple + +WORKDIR /home/primeapple +COPY yadm-test.sh yadm-test.sh +RUN chmod +x yadm-test.sh && chown primeapple:primeapple yadm-test.sh + +USER primeapple +CMD ./yadm-test.sh diff --git a/.github/workflows/yadm-test.yml b/.github/workflows/yadm-test.yml new file mode 100644 index 0000000..868fede --- /dev/null +++ b/.github/workflows/yadm-test.yml @@ -0,0 +1,18 @@ +name: Yadm Test + +on: + push: + +jobs: + yadm-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Build Docker image + run: docker build -f .github/Dockerfile -t arch-yadm .github/ + + - name: Run yadm-test script + run: docker run --rm arch-yadm diff --git a/.github/yadm-test.sh b/.github/yadm-test.sh new file mode 100755 index 0000000..bdb5d1a --- /dev/null +++ b/.github/yadm-test.sh @@ -0,0 +1,26 @@ +echo "TEST: Cloning the dotfiles" +yadm clone --no-bootstrap https://github.com/primeapple/dotfiles + +pwd +echo ~ + +echo "TEST: Checking if required directories and files exist" +directories=("~/.config/nvim" "~/.config/fish") +files=("~/.profile" "~/.vimrc") + +for dir in "${directories[@]}"; do + if [ ! -d "$dir" ]; then + echo "Error: Directory $dir does not exist." + exit 1 + fi +done + +for file in "${files[@]}"; do + if [ ! -f "$file" ]; then + echo "Error: File $file does not exist." + exit 1 + fi +done + +echo "TEST: Executing bootstrap" +yadm bootstrap