Skip to content

Commit

Permalink
Allow dev version of Python wheels to be built and published (#2066)
Browse files Browse the repository at this point in the history
* Add dev versioning

* Also add dev versioning for package_tar

* Allow build steps to be skipped
  • Loading branch information
mewim committed Sep 21, 2023
1 parent e2a0c29 commit f8d48a6
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 3 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,50 @@ on:
type: boolean
required: true
default: false
skipBinaries:
description: "Skip building precompiled binaries?"
type: boolean
required: true
default: false
skipJava:
description: "Skip building Java?"
type: boolean
required: true
default: false
skipNodejs:
description: "Skip building Node.js?"
type: boolean
required: true
default: false
skipPython:
description: "Skip building Python?"
type: boolean
required: true
default: false
skipRust:
description: "Skip building Rust?"
type: boolean
required: true
default: false

jobs:
build-java-mac:
if: ${{ github.event.inputs.skipJava != 'true' }}
uses: ./.github/workflows/mac-java-workflow.yml
secrets: inherit

build-java-linux:
if: ${{ github.event.inputs.skipJava != 'true' }}
uses: ./.github/workflows/linux-java-workflow.yml
secrets: inherit

build-java-windows:
if: ${{ github.event.inputs.skipJava != 'true' }}
uses: ./.github/workflows/windows-java-workflow.yml
secrets: inherit

inject-java-bins:
if: ${{ github.event.inputs.skipJava != 'true' }}
needs: [build-java-mac, build-java-linux, build-java-windows]
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -59,18 +88,22 @@ jobs:
path: java-bins/kuzu_java.jar

build-nodejs-mac:
if: ${{ github.event.inputs.skipNodejs != 'true' }}
uses: ./.github/workflows/mac-nodejs-workflow.yml
secrets: inherit

build-nodejs-linux:
if: ${{ github.event.inputs.skipNodejs != 'true' }}
uses: ./.github/workflows/linux-nodejs-workflow.yml
secrets: inherit

build-nodejs-windows:
if: ${{ github.event.inputs.skipNodejs != 'true' }}
uses: ./.github/workflows/windows-nodejs-workflow.yml
secrets: inherit

deploy-nodejs:
if: ${{ github.event.inputs.skipNodejs != 'true' }}
needs: [build-nodejs-mac, build-nodejs-linux, build-nodejs-windows]
runs-on: ubuntu-latest
env:
Expand Down Expand Up @@ -131,18 +164,22 @@ jobs:
working-directory: tools/nodejs_api

build-wheel-mac:
if: ${{ github.event.inputs.skipPython != 'true' }}
uses: ./.github/workflows/mac-wheel-workflow.yml
secrets: inherit

build-wheel-linux:
if: ${{ github.event.inputs.skipPython != 'true' }}
uses: ./.github/workflows/linux-wheel-workflow.yml
secrets: inherit

build-wheel-windows:
if: ${{ github.event.inputs.skipPython != 'true' }}
uses: ./.github/workflows/windows-wheel-workflow.yml
secrets: inherit

package-python-sdist:
if: ${{ github.event.inputs.skipPython != 'true' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
Expand All @@ -158,6 +195,7 @@ jobs:
path: scripts/pip-package/*.tar.gz

deploy-python:
if: ${{ github.event.inputs.skipPython != 'true' }}
needs:
[
build-wheel-mac,
Expand Down Expand Up @@ -216,6 +254,7 @@ jobs:
password: ${{ secrets.PYPI_TOKEN }}

deploy-rust:
if: ${{ github.event.inputs.skipRust != 'true' }}
runs-on: kuzu-self-hosted-testing
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
Expand Down Expand Up @@ -243,13 +282,16 @@ jobs:
path: tools/rust_api/target/package/*.crate

build-precompiled-bin-mac:
if: ${{ github.event.inputs.skipBinaries != 'true' }}
uses: ./.github/workflows/mac-precompiled-bin-workflow.yml
secrets: inherit

build-precompiled-bin-linux:
if: ${{ github.event.inputs.skipBinaries != 'true' }}
uses: ./.github/workflows/linux-precompiled-bin-workflow.yml
secrets: inherit

build-precompiled-bin-windows:
if: ${{ github.event.inputs.skipBinaries != 'true' }}
uses: ./.github/workflows/windows-precompiled-bin-workflow.yml
secrets: inherit
10 changes: 9 additions & 1 deletion scripts/pip-package/package_tar.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,15 @@ def _get_kuzu_version():
with open(cmake_file) as f:
for line in f:
if line.startswith('project(Kuzu VERSION'):
return line.split(' ')[2].strip()
raw_version = line.split(' ')[2].strip()
version_nums = raw_version.split('.')
if len(version_nums) <= 3:
return raw_version
else:
dev_suffix = version_nums[3]
version = '.'.join(version_nums[:3])
version += ".dev%s" % dev_suffix
return version

if __name__ == "__main__":
if len(sys.argv) == 2:
Expand Down
11 changes: 9 additions & 2 deletions scripts/pip-package/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,15 @@ def _get_kuzu_version():
with open(cmake_file) as f:
for line in f:
if line.startswith('project(Kuzu VERSION'):
return line.split(' ')[2].strip()

raw_version = line.split(' ')[2].strip()
version_nums = raw_version.split('.')
if len(version_nums) <= 3:
return raw_version
else:
dev_suffix = version_nums[3]
version = '.'.join(version_nums[:3])
version += ".dev%s" % dev_suffix
return version

kuzu_version = _get_kuzu_version()
print("The version of this build is %s" % kuzu_version)
Expand Down

0 comments on commit f8d48a6

Please sign in to comment.