@@ -33,38 +33,10 @@ jobs:
3333 env :
3434 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3535
36- check-ci-status :
37- needs : check-open-prs
38- if : needs.check-open-prs.outputs.has_open_prs == 'false'
39- runs-on : ubuntu-latest
40- outputs :
41- ci_passed : ${{ steps.check.outputs.ci_passed }}
42- steps :
43- - name : Checkout code
44- uses : actions/checkout@v4
4536
46- - name : Check if CI has already passed
47- id : check
48- run : |
49- # Get the commit SHA
50- COMMIT_SHA="${{ github.sha }}"
51- echo "Checking CI status for commit: $COMMIT_SHA"
52-
53- # Check if there's a successful CI run for this commit
54- CI_STATUS=$(gh api repos/${{ github.repository }}/commits/$COMMIT_SHA/status --jq '.statuses[] | select(.context == "CI") | .state' 2>/dev/null || echo "unknown")
55-
56- if [ "$CI_STATUS" = "success" ]; then
57- echo "ci_passed=true" >> $GITHUB_OUTPUT
58- echo "✅ CI has already passed for this commit. Skipping build-and-test."
59- else
60- echo "ci_passed=false" >> $GITHUB_OUTPUT
61- echo "⚠️ CI has not passed yet or status unknown. Running build-and-test."
62- fi
63- env :
64- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
6537
6638 validate-version :
67- needs : [check-open-prs, check-ci-status ]
39+ needs : [check-open-prs]
6840 if : needs.check-open-prs.outputs.has_open_prs == 'false'
6941 runs-on : ubuntu-latest
7042 outputs :
@@ -135,113 +107,8 @@ jobs:
135107 fi
136108 echo "✅ Changelog validation passed: version $VERSION found in CHANGELOG.md"
137109
138- build-and-test :
139- needs : [check-open-prs, check-ci-status, validate-version]
140- if : needs.check-open-prs.outputs.has_open_prs == 'false' && needs.check-ci-status.outputs.ci_passed == 'false'
141- strategy :
142- matrix :
143- os : [ubuntu-latest, windows-latest]
144- build_type : [Release]
145- include :
146- - os : ubuntu-latest
147- cmake_args : " -DLLMCPP_BUILD_TESTS=ON -DLLMCPP_BUILD_EXAMPLES=ON"
148- - os : windows-latest
149- cmake_args : " -DLLMCPP_BUILD_TESTS=ON -DLLMCPP_BUILD_EXAMPLES=ON"
150-
151- runs-on : ${{ matrix.os }}
152- timeout-minutes : 30 # Add timeout to prevent runaway builds
153-
154- steps :
155- - name : Checkout code
156- uses : actions/checkout@v4
157-
158- # Improved caching for release builds
159- - name : Cache CMake build
160- uses : actions/cache@v4
161- with :
162- path : |
163- build
164- !build/tests/llmcpp_tests
165- !build/examples
166- key : release-cmake-${{ matrix.os }}-${{ matrix.build_type }}-${{ hashFiles('CMakeLists.txt', '**/CMakeLists.txt', 'src/**/*', 'include/**/*') }}
167- restore-keys : |
168- release-cmake-${{ matrix.os }}-${{ matrix.build_type }}-
169-
170- # Cache vcpkg packages (Windows)
171- - name : Cache vcpkg packages
172- if : matrix.os == 'windows-latest'
173- uses : actions/cache@v4
174- with :
175- path : |
176- ${{ github.workspace }}/vcpkg
177- ${{ github.workspace }}/vcpkg_installed
178- key : release-vcpkg-${{ matrix.os }}-${{ hashFiles('vcpkg.json') }}
179- restore-keys : |
180- release-vcpkg-${{ matrix.os }}-
181-
182- - name : Setup CMake
183- uses : jwlawson/actions-setup-cmake@v1.14
184- with :
185- cmake-version : ${{ env.CMAKE_VERSION }}
186-
187- - name : Setup vcpkg (Windows)
188- if : runner.os == 'Windows'
189- uses : lukka/run-vcpkg@v11
190- with :
191- vcpkgJsonGlob : ' **/vcpkg.json'
192-
193- - name : Install dependencies (Ubuntu)
194- if : runner.os == 'Linux'
195- run : |
196- sudo apt-get update
197- sudo apt-get install -y libssl-dev nlohmann-json3-dev
198-
199- - name : Configure CMake (Windows)
200- if : runner.os == 'Windows'
201- run : |
202- cmake -B build ${{ matrix.cmake_args }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake"
203-
204- - name : Configure CMake (Non-Windows)
205- if : runner.os != 'Windows'
206- run : |
207- cmake -B build ${{ matrix.cmake_args }} -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
208-
209- - name : Build
210- timeout-minutes : 20 # Reduced timeout for faster failure detection
211- run : |
212- cmake --build build --config ${{ matrix.build_type }} --parallel
213-
214- - name : Test
215- timeout-minutes : 10 # Add timeout to tests
216- run : |
217- cd build
218- ctest --output-on-failure -C ${{ matrix.build_type }} --exclude-regex "integration"
219-
220- - name : Package (Linux/macOS)
221- if : runner.os != 'Windows'
222- run : |
223- cd build
224- cpack -G TGZ
225- ls -la *.tar.gz
226-
227- - name : Package (Windows)
228- if : runner.os == 'Windows'
229- run : |
230- cd build
231- cpack -G ZIP
232- dir *.zip
233-
234- - name : Upload artifacts
235- uses : actions/upload-artifact@v4
236- with :
237- name : llmcpp-${{ needs.validate-version.outputs.version }}-${{ runner.os }}
238- path : |
239- build/*.tar.gz
240- build/*.zip
241- retention-days : 30
242-
243110 create-release :
244- needs : [check-open-prs, check-ci-status, validate-version, build-and-test ]
111+ needs : [check-open-prs, validate-version]
245112 if : needs.check-open-prs.outputs.has_open_prs == 'false'
246113 runs-on : ubuntu-latest
247114 permissions :
@@ -253,11 +120,6 @@ jobs:
253120 with :
254121 fetch-depth : 0 # Fetch all history for changelog generation
255122
256- - name : Download all artifacts
257- uses : actions/download-artifact@v4
258- with :
259- path : release-assets
260-
261123 - name : Setup Python
262124 uses : actions/setup-python@v4
263125 with :
@@ -279,18 +141,15 @@ jobs:
279141 body : ${{ steps.changelog.outputs.changelog }}
280142 prerelease : ${{ needs.validate-version.outputs.is_prerelease }}
281143 draft : false
282- files : |
283- release-assets/**/*
284144 env :
285145 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
286146
287147 - name : Create release summary
288148 run : |
289149 echo "## 🎉 Release ${{ needs.validate-version.outputs.version }} Created!" >> $GITHUB_STEP_SUMMARY
290150 echo "" >> $GITHUB_STEP_SUMMARY
291- echo "### 📦 Assets:" >> $GITHUB_STEP_SUMMARY
292- echo "- Linux (Ubuntu) build artifacts" >> $GITHUB_STEP_SUMMARY
293- echo "- Windows build artifacts" >> $GITHUB_STEP_SUMMARY
151+ echo "### 📝 Release Notes:" >> $GITHUB_STEP_SUMMARY
152+ echo "Release notes generated from CHANGELOG.md" >> $GITHUB_STEP_SUMMARY
294153 echo "" >> $GITHUB_STEP_SUMMARY
295154 echo "### 🔗 Links:" >> $GITHUB_STEP_SUMMARY
296155 echo "- [Release Page](https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }})" >> $GITHUB_STEP_SUMMARY
0 commit comments