-
Notifications
You must be signed in to change notification settings - Fork 2
108 lines (101 loc) · 3.49 KB
/
Copy pathci.yml
File metadata and controls
108 lines (101 loc) · 3.49 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
name: CI
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
# --frozen fails when pyproject.toml and uv.lock disagree, so a dependency
# change that skipped the lock cannot merge.
- name: Install dependencies
run: uv sync --extra dev --frozen
- name: Ruff
run: uv run ruff check openops_mcp tests
requirements:
# requirements.txt is generated, and two things read it: Snyk, which only scans
# that format, and the App image, which pip-installs it. Regenerating here proves
# it still matches the lockfile rather than trusting whoever last changed a
# dependency to have remembered.
name: Requirements Export
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
# The same command that generated the committed file, so the header uv writes
# into it matches and only a real dependency change shows up.
- name: Re-export and compare
run: |
uv export --format requirements-txt --no-dev --no-emit-project --frozen \
-o requirements.txt
git diff --exit-code -- requirements.txt
types:
name: Types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
- uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
- name: Install dependencies
run: uv sync --extra dev --frozen
- name: Mypy
run: uv run mypy openops_mcp
test:
# The floor and the ceiling of requires-python. The floor is the one that
# breaks, since development happens on a newer interpreter.
name: Test (Python ${{ matrix.python-version }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.10', '3.13']
steps:
- uses: actions/checkout@v7.0.1
- uses: astral-sh/setup-uv@v10.0.1
with:
enable-cache: true
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: uv sync --extra dev --frozen
- name: Pytest
run: uv run pytest -q
image:
# Build-only, so a Dockerfile that no longer builds on either architecture cannot
# merge, rather than failing at publish time. Skipped on pushes to main: there the
# Publish workflow builds the same image for real, and running both would waste two
# builds and race it for the shared cache scopes.
name: Image (${{ matrix.platform }})
if: github.event_name != 'push'
runs-on: ${{ matrix.platform == 'amd64' && 'ubuntu-latest' || 'ubuntu-arm64' }}
strategy:
fail-fast: false
matrix:
platform: [amd64, arm64]
steps:
- uses: actions/checkout@v7.0.1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4.3.0
- name: Build image
uses: docker/build-push-action@v7.3.0
with:
context: .
file: ./Dockerfile
platforms: linux/${{ matrix.platform }}
build-args: VERSION=${{ github.sha }}
push: false
provenance: false
cache-from: type=gha,scope=${{ matrix.platform }}
cache-to: type=gha,mode=max,scope=${{ matrix.platform }}