Skip to content
Snippets Groups Projects
Verified Commit 791ae864 authored by Lars Bilke's avatar Lars Bilke
Browse files

[wheel] Get ogs version from env or git.

[ci] Upload wheel to GitLab registry.
parent 39ce500a
No related branches found
No related tags found
No related merge requests found
...@@ -11,5 +11,6 @@ def _program(name, args): ...@@ -11,5 +11,6 @@ def _program(name, args):
return subprocess.call([os.path.join(OGS_BIN_DIR, name)] + args) return subprocess.call([os.path.join(OGS_BIN_DIR, name)] + args)
# Binary entrypoints
def ogs(): def ogs():
raise SystemExit(_program("ogs", sys.argv[1:])) raise SystemExit(_program("ogs", sys.argv[1:]))
...@@ -22,3 +22,4 @@ build-verbosity = "1" ...@@ -22,3 +22,4 @@ build-verbosity = "1"
[tool.cibuildwheel.linux] [tool.cibuildwheel.linux]
manylinux-x86_64-image = "manylinux2014" manylinux-x86_64-image = "manylinux2014"
manylinux-aarch64-image = "manylinux2014" manylinux-aarch64-image = "manylinux2014"
environment-pass = ["OGS_VERSION"]
...@@ -4,6 +4,12 @@ build wheels linux: ...@@ -4,6 +4,12 @@ build wheels linux:
tags: [envinf3-shell] tags: [envinf3-shell]
script: script:
- pipx run cibuildwheel - pipx run cibuildwheel
- >
pipx run twine upload
--repository-url https://gitlab.opengeosys.org/api/v4/projects/${CI_PROJECT_ID}/packages/pypi
--username gitlab-ci-token
--password ${CI_JOB_TOKEN}
wheelhouse/*
artifacts: artifacts:
paths: paths:
- wheelhouse/ - wheelhouse/
from skbuild import setup from skbuild import setup
from setuptools import find_packages from setuptools import find_packages
import os
import re
import subprocess
def get_version():
git_version = ""
if "OGS_VERSION" in os.environ:
git_version = os.environ["OGS_VERSION"]
else:
git_version = subprocess.run(
["git describe --tags"],
capture_output=True,
text=True,
shell=True,
).stdout.strip()
if re.match("\d+\.\d+\.\d+-\d+-g\w+", git_version):
# Make it PEP 440 compliant
# e.g. 6.4.2-1140-g85bbc8b4e1 -> 6.4.2.dev1140
m = re.match(".+?(?=-g[\w]*$)", git_version) # strip out commit hash
if m:
return m.group(0).replace("-", ".dev") # insert dev
else:
print("WARNING: Could not get ogs version!")
exit(1)
else:
return git_version
setup( setup(
name="OpenGeoSys", name="OpenGeoSys",
version="6.4.2", version=get_version(),
description="OpenGeoSys", description="OpenGeoSys",
author="OpenGeoSys Community", author="OpenGeoSys Community",
license="BSD-3-Clause", license="BSD-3-Clause",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment