Skip to content

Commit 23ad2b1

Browse files
author
Kuba Pospieszny
committed
Adding CI pipeline
1 parent 85d15df commit 23ad2b1

3 files changed

Lines changed: 206 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 198 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,198 @@
1+
name: CI Pipeline
2+
3+
on:
4+
push:
5+
branches: [ main, develop, feature/* ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test-scripts:
11+
name: Test Shell Scripts
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v4
17+
18+
- name: Install ShellCheck
19+
run: |
20+
echo "INFO ==>: Installing ShellCheck..."
21+
sudo apt-get update
22+
sudo apt-get install -y shellcheck
23+
24+
- name: Run ShellCheck on all scripts
25+
run: |
26+
echo "INFO ==>: Checking shell scripts syntax..."
27+
find . -type f -name "*.sh" -not -path "./.*" | while read -r script; do
28+
echo "INFO ==>: Checking $script"
29+
shellcheck "$script" || exit 1
30+
done
31+
echo "INFO ==>: All scripts passed ShellCheck!"
32+
33+
test-documentation:
34+
name: Test Markdown Documentation
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout code
39+
uses: actions/checkout@v4
40+
41+
- name: Setup Node.js
42+
uses: actions/setup-node@v4
43+
with:
44+
node-version: '20'
45+
46+
- name: Install markdownlint
47+
run: |
48+
echo "INFO ==>: Installing markdownlint..."
49+
npm install -g markdownlint-cli
50+
51+
- name: Run markdownlint
52+
run: |
53+
echo "INFO ==>: Checking markdown files..."
54+
markdownlint '**/*.md' --ignore node_modules --config .markdownlint.json || true
55+
echo "INFO ==>: Markdown check completed!"
56+
57+
test-on-macos:
58+
name: Test Installation on macOS
59+
runs-on: macos-latest
60+
61+
steps:
62+
- name: Checkout code
63+
uses: actions/checkout@v4
64+
65+
- name: Check Homebrew
66+
run: |
67+
echo "INFO ==>: Checking Homebrew installation..."
68+
brew --version
69+
echo "INFO ==>: Homebrew is working!"
70+
71+
- name: Validate Brewfile
72+
run: |
73+
echo "INFO ==>: Validating Brewfile syntax..."
74+
brew bundle check --file=Brewfile --verbose || echo "Some packages not installed (expected in CI)"
75+
echo "INFO ==>: Brewfile syntax is valid!"
76+
77+
- name: Check script permissions
78+
run: |
79+
echo "INFO ==>: Checking if scripts are executable..."
80+
for script in install.sh scripts/*.sh; do
81+
if [ -f "$script" ]; then
82+
echo "Checking $script"
83+
if [ ! -x "$script" ]; then
84+
echo "ERROR: $script is not executable"
85+
exit 1
86+
fi
87+
fi
88+
done
89+
echo "INFO ==>: All scripts have correct permissions!"
90+
91+
- name: Dry-run install script
92+
run: |
93+
echo "INFO ==>: Testing install.sh (dry-run)..."
94+
bash -n install.sh
95+
echo "INFO ==>: install.sh syntax is valid!"
96+
97+
- name: Test all scripts syntax
98+
run: |
99+
echo "INFO ==>: Testing all scripts syntax..."
100+
for script in scripts/*.sh; do
101+
if [ -f "$script" ]; then
102+
echo "Testing $script"
103+
bash -n "$script"
104+
fi
105+
done
106+
echo "INFO ==>: All scripts have valid syntax!"
107+
108+
test-project-structure:
109+
name: Validate Project Structure
110+
runs-on: ubuntu-latest
111+
112+
steps:
113+
- name: Checkout code
114+
uses: actions/checkout@v4
115+
116+
- name: Check required files
117+
run: |
118+
echo "INFO ==>: Checking project structure..."
119+
120+
required_files=(
121+
"README.md"
122+
"LICENSE"
123+
"Brewfile"
124+
"install.sh"
125+
"scripts/brew.sh"
126+
"scripts/cli-tools.sh"
127+
"scripts/kubernetes.sh"
128+
"scripts/cloud-tools.sh"
129+
"scripts/desktop-apps.sh"
130+
"scripts/symlink-dotfiles.sh"
131+
"scripts/macos-preferences.sh"
132+
"scripts/oh-my-zsh.sh"
133+
"dotfiles/.zshrc"
134+
"configs/gitconfig-template"
135+
"configs/k9s-aliases.yaml"
136+
"docs/index.html"
137+
"docs/banner.svg"
138+
)
139+
140+
all_found=true
141+
for file in "${required_files[@]}"; do
142+
if [ ! -f "$file" ]; then
143+
echo "ERROR: Missing required file: $file"
144+
all_found=false
145+
else
146+
echo "✓ Found: $file"
147+
fi
148+
done
149+
150+
if [ "$all_found" = true ]; then
151+
echo "INFO ==>: All required files present!"
152+
else
153+
echo "ERROR: Some required files are missing!"
154+
exit 1
155+
fi
156+
157+
- name: Check coding style
158+
run: |
159+
echo "INFO ==>: Checking if scripts follow coding style..."
160+
161+
scripts_ok=true
162+
for script in scripts/*.sh install.sh; do
163+
if [ -f "$script" ]; then
164+
if ! grep -q "INFO ==>:" "$script"; then
165+
echo "WARNING: $script might not follow 'INFO ==>:' style"
166+
scripts_ok=false
167+
else
168+
echo "✓ $script follows coding style"
169+
fi
170+
fi
171+
done
172+
173+
if [ "$scripts_ok" = true ]; then
174+
echo "INFO ==>: All scripts follow coding style!"
175+
else
176+
echo "WARNING: Some scripts might need style updates"
177+
fi
178+
179+
summary:
180+
name: Build Summary
181+
runs-on: ubuntu-latest
182+
needs: [test-scripts, test-documentation, test-on-macos, test-project-structure]
183+
184+
steps:
185+
- name: Success message
186+
run: |
187+
echo "╔════════════════════════════════════════╗"
188+
echo "║ ║"
189+
echo "║ ✅ All CI checks passed! ║"
190+
echo "║ ║"
191+
echo "║ - Shell scripts validated ✓ ║"
192+
echo "║ - Documentation checked ✓ ║"
193+
echo "║ - macOS compatibility tested ✓ ║"
194+
echo "║ - Project structure verified ✓ ║"
195+
echo "║ ║"
196+
echo "║ Ready to merge! 🚀 ║"
197+
echo "║ ║"
198+
echo "╔════════════════════════════════════════╗"

.markdownlint.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"default": true,
3+
"MD013": false,
4+
"MD033": false,
5+
"MD034": false,
6+
"MD041": false
7+
}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
[![Stargazers][stars-shield]][stars-url]
1212
[![Issues][issues-shield]][issues-url]
1313
[![MIT License][license-shield]][license-url]
14+
[![CI Pipeline](https://github.com/Kobeep/devops-macos-workstation/actions/workflows/ci.yml/badge.svg)](https://github.com/Kobeep/devops-macos-workstation/actions/workflows/ci.yml)
1415

1516
![macOS](https://img.shields.io/badge/macOS-11.0+-blue?logo=apple&logoColor=white)
1617
![Homebrew](https://img.shields.io/badge/Homebrew-required-orange?logo=homebrew&logoColor=white)

0 commit comments

Comments
 (0)