-
Notifications
You must be signed in to change notification settings - Fork 58
99 lines (86 loc) · 3.6 KB
/
Copy pathci.yml
File metadata and controls
99 lines (86 loc) · 3.6 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
name: ci
on:
workflow_dispatch:
permissions:
contents: read
pull-requests: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
checks:
name: CI checks
# Fail closed without a cutoff. Re-runs cannot spend a second attempt.
if: ${{ github.run_attempt == 1 && github.run_number <= fromJSON(vars.MUTEKI_CI_LAST_RUN_NUMBER || '0') }}
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
id: checkout
# Keep detection and checks on one runner: every separate job rounds up
# to a billable minute, even when path detection takes only seconds.
- name: Detect relevant changes
if: ${{ github.event_name != 'workflow_dispatch' }}
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
id: filter
with:
# PRs use the full PR file list; pushes compare the entire pushed range.
base: ${{ github.event.before || github.event.repository.default_branch }}
filters: |
python:
- 'muteki/**'
- 'apps/**/*.py'
- 'scripts/**'
- 'apps/web/ui/lib/contracts/**'
- 'pyproject.toml'
- 'uv.lock'
- '.python-version'
- '.github/workflows/ci.yml'
- '.github/actions/**'
web:
- 'apps/web/ui/**'
- '.github/workflows/ci.yml'
- '.github/actions/**'
- name: Set up uv and Python
if: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.python == 'true' }}
uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1
with:
version: "0.12.5"
python-version: "3.13"
enable-cache: true
cache-dependency-glob: uv.lock
- name: Install locked Python dependencies
if: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.python == 'true' }}
run: uv sync --frozen
- name: Check generated API contracts
if: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.python == 'true' }}
run: |
uv run --frozen python scripts/gen_contracts_ts.py --check
uv run --frozen python scripts/gen_openapi.py --check
- name: Import product entry points
if: ${{ github.event_name == 'workflow_dispatch' || steps.filter.outputs.python == 'true' }}
run: uv run --frozen python -c 'import muteki.cli, apps.web.server'
# Keep reporting frontend failures when a Python check fails, while
# respecting cancellation and the frontend's own dependency chain.
- name: Set up Node.js
id: node
if: ${{ !cancelled() && steps.checkout.outcome == 'success' && (github.event_name == 'workflow_dispatch' || steps.filter.outputs.web == 'true') }}
uses: actions/setup-node@v7
with:
node-version: "20"
cache: npm
cache-dependency-path: apps/web/ui/package-lock.json
- name: Install locked UI dependencies
id: ui-deps
if: ${{ !cancelled() && steps.node.outcome == 'success' }}
working-directory: apps/web/ui
run: npm ci
- name: Check TypeScript
id: typecheck
if: ${{ !cancelled() && steps.ui-deps.outcome == 'success' }}
working-directory: apps/web/ui
run: ./node_modules/.bin/tsc --noEmit
- name: Build production UI
if: ${{ !cancelled() && steps.typecheck.outcome == 'success' }}
working-directory: apps/web/ui
run: npm run build