Skip to content

Commit a3448d1

Browse files
committed
🔧 Enhance CI/CD workflow with improved structure and features
Update CI/CD pipeline with improved organization and new capabilities - Add emojis to job names for better visual identification - Improve step naming for clarity and readability - Add documentation build and deployment to GitHub Pages - Add test results artifact upload for better debugging - Refine Docker image publishing with better metadata - Update GHCR image tags to use full repository path - Add revision metadata to Docker images
1 parent 6d57faa commit a3448d1

File tree

1 file changed

+113
-40
lines changed

1 file changed

+113
-40
lines changed

.github/workflows/ci-cd.yml

Lines changed: 113 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1,186 @@
1-
name: DroidMind CI/CD
1+
name: DroidMind CI/CD 🌌
22

33
on:
44
push:
55
branches: [main]
66
tags:
7-
- "v*" # Push events to matching v*, i.e. v1.0, v20.15.10
7+
- "v*"
88
pull_request:
99
branches: [main]
10-
workflow_dispatch: # Allow manual triggering
10+
workflow_dispatch:
1111

1212
jobs:
13-
build-and-test:
13+
build-and-test: # 🏗️ Build, Lint & Test 🧪
14+
name: 🏗️ Build, Lint & Test 🧪
1415
runs-on: ubuntu-latest
1516
steps:
16-
- uses: actions/checkout@v4
17+
- name: 🛰️ Checkout Repository
18+
uses: actions/checkout@v4
1719
with:
18-
fetch-depth: 0
20+
fetch-depth: 0 # Needed for `softprops/action-gh-release` to generate release notes
1921

20-
- name: 💿 Set up Python
22+
- name: 🐍 Set up Python Environment
2123
uses: actions/setup-python@v5
2224
with:
2325
python-version: "3.13"
2426
cache-dependency-path: "pyproject.toml"
2527

26-
- name: 🛠️ Set up uv
28+
- name: ⚡ Install uv Build System
2729
uses: astral-sh/setup-uv@v6
2830

29-
- name: 📦 Install dependencies
30-
run: uv sync
31+
- name: 📦 Install Project Dependencies
32+
run: uv sync --all-groups
3133

32-
- name: 🔍 Ruff lint check
33-
uses: astral-sh/ruff-action@v3
34-
with:
35-
version: latest
34+
- name: 💅 Run DroidMind Lint Script
35+
run: uv run python scripts/lint.py
3636

37-
- name: 🧪 Run tests
37+
- name: 🧪 Execute Pytest Suite
3838
run: uv run pytest
3939

40-
- name: 🐳 Set up QEMU
40+
- name: 📄 Upload Test Results Artifact
41+
if: always()
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: test-results-${{ github.sha }}
45+
path: test-results/ # Adjust if your pytest output path is different
46+
47+
- name: 🐧 Set up QEMU (for multi-platform builds)
4148
uses: docker/setup-qemu-action@v3
4249

43-
- name: 🏗️ Set up Docker Buildx
50+
- name: 🛠️ Set up Docker Buildx Engine
4451
uses: docker/setup-buildx-action@v3
4552

46-
- name: 🛠️ Build Docker image
53+
- name: 🐳 Build Docker Image (no push)
4754
uses: docker/build-push-action@v6
4855
with:
4956
context: .
5057
file: ./Dockerfile
51-
push: false # Only build, don't push
58+
push: false
5259
tags: droidmind:latest,droidmind:${{ github.sha }}
5360

54-
create-release:
61+
build-docs: # 📚 Build Documentation Site 🌐
62+
name: 📚 Build Documentation Site 🌐
5563
needs: [build-and-test]
5664
runs-on: ubuntu-latest
65+
steps:
66+
- name: 🛰️ Checkout Repository
67+
uses: actions/checkout@v4
68+
69+
- name: 🐍 Set up Python Environment
70+
uses: actions/setup-python@v5
71+
with:
72+
python-version: "3.13"
73+
cache-dependency-path: "pyproject.toml"
74+
75+
- name: ⚡ Install uv Build System
76+
uses: astral-sh/setup-uv@v6
77+
78+
- name: 📖 Install Documentation Dependencies
79+
run: uv sync --all-groups
80+
81+
- name: 🏗️ Build MkDocs Site
82+
run: uv run mkdocs build --config-file mkdocs.yml
83+
84+
- name: 📤 Upload Documentation Artifact
85+
uses: actions/upload-artifact@v4
86+
with:
87+
name: site-${{ github.sha }}
88+
path: site
89+
90+
deploy-docs: # 🚀 Deploy Documentation to GitHub Pages 📄
91+
name: 🚀 Deploy Documentation to GitHub Pages 📄
92+
needs: [build-docs]
93+
runs-on: ubuntu-latest
94+
if: startsWith(github.ref, 'refs/tags/')
95+
permissions:
96+
contents: write
97+
steps:
98+
- name: 🛰️ Checkout Repository
99+
uses: actions/checkout@v4
100+
101+
- name: 📥 Download Built Documentation Artifact
102+
uses: actions/download-artifact@v4
103+
with:
104+
name: site-${{ github.sha }}
105+
path: site
106+
107+
- name: 🌐 Publish to GitHub Pages
108+
uses: peaceiris/actions-gh-pages@v4
109+
with:
110+
github_token: ${{ secrets.GITHUB_TOKEN }}
111+
publish_dir: ./site
112+
113+
create-release: # 🎉 Create GitHub Release ✨
114+
name: 🎉 Create GitHub Release ✨
115+
needs: [build-and-test, deploy-docs]
116+
runs-on: ubuntu-latest
57117
if: startsWith(github.ref, 'refs/tags/')
58118
permissions:
59119
contents: write
60120
steps:
61-
- uses: actions/checkout@v4
121+
- name: 🛰️ Checkout Repository (full history)
122+
uses: actions/checkout@v4
123+
with:
124+
fetch-depth: 0 # Full history for release notes generation
62125

63-
- name: 🏷️ Create Release
126+
- name: 🏷️ Generate GitHub Release Notes
64127
uses: softprops/action-gh-release@v2
65128
with:
66129
name: Release ${{ github.ref_name }}
67130
generate_release_notes: true
131+
# files: | # Optional: attach files like .whl or .tar.gz to the release
132+
# dist/*.whl
133+
# dist/*.tar.gz
68134

69-
publish:
135+
publish-pypi: # 🐍 Publish Python Package to PyPI 📦
136+
name: 🐍 Publish Python Package to PyPI 📦
70137
needs: create-release
71138
runs-on: ubuntu-latest
72139
if: startsWith(github.ref, 'refs/tags/')
73140
permissions:
74-
id-token: write # For trusted publishing
141+
id-token: write # For trusted PyPI publishing
75142
steps:
76-
- uses: actions/checkout@v4
143+
- name: 🛰️ Checkout Repository
144+
uses: actions/checkout@v4
77145

78-
- name: 💿 Set up Python
146+
- name: 🐍 Set up Python Environment
79147
uses: actions/setup-python@v5
80148
with:
81149
python-version: "3.13"
150+
# cache-dependency-path will still cache dependencies installed by uv
82151

83-
- name: 🛠️ Set up uv
152+
- name: ⚡ Install uv Build System
84153
uses: astral-sh/setup-uv@v6
85154

86-
- name: 📦 Build package
155+
- name: 🛠️ Build Python Package
87156
run: |
88157
uv pip install build
89158
uv run python -m build
90159
91-
- name: 🚀 Publish to PyPI
160+
- name: 🚀 Publish to PyPI via Trusted Publisher
92161
uses: pypa/gh-action-pypi-publish@release/v1
93162

94-
publish-docker:
163+
publish-docker: # 🐳 Publish Docker Image to Registries 🚢
164+
name: 🐳 Publish Docker Image to Registries 🚢
95165
needs: create-release
96166
runs-on: ubuntu-latest
97167
if: startsWith(github.ref, 'refs/tags/')
98168
permissions:
99169
contents: read
100-
packages: write # For GitHub Container Registry
170+
packages: write
171+
id-token: write # If using OIDC for Docker Hub
101172
steps:
102-
- uses: actions/checkout@v4
173+
- name: 🛰️ Checkout Repository
174+
uses: actions/checkout@v4
103175

104-
- name: 📝 Extract version from tag
176+
- name: 🔖 Extract Version from Git Tag
105177
id: get_version
106178
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
107179

108-
- name: 🐳 Set up QEMU
180+
- name: 🐧 Set up QEMU (for multi-platform builds)
109181
uses: docker/setup-qemu-action@v3
110182

111-
- name: 🏗️ Set up Docker Buildx
183+
- name: 🛠️ Set up Docker Buildx Engine
112184
uses: docker/setup-buildx-action@v3
113185

114186
- name: 🔑 Login to Docker Hub
@@ -117,14 +189,14 @@ jobs:
117189
username: ${{ secrets.DOCKERHUB_USERNAME }}
118190
password: ${{ secrets.DOCKERHUB_TOKEN }}
119191

120-
- name: 🔑 Login to GitHub Container Registry
192+
- name: 🔐 Login to GitHub Container Registry (GHCR)
121193
uses: docker/login-action@v3
122194
with:
123195
registry: ghcr.io
124196
username: ${{ github.repository_owner }}
125197
password: ${{ secrets.GITHUB_TOKEN }}
126198

127-
- name: 🚀 Build and push Docker images
199+
- name: 🚀 Build & Push Docker Images to Registries
128200
uses: docker/build-push-action@v6
129201
with:
130202
context: .
@@ -134,11 +206,12 @@ jobs:
134206
tags: |
135207
hyperbliss/droidmind:latest
136208
hyperbliss/droidmind:${{ steps.get_version.outputs.VERSION }}
137-
ghcr.io/${{ github.repository_owner }}/droidmind:latest
138-
ghcr.io/${{ github.repository_owner }}/droidmind:${{ steps.get_version.outputs.VERSION }}
209+
ghcr.io/${{ github.repository }}:latest
210+
ghcr.io/${{ github.repository }}:${{ steps.get_version.outputs.VERSION }}
139211
labels: |
140212
org.opencontainers.image.title=DroidMind
141213
org.opencontainers.image.description=Control Android devices with AI through the Model Context Protocol
142214
org.opencontainers.image.source=${{ github.server_url }}/${{ github.repository }}
143215
org.opencontainers.image.version=${{ steps.get_version.outputs.VERSION }}
144-
org.opencontainers.image.created=${{ github.event.repository.pushed_at }}
216+
org.opencontainers.image.created=${{ github.event.repository.updated_at }}
217+
org.opencontainers.image.revision=${{ github.sha }}

0 commit comments

Comments
 (0)