Repository navigation
139 lines (125 loc) · 6.09 KB
/
Copy pathcpp_mcp_release.yml
File metadata and controls
139 lines (125 loc) · 6.09 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
name: cpp-mcp release
# Builds the standalone C++-only MCP server (cpp-mcp) as a self-contained AOT
# bundle per platform and, on a release, uploads each as a release asset.
#
# Triggers:
# * pull_request (only when the cpp-mcp surface changes) — builds + smoke-tests
# on linux only, NO upload. Catches breakage at PR time (the cpp-mcp target
# is OFF in the normal build matrix, so nothing else compiles it).
# * workflow_dispatch — full matrix build + smoke, NO upload. Manual validation.
# * release: prereleased — full matrix, uploads cpp-mcp-<os>-<arch>.<ext>
# alongside the daslang SDK bundles. A dasllama-v* tag is dasllama's own
# release and cuts no cpp-mcp.
#
# The build is intentionally lean: cpp_main.das requires only daslib + builtin
# modules, so every external module (dasHV/OpenSSL, GLFW, Audio, ...) is disabled
# — no vcpkg/openssl/apt module deps, and a ~360-step build instead of 2000+.
on:
push:
branches: [master]
paths:
- 'utils/mcp/**'
- 'utils/common/**'
- 'ci/make_cpp_mcp_bundle.sh'
- 'ci/smoke_test_cpp_mcp.sh'
- '.github/workflows/cpp_mcp_release.yml'
- 'CMakeLists.txt'
pull_request:
paths:
- 'utils/mcp/**'
- 'utils/common/**'
- 'ci/make_cpp_mcp_bundle.sh'
- 'ci/smoke_test_cpp_mcp.sh'
- '.github/workflows/cpp_mcp_release.yml'
- 'CMakeLists.txt'
workflow_dispatch:
release:
types: [prereleased]
defaults:
run:
shell: bash
jobs:
build:
if: github.event_name != 'release' || !startsWith(github.event.release.tag_name, 'dasllama-')
runs-on: ${{ matrix.runner }}
timeout-minutes: 45
# contents: write for the release upload; actions: write for `gh cache delete` in the sccache refresh step.
permissions:
contents: write
actions: write
strategy:
fail-fast: false
# Vary the matrix by event: a PR builds only linux (a cheap, cross-platform-
# agnostic gate); dispatch/release build all four. The selection lives here
# because the `matrix` context is NOT available in a job-level `if` (only
# github/needs/vars/inputs are), whereas `github` IS available in strategy.
matrix:
include: ${{ fromJSON( (github.event_name == 'pull_request' || github.event_name == 'push') && '[{"name":"linux-x86_64","runner":"ubuntu-latest","asset":"cpp-mcp-linux-x86_64","ext":"tar.gz"}]' || '[{"name":"linux-x86_64","runner":"ubuntu-latest","asset":"cpp-mcp-linux-x86_64","ext":"tar.gz"},{"name":"linux-arm64","runner":"ubuntu-24.04-arm","asset":"cpp-mcp-linux-arm64","ext":"tar.gz"},{"name":"darwin-arm64","runner":"macos-14","asset":"cpp-mcp-darwin-arm64","ext":"tar.gz"},{"name":"windows-x64","runner":"windows-latest","asset":"cpp-mcp-windows-x64","ext":"zip"}]' ) }}
steps:
- name: SCM Checkout
uses: actions/checkout@v4
- name: Install CMake and Ninja
uses: lukka/get-cmake@latest
- name: Set up MSVC environment (Windows)
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64
# One sccache slot per cell, seeded by the master push. A release builds clean; the Windows
# cell runs on dispatch and release only, so no master push would seed its slot.
- uses: ./.github/actions/sccache-slot
if: github.event_name != 'release' && runner.os != 'Windows'
with:
mode: restore
key: sccache-cpp-mcp-${{ matrix.name }}-Release
sccache-size: 500M
- name: Configure + build cpp-mcp
run: |
set -eux
# cpp_main.das needs no external module -> disable them all (no OpenSSL,
# no GLFW/X11 deps) and skip tests/tutorials/aot-examples + flex/bison
# (the committed parser is used).
MODULES_OFF="-DDAS_HV_DISABLED=ON -DDAS_LLVM_DISABLED=ON -DDAS_AUDIO_DISABLED=ON"
MODULES_OFF="$MODULES_OFF -DDAS_GLFW_DISABLED=ON -DDAS_PUGIXML_DISABLED=ON -DDAS_SQLITE_DISABLED=ON"
MODULES_OFF="$MODULES_OFF -DDAS_STBIMAGE_DISABLED=ON -DDAS_STDDLG_DISABLED=ON -DDAS_CLANG_BIND_DISABLED=ON"
MODULES_OFF="$MODULES_OFF -DDAS_TREE_SITTER_DISABLED=ON"
LEAN="-DDAS_TESTS_DISABLED=ON -DDAS_TUTORIAL_DISABLED=ON -DDAS_AOT_EXAMPLES_DISABLED=ON -DDAS_FLEX_BISON_DISABLED=ON"
if [[ "${{ runner.os }}" == "Linux" ]]; then
# Match release.yml: clang avoids GCC's -Wchanges-meaning on
# AOT-generated structs being treated as an error.
export CC=clang CXX=clang++
fi
cmake --no-warn-unused-cli -B build -G Ninja \
-DCMAKE_BUILD_TYPE=Release -DDAS_BUILD_CPP_MCP=ON $MODULES_OFF $LEAN
cmake --build build --target cpp-mcp --parallel
- name: Assemble and smoke-test bundle
run: cmake --build build --target check_cpp_mcp_bundle --parallel
- uses: ./.github/actions/sccache-slot
if: github.event_name != 'release' && runner.os != 'Windows'
with:
mode: save
key: sccache-cpp-mcp-${{ matrix.name }}-Release
- name: Package (zip)
if: runner.os == 'Windows'
run: |
mkdir -p artifacts
# Package from inside dist/ so the zip root is `cpp-mcp/` (matching the
# tarball's `-C dist cpp-mcp`), not `dist/cpp-mcp/`.
cd dist && 7z a "../artifacts/${{ matrix.asset }}.zip" cpp-mcp
- name: Package (tar.gz)
if: runner.os != 'Windows'
run: |
mkdir -p artifacts
tar -czf "artifacts/${{ matrix.asset }}.${{ matrix.ext }}" -C dist cpp-mcp
- name: Upload workflow artifact (dispatch / PR inspection)
if: github.event_name != 'release'
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset }}
path: artifacts/${{ matrix.asset }}.${{ matrix.ext }}
if-no-files-found: error
- name: Upload release asset
if: github.event_name == 'release' && github.event.action == 'prereleased'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "${{ github.event.release.tag_name }}" "artifacts/${{ matrix.asset }}.${{ matrix.ext }}" --clobber