-
Notifications
You must be signed in to change notification settings - Fork 57
157 lines (134 loc) · 4.94 KB
/
ci.yml
File metadata and controls
157 lines (134 loc) · 4.94 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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: CI
on:
push:
branches: [main]
pull_request:
branches: [main]
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
jobs:
# ---------------------------------------------------------------------------
# Detect which areas of the codebase changed to skip unaffected jobs.
# On push to main, all jobs run unconditionally (safety net).
# ---------------------------------------------------------------------------
changes:
name: Detect Changes
runs-on: ubuntu-latest
timeout-minutes: 2
outputs:
typescript: ${{ steps.filter.outputs.typescript }}
python: ${{ steps.filter.outputs.python }}
lint: ${{ steps.filter.outputs.lint }}
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3
id: filter
with:
filters: |
typescript:
- 'packages/opencode/**'
- 'packages/plugin/**'
- 'packages/sdk/**'
- 'packages/util/**'
- 'packages/script/**'
- 'bun.lock'
- 'package.json'
- 'tsconfig.json'
python:
- 'packages/altimate-engine/**'
lint:
- 'packages/altimate-engine/src/**'
typescript:
name: TypeScript
needs: changes
if: needs.changes.outputs.typescript == 'true' || github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2
with:
bun-version: "1.3.10"
- name: Cache Bun dependencies
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
with:
path: ~/.bun/install/cache
key: bun-${{ runner.os }}-${{ hashFiles('bun.lock') }}
restore-keys: |
bun-${{ runner.os }}-
- name: Configure git for tests
run: |
git config --global user.name "CI"
git config --global user.email "ci@test.local"
- name: Install dependencies
run: bun install
- name: Run tests
run: bun test
working-directory: packages/opencode
marker-guard:
name: Marker Guard
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
timeout-minutes: 5
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
with:
fetch-depth: 0
- uses: oven-sh/setup-bun@ecf28ddc73e819eb6fa29df6b34ef8921c743461 # v2
with:
bun-version: "1.3.10"
- name: Add upstream remote
run: |
git remote add upstream https://github.com/anomalyco/opencode.git || true
git fetch upstream --quiet
- name: Install merge tooling deps
run: bun install
working-directory: script/upstream
- name: Check for missing altimate_change markers
run: |
# Skip strict marker enforcement for upstream merge PRs — all changes come from upstream
if [[ "${{ github.head_ref }}" == merge-upstream-* ]] || [[ "${{ github.head_ref }}" == upstream/merge-* ]]; then
echo "Upstream merge PR detected — running marker check in non-strict mode"
bun run script/upstream/analyze.ts --markers --base ${{ github.event.pull_request.base.ref }}
else
bun run script/upstream/analyze.ts --markers --base ${{ github.event.pull_request.base.ref }} --strict
fi
lint:
name: Lint
needs: changes
if: needs.changes.outputs.lint == 'true' || github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: "3.12"
- name: Install linter
run: pip install ruff==0.9.10
- name: Lint
run: ruff check src
working-directory: packages/altimate-engine
python:
name: Python ${{ matrix.python-version }}
needs: changes
if: needs.changes.outputs.python == 'true' || github.event_name == 'push'
runs-on: ubuntu-latest
timeout-minutes: 60
strategy:
matrix:
python-version: ["3.10", "3.11", "3.12"]
steps:
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
- uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache-dependency-path: packages/altimate-engine/pyproject.toml
- name: Install dependencies
run: pip install -e ".[dev,warehouses]"
working-directory: packages/altimate-engine
- name: Run tests
run: pytest
working-directory: packages/altimate-engine