-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (100 loc) Β· 3.36 KB
/
Copy pathci.yml
File metadata and controls
106 lines (100 loc) Β· 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
name: CI
on:
push:
branches: [main]
pull_request:
permissions:
contents: read
jobs:
python:
name: Python β lint & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install tooling
run: pip install ruff pytest
- name: Ruff lint
run: ruff check .
- name: Install runtime deps
run: pip install -r requirements.txt
- name: Pytest (unit)
run: |
if git ls-files '*test_*.py' '*_test.py' 'tests/**/*.py' | grep -qv '^tests/e2e/'; then
pytest -q --ignore=tests/e2e
else
echo "No Python unit tests yet β skipping."
fi
e2e:
name: E2E β smoke (headless UI)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.12"
- name: Install deps + browser
run: |
pip install -r requirements.txt
pip install pytest playwright
python -m playwright install --with-deps chromium
- name: Start the app (model-less β smoke tests don't need trained models)
working-directory: training
run: |
nohup python -m uvicorn app:app --host 127.0.0.1 --port 8010 > /tmp/flavor-app.log 2>&1 &
for i in $(seq 1 40); do
curl -sf http://127.0.0.1:8010/api/studio_terms >/dev/null && { echo "app up"; break; }
sleep 1
done
- name: Smoke e2e
env:
FLAVORMANCER_URL: http://127.0.0.1:8010
run: pytest tests/e2e -q -m smoke
- name: App log on failure
if: failure()
run: tail -50 /tmp/flavor-app.log || true
dotnet:
name: .NET β build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "8.0.x"
- name: Build & test
run: |
target=$(git ls-files '*.sln' | head -1)
[ -z "$target" ] && target=$(git ls-files '*.csproj' | head -1)
if [ -n "$target" ]; then
echo "Building $target"
dotnet build "$target" --configuration Release
if git ls-files '*Test*.csproj' | grep -q .; then
dotnet test --configuration Release
else
echo "No .NET test projects yet β build only."
fi
else
echo "No .NET projects yet β skipping."
fi
dco:
name: DCO β commit sign-off
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify every commit carries a Signed-off-by
run: |
base='${{ github.event.pull_request.base.sha }}'
head='${{ github.event.pull_request.head.sha }}'
fail=0
for c in $(git rev-list --no-merges "$base".."$head"); do
if ! git show -s --format=%B "$c" | grep -qiE '^Signed-off-by: .+ <.+@.+>'; then
echo "::error::commit ${c:0:8} has no 'Signed-off-by' line β sign off (DCO + CLA): git commit -s --amend (or: git rebase --signoff $base)"
fail=1
fi
done
if [ "$fail" = 0 ]; then echo "All commits signed off β"; else exit 1; fi