3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2026-02-09 10:35:36 +00:00

update version

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2026-02-08 12:42:35 -08:00
parent 1799e6b8a3
commit 85534f154d
7 changed files with 96 additions and 99 deletions

View file

@ -1,87 +0,0 @@
# NuGet Package Build Workflow
This document describes the GitHub Actions workflow for building Z3 NuGet packages.
## Overview
The NuGet build workflow (`.github/workflows/nuget-build.yml`) creates Microsoft.Z3 NuGet packages for distribution. It builds Z3 for all supported platforms and assembles them into NuGet packages.
## Triggering the Workflow
The workflow can be triggered in two ways:
### 1. Manual Trigger
You can manually trigger the workflow from the GitHub Actions tab:
1. Go to the "Actions" tab in the repository
2. Select "Build NuGet Package" workflow
3. Click "Run workflow"
4. Enter the version number (e.g., `4.15.5`)
5. Click "Run workflow"
### 2. Tag-based Trigger
The workflow automatically runs when you push a tag with the `z3-` prefix:
```bash
git tag z3-4.15.5
git push origin z3-4.15.5
```
## Workflow Structure
The workflow consists of multiple jobs:
### Build Jobs
1. **build-windows-x64**: Builds Windows x64 binaries with .NET support
2. **build-windows-x86**: Builds Windows x86 binaries with .NET support
3. **build-windows-arm64**: Builds Windows ARM64 binaries with .NET support
4. **build-ubuntu**: Builds Linux x64 binaries with .NET support
5. **build-macos-x64**: Builds macOS x64 binaries with .NET support
6. **build-macos-arm64**: Builds macOS ARM64 binaries with .NET support
### Package Jobs
1. **package-nuget-x64**: Creates the main NuGet package (Microsoft.Z3.nupkg) with x64, ARM64, Linux, and macOS support
2. **package-nuget-x86**: Creates the x86 NuGet package (Microsoft.Z3.x86.nupkg)
## Output
The workflow produces two NuGet packages as artifacts:
- `Microsoft.Z3.{version}.nupkg` and `Microsoft.Z3.{version}.snupkg` (x64 + multi-platform)
- `Microsoft.Z3.x86.{version}.nupkg` and `Microsoft.Z3.x86.{version}.snupkg` (x86 only)
These can be downloaded from the workflow run's artifacts section.
## Key Files
- `.github/workflows/nuget-build.yml`: The workflow definition
- `scripts/mk_nuget_task.py`: Script that assembles the NuGet package from build artifacts
- `scripts/mk_win_dist.py`: Script for building Windows x86/x64 distributions
- `scripts/mk_win_dist_cmake.py`: Script for building Windows ARM64 distributions
- `scripts/mk_unix_dist.py`: Script for building Linux and macOS distributions
## Bug Fix
This workflow includes a fix for a critical bug in `mk_nuget_task.py` where the `replace()` function had incorrect logic that would fail to copy files when the destination already existed. The fix ensures that Microsoft.Z3.dll and related files are always properly included in the NuGet package under `lib/netstandard2.0/`.
## Development
To test changes to the NuGet packaging locally, you can:
1. Build the platform-specific binaries using the appropriate build scripts
2. Collect the resulting ZIP files in a directory
3. Run `mk_nuget_task.py` to assemble the package:
```bash
python scripts/mk_nuget_task.py <packages_dir> <version> <repo_url> <branch> <commit> <source_dir> [symbols] [x86]
```
4. Use the NuGet CLI to pack the package:
```bash
nuget pack out/Microsoft.Z3.sym.nuspec -OutputDirectory . -Verbosity detailed -Symbols -SymbolPackageFormat snupkg -BasePath out
```

View file

@ -17,7 +17,7 @@ permissions:
env:
MAJOR: '4'
MINOR: '15'
PATCH: '6'
PATCH: '7'
jobs:
# ============================================================================

View file

@ -4,9 +4,9 @@ on:
workflow_dispatch:
inputs:
version:
description: 'Version number for the NuGet package (e.g., 4.15.5)'
description: 'Version number for the NuGet package (e.g., 4.15.7)'
required: true
default: '4.15.5'
default: '4.15.7'
push:
tags:
- 'z3-*'
@ -31,7 +31,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x64
python scripts\mk_win_dist.py --x64-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.15.5' }} --zip
python scripts\mk_win_dist.py --x64-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.15.7' }} --zip
- name: Upload Windows x64 artifact
uses: actions/upload-artifact@v6
@ -55,7 +55,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" x86
python scripts\mk_win_dist.py --x86-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.15.5' }} --zip
python scripts\mk_win_dist.py --x86-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.15.7' }} --zip
- name: Upload Windows x86 artifact
uses: actions/upload-artifact@v6
@ -79,7 +79,7 @@ jobs:
shell: cmd
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64_arm64
python scripts\mk_win_dist_cmake.py --arm64-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.15.5' }} --zip
python scripts\mk_win_dist_cmake.py --arm64-only --dotnet-key=%GITHUB_WORKSPACE%\resources\z3.snk --assembly-version=${{ github.event.inputs.version || '4.15.7' }} --zip
- name: Upload Windows ARM64 artifact
uses: actions/upload-artifact@v6
@ -189,7 +189,7 @@ jobs:
shell: cmd
run: |
cd package-files
python ..\scripts\mk_nuget_task.py . ${{ github.event.inputs.version || '4.15.5' }} https://github.com/Z3Prover/z3 ${{ github.ref_name }} ${{ github.sha }} ${{ github.workspace }} symbols
python ..\scripts\mk_nuget_task.py . ${{ github.event.inputs.version || '4.15.7' }} https://github.com/Z3Prover/z3 ${{ github.ref_name }} ${{ github.sha }} ${{ github.workspace }} symbols
- name: Pack NuGet package
shell: cmd
@ -238,7 +238,7 @@ jobs:
shell: cmd
run: |
cd packages
python ..\scripts\mk_nuget_task.py . ${{ github.event.inputs.version || '4.15.5' }} https://github.com/Z3Prover/z3 ${{ github.ref_name }} ${{ github.sha }} ${{ github.workspace }} symbols x86
python ..\scripts\mk_nuget_task.py . ${{ github.event.inputs.version || '4.15.7' }} https://github.com/Z3Prover/z3 ${{ github.ref_name }} ${{ github.sha }} ${{ github.workspace }} symbols x86
- name: Pack NuGet package
shell: cmd
@ -254,3 +254,4 @@ jobs:
packages/*.nupkg
packages/*.snupkg
retention-days: 30

View file

@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
release_version:
description: 'Release version (e.g., 4.15.5)'
description: 'Release version (e.g., 4.15.7)'
required: true
type: string
publish_github:

View file

@ -1,6 +1,6 @@
module(
name = "z3",
version = "4.15.6", # TODO: Read from VERSION.txt - currently manual sync required
version = "4.15.7", # TODO: Read from VERSION.txt - currently manual sync required
bazel_compatibility = [">=7.0.0"],
)

View file

@ -1 +1 @@
4.15.6.0
4.15.7.0

View file

@ -95,6 +95,86 @@ def update_github_nightly_yml(version):
except IOError as e:
print(f"Error updating .github/workflows/nightly.yml: {e}")
def update_github_nuget_build_yml(version):
"""Update .github/workflows/nuget-build.yml example version and default."""
script_dir = os.path.dirname(os.path.abspath(__file__))
nuget_build_file = os.path.join(os.path.dirname(script_dir), '.github', 'workflows', 'nuget-build.yml')
if not os.path.exists(nuget_build_file):
print(f"Warning: {nuget_build_file} does not exist, skipping")
return
version_parts = version.split('.')
if len(version_parts) >= 3:
display_version = f"{version_parts[0]}.{version_parts[1]}.{version_parts[2]}"
else:
display_version = version
try:
with open(nuget_build_file, 'r') as f:
content = f.read()
# Update example version in description and default value
content = re.sub(
r"(description:\s*'Version number for the NuGet package \(e\.g\.,\s*)[0-9]+\.[0-9]+\.[0-9]+(\)')",
r"\g<1>" + display_version + r"\g<2>",
content
)
content = re.sub(
r"(default:\s*')[0-9]+\.[0-9]+\.[0-9]+(')",
r"\g<1>" + display_version + r"\g<2>",
content
)
# Update fallback versions in assembly-version parameters
content = re.sub(
r"(\|\|\s*')[0-9]+\.[0-9]+\.[0-9]+(')",
r"\g<1>" + display_version + r"\g<2>",
content
)
with open(nuget_build_file, 'w') as f:
f.write(content)
print(f"Updated .github/workflows/nuget-build.yml version references to {display_version}")
except IOError as e:
print(f"Error updating .github/workflows/nuget-build.yml: {e}")
def update_github_release_yml(version):
"""Update .github/workflows/release.yml example version in description."""
script_dir = os.path.dirname(os.path.abspath(__file__))
release_file = os.path.join(os.path.dirname(script_dir), '.github', 'workflows', 'release.yml')
if not os.path.exists(release_file):
print(f"Warning: {release_file} does not exist, skipping")
return
version_parts = version.split('.')
if len(version_parts) >= 3:
display_version = f"{version_parts[0]}.{version_parts[1]}.{version_parts[2]}"
else:
display_version = version
try:
with open(release_file, 'r') as f:
content = f.read()
# Update example version in description
content = re.sub(
r"(description:\s*'Release version \(e\.g\.,\s*)[0-9]+\.[0-9]+\.[0-9]+(\)')",
r"\g<1>" + display_version + r"\g<2>",
content
)
with open(release_file, 'w') as f:
f.write(content)
print(f"Updated .github/workflows/release.yml example version to {display_version}")
except IOError as e:
print(f"Error updating .github/workflows/release.yml: {e}")
def main():
"""Main function."""
print("Z3 Version Update Script")
@ -107,13 +187,16 @@ def main():
update_bazel_module(version)
update_github_nightly_yml(version)
update_github_release_yml(version)
update_github_nuget_build_yml(version)
print("\nUpdate complete!")
print("\nNote: The following files automatically read from VERSION.txt:")
print(" - CMakeLists.txt")
print(" - scripts/mk_project.py")
print("\nThese do not need manual updates.")
print("\nNote: .github/workflows/release.yml uses input parameters, not hardcoded versions.")
print("\nNote: .github/workflows/release.yml uses input parameters for actual releases,")
print("but the example version in the description has been updated.")
if __name__ == "__main__":
main()