diff --git a/.Jenkins/workflows/Jenkinsfile_EL9 b/.Jenkins/workflows/Jenkinsfile_EL9 index 9646811b..47ca4116 100644 --- a/.Jenkins/workflows/Jenkinsfile_EL9 +++ b/.Jenkins/workflows/Jenkinsfile_EL9 @@ -104,7 +104,7 @@ pipeline { } } } - stage('rpmbuild') { + stage('build_whl') { agent { node { label 'podman' @@ -117,7 +117,7 @@ pipeline { steps { script { // DOCKER_IMAGE is defined through Jenkins project - rpmbuildStageDockerImage="${DOCKER_IMAGE}_${BUILD_NUMBER}_${STAGE_NAME}" + buildwhlStageDockerImage="${DOCKER_IMAGE}_${BUILD_NUMBER}_${STAGE_NAME}" } echo "cleanup workspace" sh 'for f in $(ls -A); do rm -rf ${f}; done' @@ -135,16 +135,16 @@ pipeline { fi cd .. ''' - echo "prepare podman image ${rpmbuildStageDockerImage}" - sh "podman build --pull --tag ${rpmbuildStageDockerImage} --build-arg BASEIMAGE=docker.io/hepcloud/decision-engine-ci-el9:${BRANCH} --build-arg UID=\$(id -u) --build-arg GID=\$(id -g) -f decisionengine_modules/package/ci/EL9/Dockerfile decisionengine_modules/package/ci/EL9/" + echo "prepare podman image ${buildwhlStageDockerImage}" + sh "podman build --pull --tag ${buildwhlStageDockerImage} --build-arg BASEIMAGE=hepcloud/decision-engine-ci-el9:${BRANCH} --build-arg UID=\$(id -u) --build-arg GID=\$(id -g) -f decisionengine_modules/package/ci/EL9/Dockerfile decisionengine_modules/package/ci/EL9/" echo "Run ${STAGE_NAME} tests" - sh "podman run --userns keep-id:uid=\$(id -u),gid=\$(id -g) --rm --env GITHUB_PR_NUMBER=${GITHUB_PR_NUMBER} --env PYTEST_TIMEOUT=${PYTEST_TIMEOUT} -v ${WORKSPACE}/decisionengine_modules:${WORKSPACE}/decisionengine_modules -w ${WORKSPACE}/decisionengine_modules ${rpmbuildStageDockerImage} \"setup.py bdist_rpm\" \"rpmbuild.log\" \"${BRANCH}\"" + sh "podman run --userns keep-id:uid=\$(id -u),gid=\$(id -g) --rm --env GITHUB_PR_NUMBER=${GITHUB_PR_NUMBER} --env PYTEST_TIMEOUT=${PYTEST_TIMEOUT} -v ${WORKSPACE}/decisionengine_modules:${WORKSPACE}/decisionengine_modules -w ${WORKSPACE}/decisionengine_modules ${buildwhlStageDockerImage} \"setup.py bdist_wheel\" \"build_whl.log\" \"${BRANCH}\"" } post { always { - archiveArtifacts artifacts: "decisionengine_modules/rpmbuild.log,decisionengine_modules/dist/*.rpm" - echo "cleanup podman image ${rpmbuildStageDockerImage}" - sh "podman rmi ${rpmbuildStageDockerImage}" + archiveArtifacts artifacts: "decisionengine_modules/build_whl.log,decisionengine_modules/dist/*.whl" + echo "cleanup podman image ${buildwhlStageDockerImage}" + sh "podman rmi ${buildwhlStageDockerImage}" } } } diff --git a/.github/actions/python-command-in-el9-container/action.yaml b/.github/actions/python-command-in-el9-container/action.yaml new file mode 100644 index 00000000..5d5d071e --- /dev/null +++ b/.github/actions/python-command-in-el9-container/action.yaml @@ -0,0 +1,20 @@ +# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC +# SPDX-License-Identifier: Apache-2.0 + +name: "Python Action" +description: "Run python3 action in preconfigured EL9 container image" +inputs: + python-command: + description: "What to run" + required: true + default: "-m pytest" + logfile: + description: "Where to log output" + required: true + default: "pytest.log" +runs: + using: "docker" + image: "../../../package/ci/EL9/Dockerfile" + args: + - ${{ inputs.python-command }} + - ${{ inputs.logfile }} diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 53eba063..c49842d5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -173,3 +173,42 @@ jobs: run: | cd doc make rst html latexpdf + + build_whl: + if: ${{ github.ref != 'refs/heads/1.7' }} + name: Build DE Modules whl + runs-on: ubuntu-latest + needs: pytest + steps: + - name: make date tag + id: mkdatetag + run: echo "::set-output name=dtag::$(date +%Y%m%d_%H%M%S)" + + - name: make ref tag case 1 + id: mkreftag1 + if: ${{ github.event.inputs.ref != '' }} + run: echo "::set-output name=reftag::${{github.event.inputs.ref}}" + + - name: make ref tag case 2 + id: mkreftag2 + if: ${{ github.event.inputs.ref == '' }} + run: echo "::set-output name=reftag::${GITHUB_BASE_REF:+PR}"$(awk -F"/" '{print $3}' <<< ${GITHUB_REF}) + + - name: checkout code tree + uses: actions/checkout@v3 + with: + fetch-depth: 0 + ref: ${{github.event.inputs.ref}} + + - name: Run the build in a container (EL9/HEPCloud-CI) + uses: ./.github/actions/python-command-in-el9-container + with: + python-command: "setup.py bdist_wheel" + logfile: "build_whl.log" + + - name: Archive whl + uses: actions/upload-artifact@v3 + with: + name: whl-DE-EL9-${{steps.mkreftag1.outputs.reftag}}${{steps.mkreftag2.outputs.reftag}}-${{steps.mkdatetag.outputs.dtag}} + path: dist/*.whl + if-no-files-found: error diff --git a/package/ci/EL9/python3-entrypoint.sh b/package/ci/EL9/python3-entrypoint.sh index d1af2f52..3365a62c 100755 --- a/package/ci/EL9/python3-entrypoint.sh +++ b/package/ci/EL9/python3-entrypoint.sh @@ -27,7 +27,7 @@ git clone -b ${DE_BRANCH} https://github.com/HEPCloud/decisionengine.git # checkout GlideinWMS for python3 rm -rf glideinwms -git clone -b branch_v3_9 https://github.com/glideinWMS/glideinwms.git +git clone -b master https://github.com/glideinWMS/glideinwms.git # Install dependencies for GlideinWMS python3 -m pip install --upgrade pip diff --git a/setup.py b/setup.py index 7cd88ab4..0a467bb4 100644 --- a/setup.py +++ b/setup.py @@ -71,6 +71,7 @@ ] rpm_require.extend(__base_pip_requires) + # This metadata can be read out with: # import importlib.metadata # dir(importlib.metadata.metadata('decisionengine_modules')) @@ -78,6 +79,19 @@ # importlib_resources on python < 3.9 # # Much of it comes out of decisionengine_modules.about.py + +# for decisionengine dev we have version in the form X.Y.Z.devN +# while for tag we have version in the form X.Y.Z +verarr = about.__version__.split(".")[:4] +if len(verarr) > 3: + # this is a dev version + ver = ".".join(verarr[:3] + [verarr[3][:3]]) +else: + # this is a tag + ver = ".".join(verarr[:3]) +# string to add decisionengine as decisionengine_modules requirement +de_req = [f"decisionengine>=" + ver] + setup( setup_requires=["setuptools >= 51.2", "wheel >= 0.36.2", "setuptools_scm >= 6.3.1"], python_requires=">3.7.0", @@ -89,7 +103,7 @@ license=about.__license__, package_dir={"": "src"}, packages=find_packages(where="src", exclude=("tests", "*.tests", "*.tests.*", "build.*", "doc.*")), - install_requires=runtime_require, + install_requires=runtime_require + de_req, extras_require={ "develop": devel_req, },