Skip to content

Commit bd53bb8

Browse files
mambelliMarco Mambelli
authored andcommitted
Addig dependencies RPM package and packaging with uv and pyproject.toml
Updated also actions version in workflows
1 parent aea4fd7 commit bd53bb8

File tree

5 files changed

+309
-24
lines changed

5 files changed

+309
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,18 @@ jobs:
3131
name: Python ${{ matrix.python-version }} unit tests
3232
steps:
3333
- name: checkout code tree
34-
uses: actions/checkout@v3
34+
uses: actions/checkout@v4
3535
with:
3636
fetch-depth: 0
3737

3838
- name: Setup python
39-
uses: actions/setup-python@v4
39+
uses: actions/setup-python@v5
4040
with:
4141
python-version: ${{ matrix.python-version }}
4242
architecture: x64
4343

4444
- name: Cache pip
45-
uses: actions/cache@v3
45+
uses: actions/cache@v4
4646
with:
4747
# This path is specific to Ubuntu
4848
path: ~/.cache/pip
@@ -78,7 +78,7 @@ jobs:
7878
run: python3 setup.py bdist_wheel
7979

8080
- name: Start Redis Server
81-
uses: supercharge/redis-github-action@1.4.0
81+
uses: supercharge/redis-github-action@1.8.0
8282

8383
- name: Run Unit Tests on Python ${{ matrix.python-version }}
8484
timeout-minutes: 35
@@ -92,13 +92,13 @@ jobs:
9292
9393
- name: Archive unit test logs
9494
if: failure() && !cancelled()
95-
uses: actions/upload-artifact@v3
95+
uses: actions/upload-artifact@v4
9696
with:
9797
name: log_unit_test_Python_${{ matrix.python-version }}
9898
path: /tmp/*.log
9999

100100
- name: Upload coverage to Codecov
101-
uses: codecov/codecov-action@v3
101+
uses: codecov/codecov-action@v5
102102
with:
103103
flags: python-${{ matrix.python-version }}
104104

@@ -108,17 +108,17 @@ jobs:
108108
needs: pytest
109109
steps:
110110
- name: checkout code tree
111-
uses: actions/checkout@v3
111+
uses: actions/checkout@v4
112112
with:
113113
fetch-depth: 0
114114

115-
- uses: actions/setup-python@v4
115+
- uses: actions/setup-python@v5
116116
with:
117117
python-version: "3.9"
118118
architecture: "x64"
119119

120120
- name: Cache pip
121-
uses: actions/cache@v3
121+
uses: actions/cache@v4
122122
with:
123123
# This path is specific to Ubuntu
124124
path: ~/.cache/pip
@@ -180,7 +180,7 @@ jobs:
180180
run: echo "::set-output name=reftag::${GITHUB_BASE_REF:+PR}"$(awk -F"/" '{print $3}' <<< ${GITHUB_REF})
181181

182182
- name: checkout code tree
183-
uses: actions/checkout@v3
183+
uses: actions/checkout@v4
184184
with:
185185
fetch-depth: 0
186186
ref: ${{github.event.inputs.ref}}
@@ -192,7 +192,7 @@ jobs:
192192
logfile: "rpmbuild.log"
193193

194194
- name: Archive rpm
195-
uses: actions/upload-artifact@v3
195+
uses: actions/upload-artifact@v4
196196
with:
197197
name: rpms-DE-EL7-${{steps.mkreftag1.outputs.reftag}}${{steps.mkreftag2.outputs.reftag}}-${{steps.mkdatetag.outputs.dtag}}
198198
path: dist/*.rpm
@@ -219,7 +219,7 @@ jobs:
219219
run: echo "::set-output name=reftag::${GITHUB_BASE_REF:+PR}"$(awk -F"/" '{print $3}' <<< ${GITHUB_REF})
220220

221221
- name: checkout code tree
222-
uses: actions/checkout@v3
222+
uses: actions/checkout@v4
223223
with:
224224
fetch-depth: 0
225225
ref: ${{github.event.inputs.ref}}
@@ -231,7 +231,7 @@ jobs:
231231
logfile: "rpmbuild.log"
232232

233233
- name: Archive rpm
234-
uses: actions/upload-artifact@v3
234+
uses: actions/upload-artifact@v4
235235
with:
236236
name: rpms-DE-EL8-${{steps.mkreftag1.outputs.reftag}}${{steps.mkreftag2.outputs.reftag}}-${{steps.mkdatetag.outputs.dtag}}
237237
path: dist/*.rpm

.github/workflows/linters.yaml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ jobs:
1919
runs-on: ubuntu-latest
2020
steps:
2121
- name: checkout code tree
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v4
2323
with:
2424
fetch-depth: 0
2525

26-
- uses: actions/setup-python@v2
26+
- uses: actions/setup-python@v5
2727
with:
2828
python-version: "3.9"
2929
architecture: "x64"
3030

3131
- name: Cache pip
32-
uses: actions/cache@v2
32+
uses: actions/cache@v4
3333
with:
3434
# This path is specific to Ubuntu
3535
path: ~/.cache/pip
@@ -71,17 +71,17 @@ jobs:
7171
runs-on: ubuntu-latest
7272
steps:
7373
- name: checkout code tree
74-
uses: actions/checkout@v2
74+
uses: actions/checkout@v4
7575
with:
7676
fetch-depth: 0
7777

78-
- uses: actions/setup-python@v2
78+
- uses: actions/setup-python@v5
7979
with:
8080
python-version: "3.9"
8181
architecture: "x64"
8282

8383
- name: Cache pip
84-
uses: actions/cache@v2
84+
uses: actions/cache@v4
8585
with:
8686
# This path is specific to Ubuntu
8787
path: ~/.cache/pip
@@ -115,9 +115,25 @@ jobs:
115115
run: |
116116
pylint src/decisionengine/
117117
118+
run_ruff:
119+
name: Run Ruff against code tree
120+
runs-on: ubuntu-latest
121+
steps:
122+
- name: checkout code tree
123+
uses: actions/checkout@v4
124+
125+
- uses: actions/setup-python@v5
126+
with:
127+
python-version: "3.9"
128+
architecture: "x64"
129+
130+
- name: Run Ruff
131+
uses: astral-sh/ruff-action@v3
132+
133+
118134
license-check:
119135
name: Run REUSE to check license compliance
120136
runs-on: ubuntu-latest
121137
steps:
122-
- uses: actions/checkout@v2
123-
- uses: fsfe/reuse-action@v1
138+
- uses: actions/checkout@v4
139+
- uses: fsfe/reuse-action@v5

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ src/decisionengine/framework/version.py
3030
# Usually these files are written by a python script from a template
3131
# before PyInstaller builds the exe, so as to inject date/other infos into it.
3232
*.manifest
33-
*.spec
33+
#*.spec
3434

3535
# Installer logs
3636
pip-log.txt

package/rpm/decisionengine.spec

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
# SPDX-FileCopyrightText: 2017 Fermi Research Alliance, LLC
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
# RPM package for HEPCloud DEcisionengine pre-requisites
5+
6+
# Disable shebang mangling (see GHI#436)
7+
%undefine __brp_mangle_shebangs
8+
9+
# Release Candidates NVR format
10+
#%define release 0.1.rc1
11+
# Official Release NVR format
12+
#%define release 2
13+
14+
%define auto_version %(FULLVER=$(git describe --tag | sed 's/-/_/g'); GVER=$(sed 's/.*_\\\([[:digit:]].*\\\)_/dev\\\1+/g' <<< ${FULLVER}); VER=${FULLVER//_*}; echo ${VER%.*}.$((${VER##*.}+1)).${GVER})
15+
%define auto_release 1
16+
17+
%define version __HCDE_RPM_VERSION__
18+
%define release __HCDE_RPM_RELEASE__
19+
20+
%define decisionengine_home %{_sharedstatedir}/decisionengine
21+
22+
#%define frontend_xml frontend.xml
23+
#%define factory_xml glideinWMS.xml
24+
%define condor_dir %{_localstatedir}/lib/gwms-factory/condor
25+
%define systemddir %{_prefix}/lib/systemd/system
26+
27+
Name: decisionengine
28+
Version: %{version}
29+
Release: %{release}%{?dist}
30+
Summary: HEPCloud DecisionEngine
31+
License: Apache-2.0
32+
URL: http://https://hepcloud.github.io/
33+
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
34+
BuildArch: noarch
35+
Prefix: %{_prefix}
36+
Vendor: Fermilab <None>
37+
38+
#Source: creation/templates/frontend_startup_sl7
39+
#Source1: creation/templates/factory_startup_sl7
40+
41+
BuildRequires: python3 >= 3.9
42+
BuildRequires: python3-devel
43+
BuildRequires: git
44+
BuildRequires: make
45+
BuildRequires: openssl-devel
46+
BuildRequires: gcc
47+
BuildRequires: gcc-c++
48+
BuildRequires: swig
49+
#BuildRequires: python3-setuptools python3-wheel rpm-build
50+
51+
%description
52+
The HEPCloud DecisionEngine provides a simple way to access the Grid, Cloud and HPC
53+
resources through a dynamic HTCondor pool of grid-submitted resources.
54+
It allows resource scheduling for disparate resource providers, including those
55+
which may have a cost or a restricted allocation of cycles.
56+
57+
HEPCloud DecisionEngine is installed via PIP.
58+
These RPMs provide all the pre-requisites and necessary setup.
59+
60+
Code documentation, release notes and install instructions are on github.io:
61+
https://hepcloud.github.io/decisionengine/
62+
63+
#shadow-utils systemd python3.9dist(pip) python3.9dist(setuptools) python3.9dist(wheel) gcc gcc-c++ make python3.9-devel podman glideinwms-vofrontend-core glideinwms-vofrontend-glidein glideinwms-vofrontend-httpd glideinwms-vofrontend-libs glideinwms-userschedd glideinwms-usercollector
64+
65+
66+
%package deps
67+
Summary: The HEPCloud Decision Engine dependencies.
68+
Requires: python3 >= 3.9
69+
# These were form the python packaging
70+
Requires: shadow-utils
71+
Requires: systemd
72+
Requires: python3.9dist(pip)
73+
Requires: python3.9dist(setuptools)
74+
Requires: python3.9dist(wheel)
75+
# end form the python packaging
76+
Requires: postgresql
77+
Requires: postgresql-server
78+
Requires: postgresql-devel
79+
Requires: httpd
80+
Requires: podman
81+
Requires: python3-cryptography
82+
Requires: python3-pip
83+
Requires: gettext
84+
%description deps
85+
This subpackage includes all the RPM dependencied for the HEPCloud Decision Engine Framework.
86+
87+
88+
%package modules-deps
89+
Summary: The HEPCloud Decision Engine Modules dependencies.
90+
Requires: python3 >= 3.9
91+
Requires: decisionengine-deps = %{version}-%{release}
92+
Requires: glideinwms-vofrontend-libs
93+
Requires: glideinwms-vofrontend-glidein
94+
Requires: glideinwms-vofrontend-core
95+
Requires: glideinwms-vofrontend-httpd
96+
# These may actually be on another host
97+
Requires: glideinwms-userschedd
98+
Requires: glideinwms-usercollector
99+
%description modules-deps
100+
This subpackage includes all the RPM dependencied for the HEPCloud Decision Engine Modules.
101+
102+
103+
%prep
104+
%setup -q -n decisionengine
105+
# Apply the patches here if any
106+
#%patch -P 0 -p1
107+
108+
109+
%build
110+
#cp %{SOURCE7} .
111+
#chmod 700 chksum.sh
112+
#./chksum.sh v%{version}-%{release}.osg etc/checksum.frontend "CVS doc .git .gitattributes poolwatcher factory/check* factory/glideFactory* factory/test* factory/manage* factory/stop* factory/tools creation/create_glidein creation/reconfig_glidein creation/info_glidein creation/lib/cgW* creation/web_base/factory*html creation/web_base/collector_setup.sh creation/web_base/condor_platform_select.sh creation/web_base/condor_startup.sh creation/web_base/create_mapfile.sh creation/web_base/singularity_setup.sh creation/web_base/singularity_wrapper.sh creation/web_base/singularity_lib.sh creation/web_base/gconfig.py creation/web_base/glidein_startup.sh creation/web_base/job_submit.sh creation/web_base/local_start.sh creation/web_base/setup_x509.sh creation/web_base/update_proxy.py creation/web_base/validate_node.sh chksum.sh etc/checksum* unittests build"
113+
#./chksum.sh v%{version}-%{release}.osg etc/checksum.factory "CVS doc .git .gitattributes poolwatcher frontend/* creation/reconfig_glidein creation/clone_glidein creation/lib/cgW* creation/web_base/factory*html creation/web_base/collector_setup.sh creation/web_base/condor_platform_select.sh creation/web_base/condor_startup.sh creation/web_base/create_mapfile.sh creation/web_base/singularity_setup.sh creation/web_base/singularity_wrapper.sh creation/web_base/singularity_lib.sh creation/web_base/gconfig.py creation/web_base/glidein_startup.sh creation/web_base/job_submit.sh creation/web_base/local_start.sh creation/web_base/setup_x509.sh creation/web_base/update_proxy.py creation/web_base/validate_node.sh chksum.sh etc/checksum* unittests build creation/lib/matchPolicy*"
114+
115+
%install
116+
rm -rf $RPM_BUILD_ROOT
117+
118+
# Set the Python version
119+
%global __python %{__python3}
120+
121+
# TODO: Check if some of the following are needed
122+
# seems never used
123+
# %define py_ver %(python -c "import sys; v=sys.version_info[:2]; print '%d.%d'%v")
124+
125+
# From http://fedoraproject.org/wiki/Packaging:Python
126+
# Assuming python3_sitelib and python3_sitearch are defined, not supporting RHEL < 7 or old FC
127+
# Define python_sitelib
128+
129+
#Change src_dir in reconfig_Frontend
130+
#sed -i "s/WEB_BASE_DIR *=.*/WEB_BASE_DIR = \"\/var\/lib\/gwms-frontend\/web-base\"/" creation/reconfig_frontend
131+
132+
#Create the RPM startup files (init.d) from the templates
133+
#creation/create_rpm_startup . frontend_initd_startup_template factory_initd_startup_template %{SOURCE1} %{SOURCE6}
134+
135+
# Create some directories
136+
install -d $RPM_BUILD_ROOT%{decisionengine_home}
137+
install -d $RPM_BUILD_ROOT%{_sysconfdir}/decisionengine
138+
install -d $RPM_BUILD_ROOT%{_localstatedir}/log/decisionengine
139+
install -d $RPM_BUILD_ROOT%{_localstatedir}/log/decisionengine/config.d
140+
cp -r config/* %{buildroot}/%{_sysconfdir}/decisionengine/
141+
142+
%clean
143+
rm -rf $RPM_BUILD_ROOT
144+
145+
146+
%pre deps
147+
# Add the "decisionengine" user and group if they do not exist
148+
getent group decisionengine >/dev/null || groupadd -r decisionengine
149+
getent passwd decisionengine >/dev/null || \
150+
useradd -r -g decisionengine -d %{decisionengine_home} \
151+
-c "HEPCloud Decision Engine user" -s /sbin/nologin decisionengine
152+
# If the decisionengine user already exists make sure it is part of decisionengine group
153+
usermod --append --groups decisionengine decisionengine >/dev/null
154+
155+
156+
%post deps
157+
# make sure our home area makes sense since we have a dynamic id
158+
chown decisionengine:decisionengine %{decisionengine_home}
159+
chmod 750 %{decisionengine_home}
160+
161+
# If the decisionengine user already exists make sure it is part of
162+
# the decisionengine group
163+
usermod --append --groups decisionengine decisionengine >/dev/null
164+
165+
# Change the ownership of log and lock dir if they already exist
166+
if [ -d %{_localstatedir}/log/decisionengine ]; then
167+
chown -R decisionengine:decisionengine %{_localstatedir}/log/decisionengine
168+
fi
169+
170+
systemctl daemon-reload
171+
172+
173+
%postun deps
174+
systemctl daemon-reload
175+
176+
177+
%files deps
178+
%defattr(-,decisionengine,decisionengine,-)
179+
%dir %{decisionengine_home}
180+
%dir %{_sysconfdir}/decisionengine
181+
%dir %{_sysconfdir}/decisionengine/config.d
182+
%config(noreplace) %{_sysconfdir}/decisionengine/decision_engine.jsonnet
183+
# add all files in config.d
184+
%attr(-, decisionengine, decisionengine) %dir %{_localstatedir}/log/decisionengine
185+
186+
%files modules-deps

0 commit comments

Comments
 (0)