Skip to content

Commit

Permalink
Build and release using AlmaLinux 8 and 9. (#45)
Browse files Browse the repository at this point in the history
- Build and release using AlmaLinux 8 and 9.
- Align Makefile with other repositories.
- Allow long yaml files for GitHub Actions
  • Loading branch information
gwarf authored Mar 28, 2023
1 parent c297886 commit 7aea948
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 62 deletions.
6 changes: 6 additions & 0 deletions .github/linters/.yaml-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
extends: "default"

rules:
line-length:
max: 180
48 changes: 26 additions & 22 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
pull_request:

jobs:
centos7:
build-centos7:
name: Build CentOS 7 RPMs
runs-on: ubuntu-latest
container: quay.io/centos/centos:7
Expand All @@ -25,12 +25,12 @@ jobs:
with:
name: rpms7
path: |
build/RPMS/noarch/bdii-*-1.el7.noarch.rpm
build/RPMS/noarch/bdii-*.el7.noarch.rpm
centos8:
name: Build CentOS Stream 8 RPMs
build-almalinux8:
name: Build AlmaLinux 8 RPMs
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream8
container: almalinux:8
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -47,12 +47,12 @@ jobs:
with:
name: rpms8
path: |
build/RPMS/noarch/bdii-*-1.el8.noarch.rpm
build/RPMS/noarch/bdii-*.el8.noarch.rpm
centos9:
name: Build CentOS Stream 9 RPMs
build-almalinux9:
name: Build AlmaLinux 9 RPMs
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream9
container: almalinux:9
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -69,12 +69,12 @@ jobs:
with:
name: rpms9
path: |
build/RPMS/noarch/bdii-*-1.el9.noarch.rpm
build/RPMS/noarch/bdii-*.el9.noarch.rpm
# XXX Dependency from EPEL: glue-schema
centos7-install:
install-centos7:
name: Install CentOS 7 RPMs
needs: centos7
needs: build-centos7
runs-on: ubuntu-latest
container: quay.io/centos/centos:7
steps:
Expand All @@ -87,28 +87,32 @@ jobs:
yum localinstall -y bdii-*.el7.noarch.rpm
# XXX Dependency from EPEL: glue-schema
# Dependency from PowerTools: openldap-servers
centos8-install:
name: Install CentOS Stream 8 RPMs
needs: centos8
# FIXME: openldap-servers is in CentOS 8 Stream Powertools, but not in AlmaLinux PowerTools
# See https://bugs.almalinux.org/view.php?id=222
# Currently instaling using the package from devel repository
# See https://bugs.almalinux.org/view.php?id=100
# https://repo.almalinux.org/almalinux/8/devel/x86_64/os/Packages/
install-almalinux8:
name: Install AlmaLinux 8 RPMs
needs: build-almalinux8
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream8
container: almalinux:8
steps:
- uses: actions/download-artifact@v3
with:
name: rpms8
- name: Install generated RPMs
run: |
yum install -y epel-release
sed -i 's/^enabled=0/enabled=1/' /etc/yum.repos.d/CentOS-Stream-PowerTools.repo
yum install -y https://repo.almalinux.org/almalinux/8/devel/x86_64/os/Packages/openldap-servers-2.4.46-18.el8.x86_64.rpm
yum localinstall -y bdii-*.el8.noarch.rpm
# XXX Dependencies from EPEL: glue-schema, openldap-servers
centos9-install:
name: Install CentOS Stream 9 RPMs
needs: centos9
install-almalinux9:
name: Install AlmaLinux 9 RPMs
needs: build-almalinux9
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream9
container: almalinux:9
steps:
- uses: actions/download-artifact@v3
with:
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:

jobs:
super-lint:
name: Lint with Supper-Linter
name: Lint with Super-Linter
runs-on: ubuntu-latest

steps:
Expand All @@ -31,5 +31,4 @@ jobs:
# Fail on errors
DISABLE_ERRORS: false
# shellcheck conf
SHELLCHECK_OPTS:
-e SC1090,SC2046,SC2164,SC2166,SC1091,SC2086,SC2001,SC2219,SC2181
SHELLCHECK_OPTS: -e SC1090,SC2046,SC2164,SC2166,SC1091,SC2086,SC2001,SC2219,SC2181
70 changes: 38 additions & 32 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "v*"

jobs:
centos7:
build-centos7:
name: Build centOS 7 RPMs
runs-on: ubuntu-latest
container: quay.io/centos/centos:7
Expand All @@ -29,13 +29,13 @@ jobs:
with:
name: rpms7
path: |
build/RPMS/noarch/bdii-*-1.el7.noarch.rpm
build/SRPMS/bdii-*-1.el7.src.rpm
build/RPMS/noarch/bdii-*.el7.noarch.rpm
build/SRPMS/bdii-*.el7.src.rpm
centos8:
name: Build CentOS Stream 8 RPMs
build-almalinux8:
name: Build AlmaLinux 8 RPMs
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream8
container: almalinux:8
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -51,13 +51,13 @@ jobs:
with:
name: rpms8
path: |
build/RPMS/noarch/bdii-*-1.el8.noarch.rpm
build/SRPMS/bdii-*-1.el8.src.rpm
build/RPMS/noarch/bdii-*.el8.noarch.rpm
build/SRPMS/bdii-*.el8.src.rpm
centos9:
name: Build CentOS Stream 9 RPMs
build-almalinux9:
name: Build AlmaLinux 9 RPMs
runs-on: ubuntu-latest
container: quay.io/centos/centos:stream9
container: almalinux:9
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -73,12 +73,14 @@ jobs:
with:
name: rpms9
path: |
build/RPMS/noarch/bdii-*-1.el9.noarch.rpm
build/SRPMS/bdii-*-1.el9.src.rpm
build/RPMS/noarch/bdii-*.el9.noarch.rpm
build/SRPMS/bdii-*.el9.src.rpm
release7:
name: Upload CentOS 7 release artefacts
needs: centos7
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
needs: build-centos7
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
Expand All @@ -87,8 +89,8 @@ jobs:
- name: Find package name
id: package_name_centos7
run: |
rpm_path=$(find . -name 'bdii-*-1.el7.noarch.rpm')
src_path=$(find . -name 'bdii-*-1.el7.src.rpm')
rpm_path=$(find . -name 'bdii-*.el7.noarch.rpm')
src_path=$(find . -name 'bdii-*.el7.src.rpm')
echo "rpm_path=${rpm_path}" >> "$GITHUB_OUTPUT"
echo "src_path=${src_path}" >> "$GITHUB_OUTPUT"
- name: Attach CentOS 7 RPMs to the release
Expand All @@ -102,51 +104,55 @@ jobs:
${{ steps.package_name_centos7.outputs.src_path }}
release8:
name: Upload CentOS Stream 8 release artefacts
needs: centos8
name: Upload AlmaLinux 8 release artefacts
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
needs: build-almalinux8
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: rpms8
- name: Find package name
id: package_name_centos8
id: package_name_almalinux8
run: |
rpm_path=$(find . -name 'bdii-*-1.el8.noarch.rpm')
src_path=$(find . -name 'bdii-*-1.el8.src.rpm')
rpm_path=$(find . -name 'bdii-*.el8.noarch.rpm')
src_path=$(find . -name 'bdii-*.el8.src.rpm')
echo "rpm_path=${rpm_path}" >> "$GITHUB_OUTPUT"
echo "src_path=${src_path}" >> "$GITHUB_OUTPUT"
- name: Attach CentOS Stream 8 RPMs to the release
- name: Attach AlmaLinux 8 RPMs to the release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fail_on_unmatched_files: true
files: |
${{ steps.package_name_centos8.outputs.rpm_path }}
${{ steps.package_name_centos8.outputs.src_path }}
${{ steps.package_name_almalinux8.outputs.rpm_path }}
${{ steps.package_name_almalinux8.outputs.src_path }}
release9:
name: Upload CentOS Stream 9 release artefacts
needs: centos9
name: Upload AlmaLinux 9 release artefacts
permissions:
contents: write # to upload release asset (softprops/action-gh-release)
needs: build-almalinux9
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: rpms9
- name: Find package name
id: package_name_centos9
id: package_name_almalinux9
run: |
rpm_path=$(find . -name 'bdii-*-1.el9.noarch.rpm')
src_path=$(find . -name 'bdii-*-1.el9.src.rpm')
rpm_path=$(find . -name 'bdii-*.el9.noarch.rpm')
src_path=$(find . -name 'bdii-*.el9.src.rpm')
echo "rpm_path=${rpm_path}" >> "$GITHUB_OUTPUT"
echo "src_path=${src_path}" >> "$GITHUB_OUTPUT"
- name: Attach CentOS Stream 9 RPMs to the release
- name: Attach AlmaLinux 9 RPMs to the release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
fail_on_unmatched_files: true
files: |
${{ steps.package_name_centos9.outputs.rpm_path }}
${{ steps.package_name_centos9.outputs.src_path }}
${{ steps.package_name_almalinux9.outputs.rpm_path }}
${{ steps.package_name_almalinux9.outputs.src_path }}
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ NAME=$(shell grep Name: *.spec | sed 's/^[^:]*:[^a-zA-Z]*//')
VERSION=$(shell grep Version: *.spec | sed 's/^[^:]*:[^0-9]*//')
RELEASE=$(shell grep Release: *.spec | cut -d"%" -f1 | sed 's/^[^:]*:[^0-9]*//')
build=$(shell pwd)/build
DATE=$(shell date "+%a, %d %b %Y %T %z")
dist=$(shell rpm --eval '%dist' | sed 's/%dist/.el5/')
dist=$(shell rpm --eval '%dist')
init_dir=$(shell rpm --eval '%{_initrddir}' || echo '/etc/init.d/')

default:
Expand Down Expand Up @@ -42,7 +41,7 @@ install:
@install -m 0644 LICENSE.txt $(prefix)/usr/share/doc/bdii/

dist:
@mkdir -p $(build)/$(NAME)-$(VERSION)/
@mkdir -p $(build)/$(NAME)-$(VERSION)/
rsync -HaS --exclude ".git" --exclude "$(build)" * $(build)/$(NAME)-$(VERSION)/
cd $(build); tar --gzip -cf $(NAME)-$(VERSION).tar.gz $(NAME)-$(VERSION)/; cd -

Expand All @@ -59,10 +58,10 @@ prepare: dist
cp $(NAME).spec $(build)/SPECS

srpm: prepare
rpmbuild -bs --define="dist ${dist}" --define='_topdir ${build}' $(build)/SPECS/$(NAME).spec
rpmbuild -bs --define="dist $(dist)" --define="_topdir $(build)" $(build)/SPECS/$(NAME).spec

rpm: srpm
rpmbuild --rebuild --define='_topdir ${build}' --define="dist ${dist}" $(build)/SRPMS/$(NAME)-$(VERSION)-$(RELEASE)$(dist).src.rpm
rpmbuild --rebuild --define="dist $(dist)" --define="_topdir $(build)" $(build)/SRPMS/$(NAME)-$(VERSION)-$(RELEASE)$(dist).src.rpm

clean:
rm -f *~ $(NAME)-$(VERSION).tar.gz
Expand Down

0 comments on commit 7aea948

Please sign in to comment.