Skip to content

Commit

Permalink
add build rpm for workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
cnangel committed Sep 3, 2023
1 parent d0cbcbc commit 5afa8f0
Show file tree
Hide file tree
Showing 5 changed files with 265 additions and 13 deletions.
170 changes: 170 additions & 0 deletions .github/workflows/release-workflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
---
name: Create Release

on:
push:
# Sequence of patterns matched against refs/tags
tags:
# Push events to matching v*, i.e. v1.0, v20.15.10
- 'v*'

jobs:
basic-build:
name: Basic Build
runs-on: ubuntu-latest
outputs:
our_date: ${{ env.our_date }}
git_hash: ${{ env.git_hash }}
cc_files_hash_id: ${{ env.cc_files_hash_id }}
version_id: ${{ env.version_id }}
package_name: ${{ env.package_name }}
deb_path: ${{ env.deb_path }}
rpm_path: ${{ env.rpm_path }}
steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Set Variables
run: |
version_id=${GITHUB_REF_NAME:1}
package_name=${GITHUB_REPOSITORY##*/}
sha_short=$(git rev-parse --short "$GITHUB_SHA")
cc_hash_id=${{ hashFiles('cello.c') }}
echo "our_date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_ENV
echo "git_hash=$sha_short" >> $GITHUB_ENV
echo "version_id=$version_id" >> $GITHUB_ENV
echo "package_name=$package_name" >> $GITHUB_ENV
echo "cc_files_hash_id=${cc_hash_id:0:10}" >> $GITHUB_ENV
echo "deb_path=debian/artifacts" >> $GITHUB_ENV
echo "rpm_path=rpmbuild/RPMS" >> $GITHUB_ENV
- name: Restore JQ and JO
id: jqjo_cache_restore
uses: actions/cache/restore@v3
with:
path: |
~/.local/bin/jq
~/.local/bin/jo
key: ${{ runner.os }}-jqjo
- name: Install JQ and JO Dependencies
if: steps.jqjo_cache_restore.outputs.cache-hit != 'true'
run: |
sudo apt update
sudo apt install -y jq jo
mkdir -p ~/.local/bin
cp /usr/bin/jq ~/.local/bin
cp /usr/bin/jo ~/.local/bin
- name: Save JQ and JO
id: jqjo_cache_save
uses: actions/cache/save@v3
with:
path: |
~/.local/bin/jq
~/.local/bin/jo
key: ${{ steps.jqjo_cache_restore.outputs.cache-primary-key }}


rpm-build-fc38:
name: Create fc38 Release
runs-on: ubuntu-latest
needs: [basic-build]
outputs:
rpm_packages: ${{ steps.output_info.outputs.rpm_packages }}
env:
our_date: ${{ needs.basic-build.outputs.our_date }}
git_hash: ${{ needs.basic-build.outputs.git_hash }}
version_id: ${{ needs.basic-build.outputs.version_id }}
package_name: ${{ needs.basic-build.outputs.package_name }}
cc_files_hash_id: ${{ needs.basic-build.outputs.cc_files_hash_id }}
deb_path: ${{ needs.basic-build.outputs.deb_path }}
rpm_path: ${{ needs.basic-build.outputs.rpm_path }}

steps:
- name: Checkout Code
uses: actions/checkout@master
- name: Before Build Hook
run: |
sed -i 's#version: 1.0.3#version: ${{ env.version_id }}#' "${{ env.package_name }}.spec"
- name: Restore RPM Cache
id: rpm_cache_restore
uses: actions/cache/restore@v3
with:
path: ${{ env.rpm_path }}
key: ${{ runner.os }}-${{ env.package_name }}-${{ env.version_id }}-${{ env.cc_files_hash_id }}-${{ github.job }}

- if: steps.rpm_cache_restore.outputs.cache-hit != 'true'
name: Build RPM Package
id: rpm_build
uses: cnangel/build-rpm-action@master
with:
docker_image: cnangel/fc38
extra_build_deps: libconfig-devel

- name: Save RPM Cache
id: rpm_cache_save
uses: actions/cache/save@v3
with:
path: |
${{ env.rpm_path }}
key: ${{ steps.rpm_cache_restore.outputs.cache-primary-key }}

- name: Restore JQ and JO
id: jqjo_cache_restore
uses: actions/cache/restore@v3
with:
path: |
~/.local/bin/jq
~/.local/bin/jo
key: ${{ runner.os }}-jqjo

- name: Set Output Info
id: output_info
run: |
export PATH=~/.local/bin:$PATH
echo "rpm_packages=$(find ${{ env.rpm_path }} -name '*.rpm' 2>/dev/null | jo -a | jq -r 'join("'","'")')" >> $GITHUB_OUTPUT
publish-release:
name: Publish Release
runs-on: ubuntu-latest
needs: [rpm-build-fc38, basic-build]
env:
our_date: ${{ needs.basic-build.outputs.our_date }}
git_hash: ${{ needs.basic-build.outputs.git_hash }}
version_id: ${{ needs.basic-build.outputs.version_id }}
package_name: ${{ needs.basic-build.outputs.package_name }}
cc_files_hash_id: ${{ needs.basic-build.outputs.cc_files_hash_id }}
deb_path: ${{ needs.basic-build.outputs.deb_path }}
rpm_path: ${{ needs.basic-build.outputs.rpm_path }}
fc38_rpm_packages: ${{ needs.rpm-build-fc38.outputs.rpm_packages }}


steps:
- name: Checkout Code
uses: actions/checkout@master

- name: Restore DEB Cache for Ubuntu
uses: actions/cache/restore@v3
with:
path: |
${{ env.deb_path }}
key: ${{ runner.os }}-${{ env.package_name }}-${{ env.version_id }}-${{ env.cc_files_hash_id }}-deb-build
- name: Restore RPM Cache for fc38
uses: actions/cache/restore@v3
with:
path: |
${{ env.rpm_path }}
key: ${{ runner.os }}-${{ env.package_name }}-${{ env.version_id }}-${{ env.cc_files_hash_id }}-rpm-build-fc38

- name: Release ${{ github.ref_name }}
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ github.ref }}
name: Release ${{ github.ref_name }}
body_path: Changes-20230903.md
files: |
README
${{ env.fc38_rpm_packages }}
token: ${{ secrets.SSE_TOKEN }}
draft: false
prerelease: false

24 changes: 11 additions & 13 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
*.bak
blib*
find . -name "*.bak" -print
find . -name .svn -print
Makefile
Makefile.old
Build
_build*
pm_to_blib*
*.tar.gz
.lwpcookies
Build
*.c
Conf-Libconfig-*
cover_db
*.c
*.o
#*.bs
*.bak
Libconfig.bs
Libconfig.c
Libconfig.o
.lwpcookies
Makefile
Makefile.old
MYMETA.json
MYMETA.yml
*.o
pm_to_blib*
stdio2.h.gcov
string3.h.gcov

*.tar.gz
5 changes: 5 additions & 0 deletions Changes-20230903.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Changes in this Release v1.0.3
- Add workflow for github.
- Fix some issues.
- Update general value.

76 changes: 76 additions & 0 deletions Conf-Libconfig.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#
# - Conf-Libconfig -
# This spec file was automatically generated by cpan2rpm [ver: 2.029]
# The following arguments were used:
# Conf-Libconfig-0.08.tar.gz
# For more information on cpan2rpm please visit: http://perl.arix.com/
#
%define _tmppath %{_topdir}/BUILDROOT
%define pkgname Conf-Libconfig
%define filelist %{pkgname}-%{version}-filelist
%define NVR %{pkgname}-%{version}-%{release}
%define maketest 1

name: perl-Conf-Libconfig
summary: Conf-Libconfig - Perl extension for libconfig
version: 1.0.3
release: 1%{?dist}
vendor: Cnangel <[email protected]>
packager: Cnangel <[email protected]>
license: Artistic
group: Applications/CPAN
url: https://github.com/cnangel/Conf-Libconfig
buildroot: %{_tmppath}/%{name}-%{version}-%(id -u -n)
buildarch: x86_64
prefix: %{_prefix}
source: %{name}-%{version}.tar.gz
BuildRequires: perl-bignum gcc perl-CPAN
BuildRequires: perl(Test::Deep) perl(Test::Warn) perl(Test::Exception) perl(ExtUtils::PkgConfig)

%description
You can use `Conf::Libconfig' for perl config, and support Scalar, Array and Hash data structures etc.
like C or C++ function. `Conf::Libconfig' could reduce your config file and quote by C/C++ transportability.

#
# This package was generated automatically with the cpan2rpm
# utility. To get this software or for more information
# please visit: http://perl.arix.com/
#

%prep
%setup -q

%build
perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1
%{make_build}

%check
%if %maketest
%{__make} test
%endif

%install
rm -rf %{buildroot}
%{make_install}


%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}

%files
%defattr(-,root,root)
%doc Changes README
%{perl_archlib}/*
%{_mandir}/man3/*

%changelog
* Sun Sep 03 2023 Cnangel <[email protected]> 1.0.3-1
- Fix some issues.
* Sun Mar 19 2023 Cnangel <[email protected]> 1.0.0-1
- Upgrade version 1.0.0
* Sun Mar 19 2023 Cnangel <[email protected]> 0.200-1
- Update general value.
* Sun May 29 2022 Cnangel <[email protected]> 0.101-1
- Update for libconfig-1.7.3
* Mon Aug 5 2013 [email protected]
- Initial build.
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[![Releasing](https://github.com/cnangel/Conf-Libconfig/actions/workflows/lint.yml/badge.svg)](https://github.com/cnangel/Conf-Libconfig/actions/workflows/release-workflow.yml)
[![Testing](https://github.com/cnangel/Conf-Libconfig/actions/workflows/test.yml/badge.svg)](https://github.com/cnangel/Conf-Libconfig/actions/workflows/test.yml)

Conf-Libconfig

Perl bindings to the C library libconfig
Expand Down

0 comments on commit 5afa8f0

Please sign in to comment.