Skip to content

Commit 72c1c4d

Browse files
committed
ci: add standard GitHub Actions smoke workflow
1 parent 777fc6a commit 72c1c4d

1 file changed

Lines changed: 89 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
jobs:
9+
smoke:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Python
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
21+
- name: Set up Node
22+
uses: actions/setup-node@v4
23+
with:
24+
node-version: "20"
25+
26+
- name: Repo smoke checks
27+
shell: bash
28+
run: |
29+
set -euo pipefail
30+
31+
echo "Validating repository structure and basic runnable signals"
32+
33+
has_signal=0
34+
35+
if find . -maxdepth 4 -type f -name "package.json" | grep -q .; then
36+
has_signal=1
37+
while IFS= read -r pkg; do
38+
[ -z "$pkg" ] && continue
39+
node -e "const fs=require('fs'); JSON.parse(fs.readFileSync(process.argv[1],'utf8'));" "$pkg"
40+
done < <(find . -maxdepth 4 -type f -name "package.json")
41+
fi
42+
43+
if find . -maxdepth 4 -type f \( -name "pyproject.toml" -o -name "requirements.txt" -o -name "setup.py" -o -name "manage.py" \) | grep -q .; then
44+
has_signal=1
45+
fi
46+
47+
if find . -maxdepth 4 -type f \( -name "app.py" -o -name "main.py" -o -name "wsgi.py" -o -name "asgi.py" \) | grep -q .; then
48+
has_signal=1
49+
fi
50+
51+
if find . -maxdepth 4 -type f \( -name "pom.xml" -o -name "build.gradle" -o -name "build.gradle.kts" -o -name "gradlew" \) | grep -q .; then
52+
has_signal=1
53+
fi
54+
55+
if find . -maxdepth 4 -type f -name "go.mod" | grep -q .; then
56+
has_signal=1
57+
fi
58+
59+
if find . -maxdepth 4 -type f -name "Cargo.toml" | grep -q .; then
60+
has_signal=1
61+
fi
62+
63+
if find . -maxdepth 4 -type f \( -name "*.csproj" -o -name "*.sln" \) | grep -q .; then
64+
has_signal=1
65+
fi
66+
67+
if find . -maxdepth 4 -type f \( -name "Dockerfile" -o -name "docker-compose.yml" -o -name "docker-compose.yaml" \) | grep -q .; then
68+
has_signal=1
69+
fi
70+
71+
if find . -maxdepth 4 -type f -name "Makefile" | grep -q .; then
72+
has_signal=1
73+
fi
74+
75+
if [ "$has_signal" -ne 1 ]; then
76+
echo "No runnable/build signals found in repository"
77+
exit 1
78+
fi
79+
80+
echo "Running Python syntax smoke check"
81+
python_files="$(find . -type f -name '*.py' -not -path './.git/*' 2>/dev/null || true)"
82+
if [ -n "$python_files" ]; then
83+
while IFS= read -r f; do
84+
[ -z "$f" ] && continue
85+
python -m py_compile "$f"
86+
done <<< "$python_files"
87+
fi
88+
89+
echo "Smoke checks passed"

0 commit comments

Comments
 (0)