Update continuous_integration.yml #7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Dotfiles CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
jobs: | |
test: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04, ubuntu-latest] | |
include: | |
# Include Kali Linux using container | |
- os: ubuntu-latest | |
container: kalilinux/kali-rolling | |
name: kali-latest | |
# Include Gentoo using container | |
- os: ubuntu-latest | |
container: gentoo/stage3 | |
name: gentoo-latest | |
runs-on: ${{ matrix.os }} | |
container: ${{ matrix.container }} | |
steps: | |
- uses: actions/checkout@v4 | |
# Kali-specific setup | |
- name: Setup Kali | |
if: matrix.container == 'kalilinux/kali-rolling' | |
run: | | |
apt-get update | |
apt-get install -y sudo git curl make gcc | |
# Gentoo-specific setup | |
- name: Setup Gentoo | |
if: matrix.container == 'gentoo/stage3' | |
run: | | |
# Configure news reading to avoid warnings | |
mkdir -p /etc/portage/profile | |
echo "news_pkg_install_unread = ignore" >> /etc/portage/make.conf | |
# Update portage and sync repository | |
emerge-webrsync | |
# Update system tools first | |
emerge --quiet-build=y sys-apps/portage | |
# Install required packages with correct Gentoo names | |
emerge --quiet-build=y \ | |
dev-vcs/git \ | |
app-shells/bash \ | |
sys-devel/make \ | |
sys-devel/gcc \ | |
net-misc/curl \ | |
app-misc/tmux | |
# Create necessary directories | |
mkdir -p /var/db/repos/gentoo | |
# Common setup for Ubuntu | |
- name: Install system dependencies (Ubuntu) | |
if: "!matrix.container" | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y \ | |
tmux \ | |
curl \ | |
git \ | |
make \ | |
gcc | |
- name: Install Bats | |
run: | | |
git clone https://github.com/bats-core/bats-core.git | |
cd bats-core | |
sudo ./install.sh /usr/local | |
cd .. | |
# Install Bats support libraries | |
git clone https://github.com/bats-core/bats-support.git test/test_helper/bats-support | |
git clone https://github.com/bats-core/bats-assert.git test/test_helper/bats-assert | |
- name: Install fzf | |
run: | | |
git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf | |
~/.fzf/install --all | |
- name: Install TPM (Tmux Plugin Manager) | |
run: | | |
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm | |
- name: Install cht.sh | |
run: | | |
mkdir -p ~/.local/bin | |
curl https://cht.sh/:cht.sh > ~/.local/bin/cht.sh | |
chmod +x ~/.local/bin/cht.sh | |
- name: Download tmux completion | |
run: | | |
mkdir -p ~/.dotfiles | |
curl -o ~/.dotfiles/tmux.completion.bash \ | |
"https://raw.githubusercontent.com/Bash-it/bash-it/master/completion/available/tmux.completion.bash" | |
- name: Install fzf-git | |
run: | | |
git clone --depth 1 https://github.com/junegunn/fzf-git.sh ~/.fzf-git | |
- name: Verify file structure | |
run: | | |
ls -la ~/.fzf | |
ls -la ~/.tmux/plugins/tpm | |
ls -la ~/.local/bin/cht.sh | |
ls -la ~/.dotfiles/tmux.completion.bash | |
ls -la ~/.fzf-git | |
- name: Run Bats tests | |
run: | | |
# Create test directories if they don't exist | |
mkdir -p test/test_helper | |
# Load bats helpers in test files | |
echo 'load "test_helper/bats-support/load"' > test/test_helper.bash | |
echo 'load "test_helper/bats-assert/load"' >> test/test_helper.bash | |
# Run tests | |
bats test/ | |
- name: Run installation script | |
run: | | |
# Non-interactive mode for CI | |
export CI=true | |
./setup.sh all | |
- name: Verify dotfile symlinks | |
run: | | |
test -L ~/.bashrc | |
test -L ~/.bash_functions | |
test -L ~/.bash_aliases | |
test -L ~/.inputrc | |
test -L ~/.tmux.conf | |
test -L ~/.fzf.bash | |
test -L ~/.curlrc | |
- name: Test installed commands | |
run: | | |
tmux -V | |
~/.fzf/bin/fzf --version | |
~/.local/bin/cht.sh --help | |
#source ~/.fzf.bash && declare -F | grep -q fzf | |
- name: Check dotfile contents | |
run: | | |
for file in ~/.bashrc ~/.bash_aliases ~/.inputrc ~/.tmux.conf ~/.fzf.bash ~/.curlrc; do | |
echo "Checking $file..." | |
readlink -f "$file" | |
test -f "$(readlink -f "$file")" | |
done |