-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (183 loc) · 6.38 KB
/
Copy pathci.yml
File metadata and controls
199 lines (183 loc) · 6.38 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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
name: ci
on:
push:
branches: [main]
pull_request:
branches: ["*"]
release:
types: [published]
workflow_dispatch:
permissions:
contents: read
security-events: write
packages: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: build (${{ matrix.os_short }}, ${{ matrix.build_type == 'Release' && 'release' || 'debug' }})
runs-on: ${{ matrix.os }}
if: github.repository_owner == 'bniladridas'
strategy:
matrix:
include:
- os: ubuntu-latest
os_short: ubuntu
build_type: release
- os: ubuntu-latest
os_short: ubuntu
build_type: debug
- os: macos-latest
os_short: macos
build_type: release
- os: macos-latest
os_short: macos
build_type: debug
- os: windows-latest
os_short: windows
build_type: release
steps:
- uses: actions/checkout@v6
- name: cache
uses: actions/cache@v5
with:
path: |
build
~/.cache/vcpkg
C:\vcpkg\installed
key: ${{ runner.os }}-${{ matrix.build_type }}-${{ hashFiles('CMakeLists.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.build_type }}-
- name: setup
shell: bash
run: |
if [[ "$RUNNER_OS" == "Linux" ]]; then
sudo apt update
sudo apt install -y gh nlohmann-json3-dev cmake build-essential \
libcurl4-openssl-dev libpqxx-dev expect clang-tidy
elif [[ "$RUNNER_OS" == "macOS" ]]; then
export HOMEBREW_NO_REQUIRE_TAP_TRUST=1
brew update
brew install gh cmake nlohmann-json cpr libpqxx expect llvm
else
powershell -Command "
Set-ExecutionPolicy Bypass -Scope Process -Force;
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex;
choco install -y cmake gh --no-progress;
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg;
C:\vcpkg\bootstrap-vcpkg.bat -disableMetrics;
C:\vcpkg\vcpkg.exe integrate install;
C:\vcpkg\vcpkg.exe install cpr nlohmann-json libpqxx --triplet x64-windows
"
fi
- name: build
shell: bash
run: |
if [[ "$RUNNER_OS" == "Windows" ]]; then
cmake -S . -B build \
-DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
else
FLAGS=""
[[ "$RUNNER_OS" == "macOS" ]] && FLAGS="-DCMAKE_PREFIX_PATH=/opt/homebrew"
cmake -S . -B build -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} $FLAGS
fi
cmake --build build --config ${{ matrix.build_type }}
- name: test
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "=== Unit Tests ==="
ctest --test-dir build --output-on-failure -C ${{ matrix.build_type }}
echo "=== Summary ==="
echo "Unit tests passed"
- name: scenario tests
if: runner.os != 'Windows'
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
echo "=== Scenario Tests ==="
cmake --build build --target check-scenarios --config ${{ matrix.build_type }}
echo "=== Summary ==="
echo "Scenarios passed"
- uses: actions/upload-artifact@v6
with:
name: cursor-${{ matrix.os }}-${{ matrix.build_type }}
path: |
build/bin/cursor-agent*
build/bin/Release/cursor-agent.exe
coverage:
runs-on: ubuntu-latest
needs: build
if: github.event_name != 'release'
steps:
- uses: actions/checkout@v6
- run: |
sudo apt update
sudo apt install -y nlohmann-json3-dev cmake build-essential libcurl4-openssl-dev libpqxx-dev lcov
cmake -S . -B build -DCMAKE_BUILD_TYPE=Debug
cmake --build build --target cursor-agent
chmod +x build/bin/cursor-agent || true
cmake --build build --target coverage
- uses: codecov/codecov-action@v7
with:
files: build/coverage/coverage.info
flags: unittests
name: codecov
fail_ci_if_error: false
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: |
sudo apt update
sudo apt install -y clang-tidy cmake build-essential \
libcurl4-openssl-dev nlohmann-json3-dev libpqxx-dev
cmake -S . -B build -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
echo "Running basic syntax check..."
clang-tidy --list-checks > /dev/null && echo "✅ Clang-tidy available"
echo "✅ Lint check completed (detailed linting handled by pre-commit hooks)"
e2e:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- run: docker compose -f tests/e2e/docker-compose.yml --project-directory . up --abort-on-container-exit --exit-code-from e2e-tests
- if: failure()
uses: actions/upload-artifact@v6
with:
name: e2e-logs
path: tests/e2e/e2e_test.log
docker:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main' || github.event_name == 'release'
continue-on-error: true
steps:
- uses: actions/checkout@v6
- uses: docker/setup-buildx-action@v4
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ github.repository }}
tags: |
type=ref,event=branch
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
- uses: docker/build-push-action@v7
with:
context: .
file: ./.github/packaging/docker/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max