From 237e5514018009a534154ad9041e70a7b7753b28 Mon Sep 17 00:00:00 2001 From: Martin Weise <martin.weise@tuwien.ac.at> Date: Tue, 9 Apr 2024 20:24:00 +0200 Subject: [PATCH] Build pipeline --- .gitlab-ci.yml | 9 +++------ bin/test.sh | 12 ------------ lib/python/Makefile | 26 -------------------------- lib/python/build.sh | 8 -------- lib/python/package.sh | 8 ++++++++ lib/python/release.sh | 3 +++ 6 files changed, 14 insertions(+), 52 deletions(-) delete mode 100755 bin/test.sh delete mode 100644 lib/python/Makefile delete mode 100644 lib/python/build.sh create mode 100755 lib/python/package.sh create mode 100755 lib/python/release.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8eda77e96f..647d508a1d 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -583,7 +583,7 @@ release-libs: image: docker.io/python:3.11-alpine only: refs: - - /^release-[0-9]+.*/ + - /^release-.*/ variables: PIPENV_PIPFILE: "./dbrepo-analyse-service/Pipfile" script: @@ -591,8 +591,5 @@ release-libs: - pip install pipenv - pipenv install gunicorn && pipenv install --dev --system --deploy - pip install twine build - - 'sed -i -e "s/__APPVERSION__/${APP_VERSION}/g" ./lib/python/pyproject.toml ./lib/python/setup.py ./lib/python/README.md' - - python -m build --sdist ./lib/python - - python -m build --wheel ./lib/python - - cat ${CI_PIPYRC} | base64 -d > .pypirc - - python -m twine upload --config-file .pypirc --verbose --repository pypi ./lib/python/dist/dbrepo-* \ No newline at end of file + - ./lib/python/package.sh + - ./lib/python/release.sh \ No newline at end of file diff --git a/bin/test.sh b/bin/test.sh deleted file mode 100755 index 765ecaf6b7..0000000000 --- a/bin/test.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -mvn -f ./dbrepo-metadata-service/pom.xml clean install -DskipTests -# test java services -mvn -f ./dbrepo-metadata-service/pom.xml clean test verify -mvn -f ./dbrepo-data-service/pom.xml clean test verify -# test python services -bash ./dbrepo-analyse-service/test.sh -bash ./dbrepo-search-service/test.sh -# test ui -yarn --cwd ./dbrepo-ui install -yarn --cwd ./dbrepo-ui run test:unit -yarn --cwd ./dbrepo-ui run coverage \ No newline at end of file diff --git a/lib/python/Makefile b/lib/python/Makefile deleted file mode 100644 index 4b9e18e3ad..0000000000 --- a/lib/python/Makefile +++ /dev/null @@ -1,26 +0,0 @@ -all: - -clean: - rm -rf ./python/dist/* ./docs/build/* ./dist/* - -install: - pipenv install - -docs: clean - sphinx-apidoc -o ./docs/source ./dbrepo - sphinx-build -M html ./docs/ ./docs/build/ - -check: - python3 ./python/setup.py develop - -build: clean - python3 -m build --sdist . - python3 -m build --wheel . - -deploy: build - python3 -m twine upload --config-file ~/.pypirc --verbose --repository pypi ./dist/dbrepo-* - -deploy-test: build - python3 -m twine upload --config-file ~/.pypirc --verbose --repository testpypi ./dist/dbrepo-* - -FORCE: ; \ No newline at end of file diff --git a/lib/python/build.sh b/lib/python/build.sh deleted file mode 100644 index 802067b6be..0000000000 --- a/lib/python/build.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/bash - -# needed for MariaDB Connector/C -apt update && apt install -y curl gcc libmariadb3 libmariadb-dev - -python3 -m venv ./lib/python/venv -source ./lib/python/venv/bin/activate -PIPENV_PIPFILE=./lib/python/Pipfile pipenv install --dev \ No newline at end of file diff --git a/lib/python/package.sh b/lib/python/package.sh new file mode 100755 index 0000000000..4478dbf962 --- /dev/null +++ b/lib/python/package.sh @@ -0,0 +1,8 @@ +#!/bin/bash +PRE_RELEASE="" +if [ "${CI_COMMIT_BRANCH:8:8}" = "master" ]; then + PRE_RELEASE="rc${CI_PIPELINE_ID}" +fi +sed -i -e "s/__APPVERSION__/${APP_VERSION}${PRE_RELEASE}/g" ./lib/python/pyproject.toml ./lib/python/setup.py ./lib/python/README.md +python -m build --sdist ./lib/python +python -m build --wheel ./lib/python diff --git a/lib/python/release.sh b/lib/python/release.sh new file mode 100755 index 0000000000..5e2b326831 --- /dev/null +++ b/lib/python/release.sh @@ -0,0 +1,3 @@ +#!/bin/bash +cat ${CI_PIPYRC} | base64 -d > .pypirc +python -m twine upload --config-file .pypirc --verbose --repository pypi ./lib/python/dist/dbrepo-* -- GitLab