Skip to content

Commit 5c9657f

Browse files
feat: migrate generate pipeline to markdown model and OpenAI HTTP stack (#5)
1 parent 0ffe433 commit 5c9657f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+13392
-5016
lines changed

.clice/cache/clore/extract/cache.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.
Lines changed: 35 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
1-
name: generate-docs
1+
name: Generate Docs
22

33
on:
44
push:
55
branches: ["main"]
6-
workflow_dispatch:
76

87
jobs:
98
generate:
10-
runs-on: windows-latest
9+
runs-on: macos-latest
1110
permissions:
12-
contents: write
11+
contents: read
1312

1413
steps:
1514
- name: Checkout clore
@@ -21,67 +20,53 @@ jobs:
2120
pixi-version: v0.67.0
2221
activate-environment: true
2322
cache: true
24-
locked: true
2523

26-
- name: Restore compiler cache
27-
uses: actions/cache@v5
24+
- name: Restore build cache
25+
id: restore-build-cache
26+
uses: actions/cache/restore@v4
2827
with:
29-
path: .cache/sccache
30-
key: Windows-sccache-${{ github.sha }}
28+
path: build/Debug/
29+
key: ${{ runner.os }}-debug-build-${{ hashFiles('pixi.lock', 'pixi.toml', '**/CMakeLists.txt', 'cmake/**/*.cmake') }}
3130
restore-keys: |
32-
Windows-sccache-
33-
34-
- name: Restore configure artifacts cache
35-
id: restore-configure-cache
36-
uses: actions/cache/restore@v5
37-
with:
38-
path: |
39-
build/RelWithDebInfo/.llvm
40-
build/RelWithDebInfo/include
41-
build/RelWithDebInfo/_deps
42-
build/RelWithDebInfo/*.tar.*
43-
key: >-
44-
Windows-configure-RelWithDebInfo-${{
45-
hashFiles('pixi.lock', 'pixi.toml', '**/CMakeLists.txt', 'cmake/**/*.cmake')
46-
}}-${{ github.sha }}
47-
restore-keys: |
48-
Windows-configure-RelWithDebInfo-${{ hashFiles('pixi.lock', 'pixi.toml', '**/CMakeLists.txt', 'cmake/**/*.cmake') }}-
49-
50-
- name: Start sccache
51-
run: sccache --start-server
31+
${{ runner.os }}-debug-build-
5232
5333
- name: Configure
54-
run: pixi run cmake-config
55-
56-
- name: Save configure artifacts cache
57-
if: success()
58-
uses: actions/cache/save@v5
59-
with:
60-
path: |
61-
build/RelWithDebInfo/.llvm
62-
build/RelWithDebInfo/include
63-
build/RelWithDebInfo/_deps
64-
build/RelWithDebInfo/*.tar.*
65-
key: ${{ steps.restore-configure-cache.outputs.cache-primary-key }}
34+
run: pixi run cmake-config Debug
6635

6736
- name: Build
68-
run: pixi run cmake-build
37+
run: pixi run cmake-build Debug
38+
39+
- name: Save build cache
40+
if: ${{ success() && steps.restore-build-cache.outputs.cache-hit != 'true' }}
41+
uses: actions/cache/save@v4
42+
with:
43+
path: build/Debug/
44+
key: ${{ steps.restore-build-cache.outputs.cache-primary-key }}
6945

7046
- name: Generate documentation
47+
timeout-minutes: 10
48+
env:
49+
OPENAI_BASE_URL: ${{ secrets.OPENAI_BASE_URL }}
50+
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
7151
run: |
72-
./build/RelWithDebInfo/bin/clore `
73-
--compile-commands build/RelWithDebInfo/compile_commands.json `
74-
--source-dir src `
75-
--output-dir generated `
76-
--log-level info `
77-
--dry-run
52+
if [[ -z "${OPENAI_API_KEY}" || -z "${OPENAI_BASE_URL}" ]]; then
53+
echo "OPENAI_API_KEY and OPENAI_BASE_URL must be set to generate documentation." >&2
54+
exit 1
55+
fi
56+
57+
./build/Debug/bin/clore \
58+
--compile-commands build/Debug/compile_commands.json \
59+
--source-dir src \
60+
--output-dir generated \
61+
--log-level info \
62+
--model deepseek-chat
7863
7964
- name: Package documentation
80-
run: Compress-Archive -Path generated/* -DestinationPath clore-docs.zip
65+
run: tar -czvf clore-docs.tar.gz generated
8166

8267
- name: Upload documentation artifact
8368
uses: actions/upload-artifact@v7
8469
with:
8570
name: clore-docs
86-
path: clore-docs.zip
71+
path: clore-docs.tar.gz
8772
retention-days: 30

.github/workflows/verify-build.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
8+
jobs:
9+
build:
10+
strategy:
11+
matrix:
12+
os: ["windows-latest", "ubuntu-latest", "macos-latest"]
13+
runs-on: "${{ matrix.os }}"
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v6
17+
18+
- name: Setup pixi
19+
uses: prefix-dev/setup-pixi@v0.9.4
20+
with:
21+
pixi-version: v0.67.0
22+
activate-environment: true
23+
cache: true
24+
25+
- name: Restore build directory cache
26+
id: restore-build-cache
27+
uses: actions/cache/restore@v5
28+
with:
29+
path: build/Debug/
30+
key: ${{ runner.os }}-debug-build-${{ hashFiles('pixi.lock', 'pixi.toml', '**/CMakeLists.txt', 'cmake/**/*.cmake') }}
31+
restore-keys: |
32+
${{ runner.os }}-debug-build-
33+
34+
- name: Configure
35+
run: pixi run cmake-config Debug
36+
37+
- name: Save build directory cache
38+
if: steps.restore-build-cache.outputs.cache-hit != 'true'
39+
uses: actions/cache/save@v5
40+
with:
41+
path: build/Debug/
42+
key: ${{ steps.restore-build-cache.outputs.cache-primary-key }}
43+
44+
- name: Build
45+
run: pixi run cmake-build Debug

.prettierrc.yaml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# .prettierrc.yaml
2+
3+
printWidth: 100
4+
tabWidth: 4
5+
useTabs: false
6+
semi: true
7+
singleQuote: false
8+
jsxSingleQuote: false
9+
quoteProps: "as-needed"
10+
trailingComma: "all"
11+
bracketSpacing: true
12+
arrowParens: "always"
13+
endOfLine: "lf"
14+
15+
overrides:
16+
- files: "**/*.md"
17+
options:
18+
proseWrap: "preserve"
19+
tabWidth: 2
20+
21+
- files: ["**/*.json", "**/*.yaml", "**/*.yml", ".clang-format", ".clang-tidy"]
22+
options:
23+
tabWidth: 2

CMakeLists.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,14 @@ option(CLORE_ENABLE_LTO "Enable ThinLTO for all targets" ON)
1717
option(CLORE_OFFLINE_BUILD "Disable network downloads during configuration" OFF)
1818
option(CLORE_ENABLE_TEST "Build unit tests" ON)
1919

20+
if(WIN32 AND (MSVC OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND
21+
(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC" OR
22+
CMAKE_CXX_COMPILER_LINKER_FRONTEND_VARIANT STREQUAL "MSVC"))))
23+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL" CACHE STRING
24+
"Use the release CRT to stay ABI-compatible with the bundled Windows LLVM artifacts."
25+
FORCE)
26+
endif()
27+
2028
# Global flags that apply to all targets (including FetchContent dependencies).
2129
if(NOT MSVC)
2230
add_compile_options(-ffunction-sections -fdata-sections)

0 commit comments

Comments
 (0)