Skip to content

Commit

Permalink
Apply new versioning scheme (iree-org#19034)
Browse files Browse the repository at this point in the history
This implements a new versioning scheme, similar to the one recently
proposed with iree-org#18938 and applies it to `iree-compiler`, `iree-runtime`
and the `iree-dist` tarball. The TF and TFLite compiler tools use the
(legacy) versioning and need to be updated with a follow up commit. The
common version number is determined based on the versions of the
compiler and the runtime and the higher version is picked as the common
on. In contrast to the proposed versioning scheme, version numbers of
development releases are in the format `X.Y.Z.dev+${gitcommithash}` as
discussed in iree-org#19003 and not `X.Y.Z.dev` as originally proposed.
  • Loading branch information
marbre authored Nov 7, 2024
1 parent f42b90d commit 6d55a11
Show file tree
Hide file tree
Showing 15 changed files with 344 additions and 61 deletions.
115 changes: 87 additions & 28 deletions .github/workflows/build_package.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,19 @@ on:
description: "Suffix to append to package names"
required: false
default: ""
package_version:
legacy_package_version:
description: "Version of the package"
required: true
default: "0.1a1"
package_version:
description: "Version of the package"
required: true
compiler_package_version:
description: "Version of the iree-compiler package"
required: true
runtime_package_version:
description: "Version of the iree-runtime package"
required: true
release_id:
description: "Release id to upload artifacts to"
default: ""
Expand All @@ -30,8 +39,78 @@ on:
default: ""

jobs:
# Note: For cross platform builds, it's useful to just generate the
# metadata on Linux and pass that to later jobs using artifacts. The
# metadata generation could also happen in a separate workflow and
# might be moved.
setup_metadata:
runs-on: ubuntu-24.04
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
path: "c" # Windows can hit path length limits, so use a short path.
submodules: false
ref: ${{ github.event.inputs.commit }}

- name: Write version info (release)
id: version_local
shell: bash
run: |
# Note: `version_info.json` holds the CalVer version and is still used
# for iree-tools-tf and iree-tools-tflite.
cat << EOF > ./c/version_info.json
{
"package-suffix": "${{ github.event.inputs.package_suffix }}",
"package-version": "${{ github.event.inputs.legacy_package_version }}",
"iree-revision": "$(cd ./c && git rev-parse HEAD)"
}
EOF
cat ./c/version_info.json
echo "iree-dist"
cat << EOF > ./c/version_local.json
{
"package-suffix": "${{ github.event.inputs.package_suffix }}",
"package-version": "${{ github.event.inputs.package_version }}",
"iree-revision": "$(cd ./c && git rev-parse HEAD)"
}
EOF
cat ./c/version_local.json
echo "iree-compiler"
cat << EOF > ./c/compiler/version_local.json
{
"package-suffix": "${{ github.event.inputs.package_suffix }}",
"package-version": "${{ github.event.inputs.compiler_package_version }}",
"iree-revision": "$(cd ./c && git rev-parse HEAD)"
}
EOF
cat ./c/compiler/version_local.json
echo "iree-runtime"
cat << EOF > ./c/runtime/version_local.json
{
"package-suffix": "${{ github.event.inputs.package_suffix }}",
"package-version": "${{ github.event.inputs.runtime_package_version }}",
"iree-revision": "$(cd ./c && git rev-parse HEAD)"
}
EOF
cat ./c/runtime/version_local.json
- name: Upload version_local.json
uses: actions/upload-artifact@50769540e7f4bd5e21e526ee35c689e35e0d6874 # v4.4.0
with:
name: version_local
path: |
./c/version_info.json
./c/version_local.json
./c/compiler/version_local.json
./c/runtime/version_local.json
build_packages:
name: "${{ matrix.build-family }} :: Build ${{ matrix.build-package }} Package"
needs: setup_metadata
runs-on: ${{ matrix.runs-on }}
continue-on-error: ${{ matrix.experimental }}
strategy:
Expand Down Expand Up @@ -124,36 +203,16 @@ jobs:
run: sudo ./c/build_tools/python_deploy/install_macos_deps.sh

##########################################################################
# Write version_info.json
# Download version_info.json
# Various tools will read this in order to embed release information.
##########################################################################
- name: Write version info (release)
if: "matrix.build-family != 'windows'"
shell: bash
run: |
cat << EOF > ./c/version_info.json
{
"package-suffix": "${{ github.event.inputs.package_suffix }}",
"package-version": "${{ github.event.inputs.package_version }}",
"iree-revision": "$(cd ./c && git rev-parse HEAD)"
}
EOF
cat ./c/version_info.json

- name: Write version info Windows (release)
if: "matrix.build-family == 'windows'"
shell: powershell
run: |
cd c
$verinfoprop = @{
'package-suffix'= "${{ github.event.inputs.package_suffix }}"
'package-version'= "${{ github.event.inputs.package_version }}"
'iree-revision'= $(git rev-parse HEAD)
}
$info = New-Object -TypeName PSObject -Prop $verinfoprop
$info = $info | ConvertTo-JSON
$info | Out-File "version_info.json" -Encoding "ASCII"
- name: Download version_local.json
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: version_local
path: ./c/
merge-multiple: true

##########################################################################
# Build the main distribution tarball.
Expand Down
28 changes: 25 additions & 3 deletions .github/workflows/oneshot_candidate_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,25 @@ jobs:
- name: Compute version
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')"
tag_name="candidate-${package_version}"
# common version + tag
package_version="$(python3 build_tools/python_deploy/compute_common_version.py -rc)"
tag_name="iree-${package_version}"
echo "package_version=${package_version}" >> $GITHUB_ENV
echo "tag_name=${tag_name}" >> $GITHUB_ENV
# legacy package version (for iree-tools-{tf,tflite})
legacy_package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')"
echo "legacy_package_version=${legacy_package_version}" >> $GITHUB_ENV
# iree-compiler version
compiler_package_version="$(python3 build_tools/python_deploy/compute_local_version.py compiler -rc)"
echo "compiler_package_version=${compiler_package_version}" >> $GITHUB_ENV
# iree-runtime version
runtime_package_version="$(python3 build_tools/python_deploy/compute_local_version.py runtime -rc)"
echo "runtime_package_version=${runtime_package_version}" >> $GITHUB_ENV
- name: Updating candidate tag
run: |
git tag "${tag_name}"
Expand Down Expand Up @@ -51,4 +65,12 @@ jobs:
workflow: Build Release Packages
token: ${{ secrets.WRITE_ACCESS_TOKEN }}
ref: "${{ env.tag_name }}"
inputs: '{"package_suffix": "", "package_version": "${{ env.package_version }}", "release_id": "${{ steps.create_release.outputs.id }}"}'
inputs: |
{
"package_suffix": "",
"legacy_package_version": "${{ env.legacy_package_version }}",
"package_version": "${{ env.package_version }}",
"compiler_package_version": "${{ env.compiler_package_version }}",
"runtime_package_version": "${{ env.runtime_package_version }}",
"release_id": "${{ steps.create_release.outputs.id }}"
}
2 changes: 0 additions & 2 deletions .github/workflows/pkgci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ jobs:
needs: setup
if: contains(fromJson(needs.setup.outputs.enabled-jobs), 'build_packages')
uses: ./.github/workflows/pkgci_build_packages.yml
with:
package_version: 0.dev1

# Package sanity checks.
unit_test:
Expand Down
41 changes: 36 additions & 5 deletions .github/workflows/pkgci_build_packages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@
name: PkgCI Build Packages
on:
workflow_call:
inputs:
package_version:
type: string
required: true

jobs:
linux_x86_64_release_packages:
Expand All @@ -30,18 +26,53 @@ jobs:
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
submodules: true
- name: Setup Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.3
with:
python-version: 3.12
cache: "pip"
- name: Install Python packages
run: |
pip install packaging
pip freeze
- name: Write version info
shell: bash
run: |
package_version="$(python3 build_tools/python_deploy/compute_common_version.py -dev)"
cat << EOF > version_info.json
{
"package-suffix": "${PACKAGE_SUFFIX}",
"package-version": "${{ inputs.package_version }}",
"package-version": "${package_version}",
"iree-revision": "$(cd ../iree && git rev-parse HEAD)"
}
EOF
realpath version_info.json
cat version_info.json
echo
compiler_package_version="$(python3 build_tools/python_deploy/compute_local_version.py compiler -dev)"
cat << EOF > compiler/version_local.json
{
"package-suffix": "${PACKAGE_SUFFIX}",
"package-version": "${compiler_package_version}",
"iree-revision": "$(cd ../iree && git rev-parse HEAD)"
}
EOF
realpath compiler/version_local.json
cat compiler/version_local.json
echo
runtime_package_version="$(python3 build_tools/python_deploy/compute_local_version.py runtime -dev)"
cat << EOF > runtime/version_local.json
{
"package-suffix": "${PACKAGE_SUFFIX}",
"package-version": "${runtime_package_version}",
"iree-revision": "$(cd ../iree && git rev-parse HEAD)"
}
EOF
realpath runtime/version_local.json
cat runtime/version_local.json
- name: Enable cache
uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
with:
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/schedule_candidate_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,24 @@ jobs:
- name: Compute version
run: |
package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')"
tag_name="candidate-${package_version}"
# common version + tag
package_version="$(python3 build_tools/python_deploy/compute_common_version.py -rc)"
tag_name="iree-${package_version}"
echo "package_version=${package_version}" >> $GITHUB_ENV
echo "tag_name=${tag_name}" >> $GITHUB_ENV
# legacy package version (for iree-tools-{tf,tflite})
legacy_package_version="$(printf '%(%Y%m%d)T.${{ github.run_number }}')"
echo "legacy_package_version=${legacy_package_version}" >> $GITHUB_ENV
# iree-compiler version
compiler_package_version="$(python3 build_tools/python_deploy/compute_local_version.py compiler -rc)"
echo "compiler_package_version=${compiler_package_version}" >> $GITHUB_ENV
# iree-runtime version
runtime_package_version="$(python3 build_tools/python_deploy/compute_local_version.py runtime -rc)"
echo "runtime_package_version=${runtime_package_version}" >> $GITHUB_ENV
- name: Updating candidate tag
run: |
git tag "${tag_name}"
Expand Down Expand Up @@ -73,7 +86,10 @@ jobs:
inputs: |
{
"package_suffix": "",
"legacy_package_version": "${{ env.legacy_package_version }}",
"package_version": "${{ env.package_version }}",
"compiler_package_version": "${{ env.compiler_package_version }}",
"runtime_package_version": "${{ env.runtime_package_version }}",
"release_id": "${{ steps.create_release.outputs.id }}",
"commit": "${{ steps.last_green_commit.outputs.release-commit }}"
}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Testing/
configured.bazelrc
user.bazelrc
version_info.json
version_local.json
CMakeUserPresets.json

# Dear ImGui Ini files
Expand Down
3 changes: 1 addition & 2 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ IREE development is primarily driven via automated nightly release snapshots.
These are scheduled automatically each day by the
`schedule_candidate_release.yml` workflow, which selects a green commit from
main (for non optional CI tasks), created a tag of the format
`candidate-{YYYYMMDD}.{BUILDNUM}` and schedules automation to populate the
release.
`iree-{X.Y.ZrcYYYYMMDD}` and schedules automation to populate the release.

The `build_package.yml` workflow then runs jobs to do builds for all
platforms and packages, finally triggering the
Expand Down
7 changes: 4 additions & 3 deletions build_tools/github_actions/build_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
following sub-directories:
- c/ : Main IREE repository checkout.
- bindist/ : Directory where binary distribution artifacts are written.
- c/version_info.json : Version config information.
- c/version_info.json : Version config information (legacy).
- c/version_local.json : Version config information.
Within the build environment (which may be the naked runner or a docker image):
- iree-build/ : The build tree.
Expand Down Expand Up @@ -80,14 +81,14 @@

# Load version info.
def load_version_info():
with open(os.path.join(IREESRC_DIR, "version_info.json"), "rt") as f:
with open(os.path.join(IREESRC_DIR, "version_local.json"), "rt") as f:
return json.load(f)


try:
version_info = load_version_info()
except FileNotFoundError:
print("version_info.json not found. Using defaults")
print("version_local.json not found. Using version.json defaults")
version_info = {
"package-version": "0.1dev1",
"package-suffix": "-dev",
Expand Down
1 change: 1 addition & 0 deletions build_tools/github_actions/ci_requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
# Ensure a recent cmake
cmake>=3.18.4
ninja
packaging
Loading

0 comments on commit 6d55a11

Please sign in to comment.