File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77 branches : [main, master]
88
99jobs :
10- test-ubuntu :
10+ test :
1111 runs-on : ubuntu-latest
12+ strategy :
13+ matrix :
14+ distro : [ubuntu, arch]
1215 steps :
1316 - name : Checkout
1417 uses : actions/checkout@v4
1518
16- - name : Build and test on Ubuntu 24.04
19+ - name : Build and test on ${{ matrix.distro }}
1720 run : |
1821 docker build \
19- --file test/Dockerfile.ubuntu \
20- --tag dotfiles-test:ubuntu \
22+ --file test/Dockerfile.${{ matrix.distro }} \
23+ --tag dotfiles-test:${{ matrix.distro }} \
2124 .
22- docker run --rm dotfiles-test:ubuntu
25+ docker run --rm dotfiles-test:${{ matrix.distro }}
Original file line number Diff line number Diff line change @@ -50,11 +50,11 @@ if command -v batcat >/dev/null 2>&1 && ! command -v bat >/dev/null 2>&1; then
5050 sudo ln -sf " $(command -v batcat)" /usr/local/bin/bat
5151fi
5252
53- # Set fish as default shell
53+ {{ end -}}
54+ # Set fish as default shell (applies to all distros)
5455if [ " $(getent passwd " $ (whoami)" | cut -d: -f7)" != " $(which fish)" ]; then
5556 sudo chsh -s " $(which fish)" " $(whoami)"
5657fi
5758
58- {{ end -}}
5959echo " Portable CLI tools installed"
6060{{ end -}}
Original file line number Diff line number Diff line change 1+ FROM archlinux:latest
2+
3+ # Update system and install base dependencies
4+ RUN pacman -Syu --noconfirm && \
5+ pacman -S --noconfirm --needed \
6+ base-devel \
7+ curl \
8+ git \
9+ sudo \
10+ && pacman -Scc --noconfirm
11+
12+ # Create test user with sudo access
13+ RUN useradd -m -s /bin/bash testuser && \
14+ echo "testuser ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/testuser
15+
16+ # Switch to test user
17+ USER testuser
18+ WORKDIR /home/testuser
19+
20+ # Copy dotfiles into container
21+ COPY --chown=testuser:testuser . /home/testuser/.local/share/chezmoi
22+
23+ # Run install script
24+ RUN cd /home/testuser/.local/share/chezmoi && ./install.sh
25+
26+ # Default command runs the test script
27+ CMD ["/home/testuser/.local/share/chezmoi/test/verify.sh"]
Original file line number Diff line number Diff line change @@ -7,15 +7,42 @@ REPO_DIR="$(dirname "$SCRIPT_DIR")"
77
88cd " $REPO_DIR "
99
10- echo " === Building Ubuntu test image ==="
11- docker build \
12- --file test/Dockerfile.ubuntu \
13- --tag dotfiles-test:ubuntu \
14- .
10+ # Parse arguments
11+ DISTROS=" ${1:- all} "
1512
16- echo " "
17- echo " === Running tests ==="
18- docker run --rm dotfiles-test:ubuntu
13+ run_test () {
14+ local distro=" $1 "
15+ echo " "
16+ echo " ========================================"
17+ echo " Testing on: $distro "
18+ echo " ========================================"
19+ echo " "
20+
21+ echo " ==> Building $distro test image..."
22+ docker build \
23+ --file " test/Dockerfile.$distro " \
24+ --tag " dotfiles-test:$distro " \
25+ .
26+
27+ echo " "
28+ echo " ==> Running tests on $distro ..."
29+ docker run --rm " dotfiles-test:$distro "
30+ }
31+
32+ if [ " $DISTROS " = " all" ]; then
33+ run_test " ubuntu"
34+ run_test " arch"
35+ elif [ " $DISTROS " = " ubuntu" ] || [ " $DISTROS " = " arch" ]; then
36+ run_test " $DISTROS "
37+ else
38+ echo " Usage: $0 [all|ubuntu|arch]"
39+ echo " all - Test on both Ubuntu and Arch (default)"
40+ echo " ubuntu - Test on Ubuntu only"
41+ echo " arch - Test on Arch only"
42+ exit 1
43+ fi
1944
2045echo " "
21- echo " === Tests completed ==="
46+ echo " ========================================"
47+ echo " All tests completed successfully!"
48+ echo " ========================================"
You can’t perform that action at this time.
0 commit comments