Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
DomainForge/scripts/pre-release-check.sh at main · GodSpeedAI/DomainForge · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
GodSpeedAI
DomainForge
Repository navigation
Code
Issues
Pull requests
10
(10)
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
DomainForge
/
scripts
/
pre-release-check.sh
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
289 lines (257 loc) · 8.51 KB
main
Breadcrumbs
DomainForge
/
scripts
/
pre-release-check.sh
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
289 lines (257 loc) · 8.51 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
#!
/usr/bin/env bash
#
pre-release-check.sh - Pre-flight validation for releases
#
Usage: ./scripts/pre-release-check.sh [--dry-run]
#
#
Validates the repository is ready for a release:
#
- No uncommitted changes
#
- On correct branch (main, release/*)
#
- All tests pass
#
- Version files are in sync
#
- CHANGELOG.md is up to date
set
-euo pipefail
#
============================================================================
#
Configuration
#
============================================================================
SCRIPT_DIR=
"
$(
cd
"
$(
dirname
"
${BASH_SOURCE[0]}
"
)
"
&&
pwd
)
"
PROJECT_ROOT=
"
$(
cd
"
$SCRIPT_DIR
/..
"
&&
pwd
)
"
#
Colors for output
RED=
'
\033[0;31m
'
GREEN=
'
\033[0;32m
'
YELLOW=
'
\033[1;33m
'
BLUE=
'
\033[0;34m
'
NC=
'
\033[0m
'
#
No Color
#
Flags
DRY_RUN=false
VERBOSE=false
#
============================================================================
#
Helper Functions
#
============================================================================
log_info
() {
echo
-e
"
${BLUE}
[INFO]
${NC}
$1
"
}
log_success
() {
echo
-e
"
${GREEN}
[✓]
${NC}
$1
"
}
log_warn
() {
echo
-e
"
${YELLOW}
[WARN]
${NC}
$1
"
}
log_error
() {
echo
-e
"
${RED}
[✗]
${NC}
$1
"
}
log_step
() {
echo
-e
"
${BLUE}
[STEP]
${NC}
$1
"
}
usage
() {
cat
<<
EOF
Usage:
$(
basename
"
$0
"
)
[OPTIONS]
Pre-release validation checks for DomainForge.
OPTIONS:
--dry-run Show what would be checked without running tests
--verbose Show verbose output
--skip-tests Skip running test suites (faster, less thorough)
-h, --help Show this help message
CHECKS PERFORMED:
1. Git status - no uncommitted changes
2. Branch validation - must be main or release/*
3. Latest changes pulled from remote
4. All test suites pass (Rust, Python, TypeScript)
5. Version consistency across Cargo.toml, pyproject.toml, package.json
6. CHANGELOG.md has entry for current version
EXIT CODES:
0 All checks passed
1 One or more checks failed
EXAMPLES:
$(
basename
"
$0
"
)
# Run full pre-release checks
$(
basename
"
$0
"
)
--dry-run # Preview what would be checked
$(
basename
"
$0
"
)
--skip-tests # Skip running tests (faster)
EOF
}
#
============================================================================
#
Parse Arguments
#
============================================================================
SKIP_TESTS=false
while
[[
$#
-gt
0 ]]
;
do
case
$1
in
--dry-run)
DRY_RUN=true
shift
;;
--verbose)
VERBOSE=true
shift
;;
--skip-tests)
SKIP_TESTS=true
shift
;;
-h|--help)
usage
exit
0
;;
*
)
log_error
"
Unknown option:
$1
"
usage
exit
1
;;
esac
done
#
============================================================================
#
Checks
#
============================================================================
cd
"
$PROJECT_ROOT
"
FAILED=0
echo
"
"
echo
"
==============================================
"
echo
"
DomainForge Pre-Release Checks
"
echo
"
==============================================
"
echo
"
"
if
$DRY_RUN
;
then
log_warn
"
DRY RUN MODE - Showing what would be checked
"
echo
"
"
fi
#
Check 1: Git status
log_step
"
Checking git status for uncommitted changes...
"
if
$DRY_RUN
;
then
log_info
"
Would run: git status --porcelain
"
else
if
[[
-n
$(
git status --porcelain
)
]]
;
then
log_error
"
Uncommitted changes detected:
"
git status --short
FAILED=1
else
log_success
"
No uncommitted changes
"
fi
fi
#
Check 2: Branch validation
log_step
"
Validating current branch...
"
if
$DRY_RUN
;
then
log_info
"
Would check if branch matches: main or release/*
"
else
BRANCH=
$(
git rev-parse --abbrev-ref HEAD
)
if
[[
"
$BRANCH
"
=~
^(main
|
release/.
*
)$ ]]
;
then
log_success
"
On valid branch:
$BRANCH
"
if
[[
"
$BRANCH
"
!=
"
main
"
]]
;
then
log_warn
"
Release preparation is allowed on
$BRANCH
, but scripts/release.sh must be run from main after promotion.
"
fi
else
log_warn
"
On branch '
$BRANCH
' - releases typically done from main or release/*
"
#
Not a hard failure, just a warning
fi
fi
#
Check 3: Pull latest changes
log_step
"
Checking for latest changes from remote...
"
if
$DRY_RUN
;
then
log_info
"
Would run: git fetch origin && git status -uno
"
else
git fetch origin --quiet
2>
/dev/null
||
log_warn
"
Could not fetch from origin
"
LOCAL=
$(
git rev-parse HEAD
)
REMOTE=
$(
git rev-parse
"
@{u}
"
2>
/dev/null
||
echo
"
"
)
if
[[
-z
"
$REMOTE
"
]]
;
then
log_warn
"
No upstream branch set
"
elif
[[
"
$LOCAL
"
!=
"
$REMOTE
"
]]
;
then
BEHIND=
$(
git rev-list --count HEAD..@{u}
2>
/dev/null
||
echo
"
0
"
)
if
[[
"
$BEHIND
"
-gt
0 ]]
;
then
log_warn
"
Branch is
$BEHIND
commits behind remote. Consider pulling.
"
fi
else
log_success
"
Up to date with remote
"
fi
fi
#
Check 4: Version consistency
log_step
"
Checking version consistency across files...
"
if
$DRY_RUN
;
then
log_info
"
Would compare versions in:
"
log_info
"
- domainforge-core/Cargo.toml
"
log_info
"
- pyproject.toml
"
log_info
"
- package.json
"
else
CARGO_VERSION=
$(
grep -m1
'
^version =
'
domainforge-core/Cargo.toml
|
sed
'
s/version = "\(.*\)"/\1/
'
)
PYPROJECT_VERSION=
$(
grep -m1
'
^version =
'
pyproject.toml
|
sed
'
s/version = "\(.*\)"/\1/
'
|
tr -d
'
\r
'
)
PKG_VERSION=
$(
grep -m1
'
"version"
'
package.json
|
sed
'
s/.*"\([0-9][^"]*\)".*/\1/
'
)
log_info
"
Cargo.toml:
$CARGO_VERSION
"
log_info
"
pyproject.toml:
$PYPROJECT_VERSION
"
log_info
"
package.json:
$PKG_VERSION
"
if
[[
"
$CARGO_VERSION
"
==
"
$PYPROJECT_VERSION
"
&&
"
$CARGO_VERSION
"
==
"
$PKG_VERSION
"
]]
;
then
log_success
"
All versions match:
$CARGO_VERSION
"
else
log_error
"
Version mismatch across files!
"
FAILED=1
fi
fi
#
Check 5: CHANGELOG.md has entry for current version
log_step
"
Checking CHANGELOG.md...
"
if
$DRY_RUN
;
then
log_info
"
Would verify CHANGELOG.md contains entry for current version
"
else
if
[[
-f
"
CHANGELOG.md
"
]]
;
then
#
Get the first version entry
FIRST_CHANGELOG_VERSION=
$(
grep -m1
'
^\#\# \[
'
CHANGELOG.md
|
sed
'
s/.*\[\([0-9][^]]*\)\].*/\1/
'
||
echo
"
"
)
if
[[
-n
"
$FIRST_CHANGELOG_VERSION
"
]]
;
then
if
[[
"
$FIRST_CHANGELOG_VERSION
"
==
"
$CARGO_VERSION
"
]]
;
then
log_success
"
CHANGELOG.md has entry for current version (
$CARGO_VERSION
)
"
else
log_warn
"
CHANGELOG.md top entry (
$FIRST_CHANGELOG_VERSION
) doesn't match current version (
$CARGO_VERSION
)
"
fi
else
log_warn
"
Could not find version entry in CHANGELOG.md
"
fi
else
log_error
"
CHANGELOG.md not found
"
FAILED=1
fi
fi
#
Check 6: Run tests
if
$SKIP_TESTS
;
then
log_step
"
Skipping tests (--skip-tests flag)
"
else
log_step
"
Running test suites...
"
if
$DRY_RUN
;
then
log_info
"
Would run: just all-tests (Rust + Python + TypeScript)
"
else
if
command
-v just
&
>
/dev/null
;
then
log_info
"
Running: just all-tests
"
if
just all-tests
;
then
log_success
"
All tests passed
"
else
log_error
"
Tests failed
"
FAILED=1
fi
else
log_warn
"
'just' not found, attempting individual test commands...
"
#
Try Rust tests
log_info
"
Running Rust tests...
"
if
cargo
test
-p domainforge-core --features cli
;
then
log_success
"
Rust tests passed
"
else
log_error
"
Rust tests failed
"
FAILED=1
fi
fi
fi
fi
#
Check 7: Verify build works
log_step
"
Verifying release build...
"
if
$DRY_RUN
;
then
log_info
"
Would run: cargo build -p domainforge-core --release --features cli
"
else
if
cargo build -p domainforge-core --release --features cli
2>
/dev/null
;
then
log_success
"
Release build successful
"
else
log_error
"
Release build failed
"
FAILED=1
fi
fi
#
============================================================================
#
Summary
#
============================================================================
echo
"
"
echo
"
==============================================
"
if
[[
$FAILED
-eq
0 ]]
;
then
log_success
"
All pre-release checks passed!
"
echo
"
==============================================
"
exit
0
else
log_error
"
Some pre-release checks failed
"
echo
"
==============================================
"
exit
1
fi
You can’t perform that action at this time.