Skip to content

Commit 380a28d

Browse files
committed
Add rpm build step to the PR check
Github workflow allow us to build rpm artefact and that helps with testing. Current spec file is replaced by adjusted Fedora spec. Running rpm build in Fedora container has some issues with git therefore here is one extra step to create tar artefact to workaround this obstacle.
1 parent e14fbb9 commit 380a28d

File tree

2 files changed

+111
-31
lines changed

2 files changed

+111
-31
lines changed

.github/workflows/check-pr.yml

Lines changed: 66 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,74 @@ jobs:
88
- name: Checkout
99
uses: actions/checkout@v4
1010
- name: Set up Python environment
11-
uses: actions/setup-python@v4
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version: "3.11"
1214
- name: Run flake8
1315
uses: py-actions/flake8@v2
1416
with:
1517
max-line-length: "100"
1618
path: "."
19+
20+
create-archive:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
- name: Create archive
26+
run: |
27+
set -x
28+
APP_VERSION=`grep -i '^version:' rpm/keycloak-httpd-client-install.spec | sed 's/.* //g'`
29+
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
30+
git archive --format=tar.gz --prefix=keycloak-httpd-client-install-$APP_VERSION/ HEAD >keycloak-httpd-client-install-$APP_VERSION.tar.gz
31+
echo "APP_VERSION=$APP_VERSION" >> "$GITHUB_ENV"
32+
- name: Upload tar archive
33+
uses: actions/upload-artifact@v4
34+
with:
35+
name: tar
36+
path: keycloak-httpd-client-install-*.tar.gz
37+
retention-days: 30
38+
39+
build-fedora-rpm:
40+
runs-on: ubuntu-latest
41+
container: fedora:latest
42+
needs: create-archive
43+
steps:
44+
- name: Download tar
45+
uses: actions/download-artifact@v4
46+
with:
47+
name: tar
48+
- name: Build rpm
49+
run: |
50+
set -x
51+
dnf -y install rpm-build python3-devel python3-setuptools
52+
rpmbuild -D "release_string $GITHUB_SHA" -D "_rpmdir $(pwd)/rpmbuild" -ta keycloak-httpd-client-install-*.tar.gz
53+
find ./rpmbuild -name '*.rpm' -exec mv {} ./ \;
54+
- name: Upload rpms
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: fedora-rpms
58+
path: "*.rpm"
59+
retention-days: 30
60+
61+
build-el-rpm:
62+
runs-on: ubuntu-latest
63+
container: rockylinux:9
64+
needs: create-archive
65+
steps:
66+
- name: Download tar
67+
uses: actions/download-artifact@v4
68+
with:
69+
name: tar
70+
- name: Build rpm
71+
run: |
72+
set -x
73+
dnf -y install rpm-build python3-devel python3-setuptools
74+
rpmbuild -D "release_string $GITHUB_SHA" -D "_rpmdir $(pwd)/rpmbuild" -ta keycloak-httpd-client-install-*.tar.gz
75+
find ./rpmbuild -name '*.rpm' -exec mv {} ./ \;
76+
- name: Upload rpms
77+
uses: actions/upload-artifact@v4
78+
with:
79+
name: el-rpms
80+
path: "*.rpm"
81+
retention-days: 30
Lines changed: 45 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,35 @@
11
%global srcname keycloak-httpd-client-install
22
%global summary Tools to configure Apache HTTPD as Keycloak client
33

4-
%if 0%{?fedora}
5-
%global with_python3 1
4+
%if (0%{?fedora} > 0 && 0%{?fedora} < 30) || (0%{?rhel} > 0 && 0%{?rhel} <= 7)
5+
%bcond_without python2
6+
%bcond_without python3
7+
%endif
8+
9+
%if 0%{?fedora} >= 30 || 0%{?rhel} >= 8
10+
%bcond_with python2
11+
%bcond_without python3
612
%endif
713

814
Name: %{srcname}
9-
Version: 0.4
10-
Release: 1%{?dist}
15+
Version: 1.2
16+
Release: %{?release_string}%{!?release_string: 1}%{?dist}
1117
Summary: %{summary}
1218

13-
%global git_tag RELEASE_%(r=%{version}; echo $r | tr '.' '_')
14-
15-
License: GPLv3
16-
URL: https://github.com/jdennis/keycloak-httpd-client-install
17-
Source0: https://github.com/jdennis/keycloak-httpd-client-install/archive/%{git_tag}.tar.gz#/%{srcname}-%{version}.tar.gz
1819

20+
License: GPL-3.0-or-later
21+
URL: https://github.com/lachset/keycloak-httpd-client-install
22+
Source0: https://github.com/lachset/keycloak-httpd-client-install/releases/download/%{version}/keycloak-httpd-client-install-%{version}.tar.gz
1923
BuildArch: noarch
2024

25+
%if %{with python2}
2126
BuildRequires: python2-devel
27+
%endif
28+
# ^^^ with_python2
29+
2230
%if 0%{?with_python3}
2331
BuildRequires: python3-devel
32+
BuildRequires: (python3-setuptools if python3-devel >= 3.12)
2433
%endif
2534

2635
Requires: %{_bindir}/keycloak-httpd-client-install
@@ -33,21 +42,24 @@ libraries and tools which can automate and simplify configuring an
3342
Apache HTTPD authentication module and registering as a client of a
3443
Keycloak IdP.
3544

45+
%if %{with python2}
3646
%package -n python2-%{srcname}
3747
Summary: %{summary}
3848

3949
%{?python_provide:%python_provide python2-%{srcname}}
4050

4151
Requires: %{name} = %{version}-%{release}
42-
Requires: python-requests
43-
Requires: python-requests-oauthlib
44-
Requires: python-jinja2
52+
Requires: python2-requests
53+
Requires: python2-requests-oauthlib
54+
Requires: python2-jinja2
4555
Requires: %{_bindir}/keycloak-httpd-client-install
4656

4757
%description -n python2-%{srcname}
4858
Keycloak is an authentication server. This package contains libraries and
4959
programs which can invoke the Keycloak REST API and configure clients
5060
of a Keycloak server.
61+
%endif
62+
# ^^^ with_python2
5163

5264
%if 0%{?with_python3}
5365
%package -n python3-%{srcname}
@@ -59,6 +71,7 @@ Requires: %{name} = %{version}-%{release}
5971
Requires: python3-requests
6072
Requires: python3-requests-oauthlib
6173
Requires: python3-jinja2
74+
Requires: python3-lxml
6275

6376
%description -n python3-%{srcname}
6477
Keycloak is an authentication server. This package contains libraries and
@@ -68,25 +81,36 @@ of a Keycloak server.
6881
%endif
6982

7083
%prep
71-
%autosetup -n %{srcname}-%{version}
84+
%autosetup -n %{srcname}-%{version} -p1
7285

7386
%build
87+
%if %{with python2}
7488
%py2_build
89+
%endif
90+
# ^^^ with_python2
91+
7592
%if 0%{?with_python3}
7693
%py3_build
7794
%endif
7895

7996
%install
97+
%if %{with python2}
8098
# Must do the python2 install first because the scripts in /usr/bin are
8199
# overwritten with every setup.py install, and in general we want the
82100
# python3 version to be the default.
83101
%py2_install
102+
%endif
103+
# ^^^ with_python2
104+
84105
%if 0%{?with_python3}
85106
# py3_install won't overwrite files if they have a timestamp greater-than
86107
# or equal to the py2 installed files. If both the py2 and py3 builds execute
87108
# quickly the files end up with the same timestamps thus leaving the py2
88109
# version in the py3 install. Therefore remove any files susceptible to this.
110+
%if %{with python2}
89111
rm %{buildroot}%{_bindir}/keycloak-httpd-client-install
112+
%endif
113+
# ^^^ with_python2
90114
%py3_install
91115
%endif
92116

@@ -98,37 +122,28 @@ install -c -m 644 doc/keycloak-httpd-client-install.8 %{buildroot}/%{_mandir}/ma
98122
%doc README.md doc/ChangeLog
99123
%{_datadir}/%{srcname}/
100124

125+
%if %{with python2}
101126
# Note that there is no %%files section for the unversioned python module if we are building for several python runtimes
102127
%files -n python2-%{srcname}
103128
%{python2_sitelib}/*
129+
104130
%if ! 0%{?with_python3}
105131
%{_bindir}/keycloak-httpd-client-install
106132
%{_bindir}/keycloak-rest
107133
%{_mandir}/man8/*
108134
%endif
135+
%endif
136+
# ^^^ with_python2
109137

110138
%if 0%{?with_python3}
111139
%files -n python3-%{srcname}
112140
%{python3_sitelib}/*
113141
%{_bindir}/keycloak-httpd-client-install
142+
%{_bindir}/keycloak-rest
114143
%{_mandir}/man8/*
115144
%endif
116145

117146
%changelog
118-
* Wed Jun 8 2016 John Dennis <[email protected]> - 0.4-1
119-
- new upstream
120-
- add methods to add/remove client redirect URI
121-
- add function to parse SP metadata to extract AssertionConsumerServiceURL's
122-
- Add all AssertionConsumerServiceURL's as redirect URI's during
123-
client registration.
124-
125-
* Fri May 20 2016 John Dennis <[email protected]> - 0.3-1
126-
- new upstream
127-
See ChangeLog for details
128-
129-
* Tue May 17 2016 John Dennis <[email protected]> - 0.2-1
130-
- new upstream
131-
- Add keycloak-httpd-client-install.8 man page
132-
133-
* Fri May 13 2016 John Dennis <[email protected]> - 0.1-1
134-
- Initial version
147+
* Mon Aug 19 2024 Tomas Halman <[email protected]> - 1.2-1
148+
Repository cleanup, preparing for new version
149+
Spec file is adopted from Fedora.

0 commit comments

Comments
 (0)