diff options
| author | 魏曹先生 <1992414357@qq.com> | 2026-01-23 03:57:09 +0800 |
|---|---|---|
| committer | 魏曹先生 <1992414357@qq.com> | 2026-01-23 03:57:09 +0800 |
| commit | 520d37f438d7e13e7b452d34b23fef68550a036b (patch) | |
| tree | 3b0c06650be783eebb35c4b8858d3a760cf5c320 | |
| parent | 057b1990d3938c0b38ba81675ae1da66ce484e6f (diff) | |
Add core library existence and git status checks to deploy scripts
| -rw-r--r-- | deploy.ps1 | 18 | ||||
| -rwxr-xr-x | deploy.sh | 18 |
2 files changed, 34 insertions, 2 deletions
@@ -5,6 +5,13 @@ $scriptPath = $MyInvocation.MyCommand.Path $scriptDir = Split-Path $scriptPath -Parent Set-Location $scriptDir +# Check if core library exists +$coreLibPath = "..\VersionControl\" +if (-not (Test-Path $coreLibPath)) { + Write-Warning "Core library not found at $coreLibPath. Aborting build." + exit 1 +} + # Test core library cargo test --manifest-path ..\VersionControl\Cargo.toml --workspace if ($LASTEXITCODE -ne 0) { @@ -19,13 +26,22 @@ if ($LASTEXITCODE -ne 0) { exit 1 } -# Check if git worktree is clean +# Check if main git worktree is clean $gitStatus = git status --porcelain if ($gitStatus) { Write-Warning "Git worktree is not clean. Commit or stash changes before building." exit 1 } +# Check if core library git worktree is clean +Push-Location $coreLibPath +$coreGitStatus = git status --porcelain +Pop-Location +if ($coreGitStatus) { + Write-Warning "Core library git worktree is not clean. Commit or stash changes before building." + exit 1 +} + # Check for ISCC $isccPath = Get-Command ISCC -ErrorAction SilentlyContinue if (-not $isccPath) { @@ -5,6 +5,13 @@ # Change to the directory where the script is located cd "$(dirname "$0")" || exit 1 +# Check if core library exists +coreLibPath="../VersionControl/" +if [ ! -d "$coreLibPath" ]; then + echo "Core library not found at $coreLibPath. Aborting build." + exit 1 +fi + # Test core library cargo test --manifest-path ../VersionControl/Cargo.toml --workspace if [ $? -ne 0 ]; then @@ -19,13 +26,22 @@ if [ $? -ne 0 ]; then exit 1 fi -# Check if git worktree is clean +# Check if main git worktree is clean git_status=$(git status --porcelain) if [ -n "$git_status" ]; then echo "Git worktree is not clean. Commit or stash changes before building." exit 1 fi +# Check if core library git worktree is clean +pushd "$coreLibPath" > /dev/null +core_git_status=$(git status --porcelain) +popd > /dev/null +if [ -n "$core_git_status" ]; then + echo "Core library git worktree is not clean. Commit or stash changes before building." + exit 1 +fi + # Build if FORCE_BUILD=$(date +%s) cargo build --workspace --release; then # Export |
