interplane.Get Omega
Read in your language

ggml

[Ported from github.com/ggml-org/ggml] docs : sync ggml_type enum in gguf.md (#1685)

Brought by drakestapleton

branch master Branches Tags History

ggml / scripts / make-release-checks.sh

113 lines · 4179 bytes Raw Blame History
1#!/bin/bash
2# Run all pre-release checks and determine the release version.
3#
4# Usage: make-release-checks.sh [--dry-run]
5# --dry-run: warn on failures instead of aborting
6#
7# Env (when running in GitHub Actions):
8# GH_TOKEN, GITHUB_REPOSITORY, GITHUB_OUTPUT
9# RELEASE_BRANCH: when set, HEAD must belong to origin/RELEASE_BRANCH and must
10# not be older than 3 days from the branch HEAD (skipped when unset)
11set -euo pipefail
12
13SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
14REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
15
16DRY_RUN=false
17CHECKS_PASSED=true
18for arg in "$@"; do
19 case "$arg" in
20 --dry-run) DRY_RUN=true ;;
21 *) echo "Unknown argument: $arg"; exit 1 ;;
22 esac
23done
24
25MAJOR=$(sed -n 's/^set(GGML_VERSION_MAJOR \([0-9][0-9]*\)).*/\1/p' "$REPO_ROOT/CMakeLists.txt")
26MINOR=$(sed -n 's/^set(GGML_VERSION_MINOR \([0-9][0-9]*\)).*/\1/p' "$REPO_ROOT/CMakeLists.txt")
27PATCH=$(sed -n 's/^set(GGML_VERSION_PATCH \([0-9][0-9]*\)).*/\1/p' "$REPO_ROOT/CMakeLists.txt")
28VERSION="v${MAJOR}.${MINOR}.${PATCH}"
29echo "Determined version: ${VERSION}"
30if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
31 echo "version=${VERSION}" >> "$GITHUB_OUTPUT"
32fi
33
34SHA=$(git rev-parse HEAD)
35
36echo "Checking that commit ${SHA} belongs to the release branch..."
37if [[ -z "${RELEASE_BRANCH:-}" ]]; then
38 echo "Warning: RELEASE_BRANCH not set - skipping commit check (local run)"
39else
40 TIP="origin/${RELEASE_BRANCH}"
41 COMMIT_ERR=""
42 if ! git rev-parse --verify "${TIP}" >/dev/null 2>&1; then
43 COMMIT_ERR="branch ${RELEASE_BRANCH} not found on remote"
44 elif ! git merge-base --is-ancestor "${SHA}" "${TIP}"; then
45 COMMIT_ERR="commit ${SHA} is not part of branch ${RELEASE_BRANCH}"
46 else
47 COMMIT_TS=$(git show -s --format=%ct "${SHA}")
48 TIP_TS=$(git show -s --format=%ct "${TIP}")
49 AGE_DAYS=$(( (TIP_TS - COMMIT_TS) / 86400 ))
50 if (( TIP_TS - COMMIT_TS > 3 * 86400 )); then
51 COMMIT_ERR="commit ${SHA} is ${AGE_DAYS} day(s) older than the HEAD of ${RELEASE_BRANCH} (max: 3)"
52 fi
53 fi
54 if [[ -n "${COMMIT_ERR}" ]]; then
55 if [[ "$DRY_RUN" == "true" ]]; then
56 echo "Warning: ${COMMIT_ERR} (dry run, continuing)."
57 CHECKS_PASSED=false
58 else
59 echo "Error: ${COMMIT_ERR}"
60 exit 1
61 fi
62 else
63 echo "Commit ${SHA} is on branch ${RELEASE_BRANCH} and within 3 days of its HEAD - OK"
64 fi
65fi
66
67echo "Checking that tag ${VERSION} does not already exist..."
68if git ls-remote --tags origin "${VERSION}" | grep -q "${VERSION}"; then
69 echo "Error: tag ${VERSION} already exists on remote"
70 exit 1
71fi
72echo "Tag ${VERSION} does not exist on remote - OK"
73
74echo "Checking release.yml status for commit ${SHA}..."
75if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then
76 echo "Warning: GITHUB_REPOSITORY not set - skipping CI check (local run)"
77else
78 RUNS=$(gh api "repos/${GITHUB_REPOSITORY}/actions/workflows/release.yml/runs?per_page=100" \
79 --jq "[.workflow_runs[] | select(.head_sha == \"${SHA}\" and .conclusion == \"success\")] | length")
80 if [[ "$RUNS" -eq 0 ]]; then
81 if [[ "$DRY_RUN" == "true" ]]; then
82 echo "Warning: no successful release.yml run found for HEAD (${SHA}) (dry run, continuing)."
83 CHECKS_PASSED=false
84 else
85 echo "Error: no successful release.yml run found for HEAD (${SHA})"
86 echo "The release workflow must complete successfully before making a release."
87 exit 1
88 fi
89 else
90 echo "Found successful release.yml run for HEAD."
91 fi
92fi
93
94echo "Checking API/ABI compatibility..."
95set +e
96bash "$SCRIPT_DIR/check-release-apiabi.sh"
97APIABI_RESULT=$?
98set -e
99if [[ $APIABI_RESULT -ne 0 ]]; then
100 if [[ "$DRY_RUN" == "true" ]]; then
101 echo "Warning: API/ABI check found backwards-incompatible changes (dry run, continuing)."
102 CHECKS_PASSED=false
103 else
104 echo "Error: API/ABI check found backwards-incompatible changes."
105 exit 1
106 fi
107else
108 echo "API/ABI compatibility check passed - OK"
109fi
110
111if [[ -n "${GITHUB_OUTPUT:-}" ]]; then
112 echo "checks_passed=${CHECKS_PASSED}" >> "$GITHUB_OUTPUT"
113fi