-
Notifications
You must be signed in to change notification settings - Fork 1
142 lines (134 loc) · 4.26 KB
/
Copy pathci.yml
File metadata and controls
142 lines (134 loc) · 4.26 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
name: CI
on:
pull_request:
push:
branches: [main]
permissions:
contents: read
pull-requests: read
packages: read
jobs:
wait-for-ci-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Detect CI image changes
id: deps
uses: dorny/paths-filter@v3
with:
filters: |
ci_image:
- 'Dockerfile.ci'
- 'pyproject.toml'
- 'uv.lock'
- 'uv.lock.*'
- 'ci/**'
- name: Wait for CI image to be available
if: steps.deps.outputs.ci_image == 'true'
env:
# On push to main, ci-image.yml runs concurrently so we poll.
# On PRs, no new image is built; just verify the existing image is present.
MAX_ATTEMPTS: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && '30' || '1' }}
run: |
set -euo pipefail
image="ghcr.io/thehapyone/code-interpreter-ci:latest"
for i in $(seq 1 "$MAX_ATTEMPTS"); do
if docker manifest inspect "$image" >/dev/null 2>&1; then
echo "CI image is available."
exit 0
fi
echo "Waiting for CI image... ($i/$MAX_ATTEMPTS)"
[[ $i -lt $MAX_ATTEMPTS ]] && sleep 10
done
echo "CI image not available after waiting."
exit 1
lint:
runs-on: ubuntu-latest
container:
image: ghcr.io/thehapyone/code-interpreter-ci:latest
needs: wait-for-ci-image
if: needs.wait-for-ci-image.result == 'success' || needs.wait-for-ci-image.result == 'skipped'
steps:
- uses: actions/checkout@v4
- name: Sync dependencies (if needed)
uses: ./.github/actions/sync-deps
- name: Ruff lint
run: make lint
openapi-check:
runs-on: ubuntu-latest
container:
image: ghcr.io/thehapyone/code-interpreter-ci:latest
needs: wait-for-ci-image
if: needs.wait-for-ci-image.result == 'success' || needs.wait-for-ci-image.result == 'skipped'
steps:
- uses: actions/checkout@v4
- name: Sync dependencies (if needed)
uses: ./.github/actions/sync-deps
- name: OpenAPI check
run: make openapi-check
typecheck:
runs-on: ubuntu-latest
container:
image: ghcr.io/thehapyone/code-interpreter-ci:latest
needs: wait-for-ci-image
if: needs.wait-for-ci-image.result == 'success' || needs.wait-for-ci-image.result == 'skipped'
steps:
- uses: actions/checkout@v4
- name: Sync dependencies (if needed)
uses: ./.github/actions/sync-deps
- name: Mypy
run: make typecheck
unit:
runs-on: ubuntu-latest
container:
image: ghcr.io/thehapyone/code-interpreter-ci:latest
needs: wait-for-ci-image
if: needs.wait-for-ci-image.result == 'success' || needs.wait-for-ci-image.result == 'skipped'
env:
PYTHONPATH: ${{ github.workspace }}
steps:
- uses: actions/checkout@v4
- name: Sync dependencies (if needed)
uses: ./.github/actions/sync-deps
- name: Unit tests
run: make coverage
- name: Upload coverage
uses: actions/upload-artifact@v4
with:
name: coverage
path: reports/coverage.xml
- name: Upload junit
uses: actions/upload-artifact@v4
with:
name: junit
path: reports/junit.xml
e2e:
runs-on: ubuntu-latest
container:
image: ghcr.io/thehapyone/code-interpreter-ci:latest
needs: wait-for-ci-image
if: needs.wait-for-ci-image.result == 'success' || needs.wait-for-ci-image.result == 'skipped'
env:
PYTHONPATH: ${{ github.workspace }}
API_KEY: dev-demo-key
PORT: "8000"
steps:
- uses: actions/checkout@v4
- name: Sync dependencies (if needed)
uses: ./.github/actions/sync-deps
- name: E2E smoke tests
run: make e2e
- name: Upload e2e artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: e2e-artifacts
path: |
reports/e2e-server.log
e2e/runs/