mirror of
				https://github.com/ClusterCockpit/cc-metric-collector.git
				synced 2025-11-04 10:45:06 +01:00 
			
		
		
		
	Add Github Action to build RPM (#14)
* Update SPEC file * Add clean target to Makefile * add rpmbuild action * Add missing build dependency * Fix package name of golang for CentOS8 * Change outputs * Fix file list and build requires * Fix for file list * Also upload SRPM
This commit is contained in:
		
							
								
								
									
										23
									
								
								.github/workflows/rpmbuild.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								.github/workflows/rpmbuild.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
name: Run RPM Build
 | 
			
		||||
on: push
 | 
			
		||||
 | 
			
		||||
jobs:
 | 
			
		||||
  build:
 | 
			
		||||
    runs-on: ubuntu-latest
 | 
			
		||||
    steps:
 | 
			
		||||
    - uses: actions/checkout@v2
 | 
			
		||||
    - uses: TomTheBear/rpmbuild@master
 | 
			
		||||
      id: rpm
 | 
			
		||||
      name: Build RPM package on CentOS8
 | 
			
		||||
      with:
 | 
			
		||||
        spec_file: "./scripts/cc-metric-collector.spec"
 | 
			
		||||
    - name: Save RPM as artifact
 | 
			
		||||
      uses: actions/upload-artifact@v1.0.0
 | 
			
		||||
      with:
 | 
			
		||||
        name: cc-metric-collector RPM CentOS8
 | 
			
		||||
        path: ${{ steps.rpm.outputs.rpm_dir_path }}
 | 
			
		||||
    - name: Save SRPM as artifact
 | 
			
		||||
      uses: actions/upload-artifact@v1.0.0
 | 
			
		||||
      with:
 | 
			
		||||
        name: cc-metric-collector SRPM CentOS8
 | 
			
		||||
        path: ${{ steps.rpm.outputs.source_rpm_path }}
 | 
			
		||||
							
								
								
									
										7
									
								
								Makefile
									
									
									
									
									
								
							
							
						
						
									
										7
									
								
								Makefile
									
									
									
									
									
								
							@@ -4,10 +4,17 @@ all: $(APP)
 | 
			
		||||
 | 
			
		||||
$(APP): metric-collector.go
 | 
			
		||||
	make -C collectors
 | 
			
		||||
	go get
 | 
			
		||||
	go build -o $(APP) metric-collector.go
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	make -C collectors clean
 | 
			
		||||
	rm -f $(APP)
 | 
			
		||||
 | 
			
		||||
fmt:
 | 
			
		||||
	go fmt collectors/*.go
 | 
			
		||||
	go fmt sinks/*.go
 | 
			
		||||
	go fmt receivers/*.go
 | 
			
		||||
	go fmt metric-collector.go
 | 
			
		||||
 | 
			
		||||
.PHONY: clean
 | 
			
		||||
 
 | 
			
		||||
@@ -6,12 +6,14 @@ Summary:        Metric collection daemon from the ClusterCockpit suite
 | 
			
		||||
License:        MIT
 | 
			
		||||
Source0:        %{name}-%{version}.tar.gz
 | 
			
		||||
 | 
			
		||||
BuildRequires:  golang
 | 
			
		||||
BuildRequires:  go-toolset
 | 
			
		||||
# for internal LIKWID installation
 | 
			
		||||
BuildRequires:  wget perl-Data-Dumper
 | 
			
		||||
 | 
			
		||||
Provides:       %{name} = %{version}
 | 
			
		||||
 | 
			
		||||
%description
 | 
			
		||||
A simple web app
 | 
			
		||||
Metric collection daemon from the ClusterCockpit suite
 | 
			
		||||
 | 
			
		||||
%global debug_package %{nil}
 | 
			
		||||
 | 
			
		||||
@@ -20,15 +22,15 @@ A simple web app
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%build
 | 
			
		||||
cd collectors
 | 
			
		||||
make
 | 
			
		||||
go build -v -o %{name}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%install
 | 
			
		||||
install -Dpm 0755 %{name} %{buildroot}%{_bindir}/%{name}
 | 
			
		||||
install -Dpm 0755 config.json %{buildroot}%{_sysconfdir}/%{name}/config.json
 | 
			
		||||
install -Dpm 0755 %{name} %{buildroot}%{_sbindir}/%{name}
 | 
			
		||||
install -Dpm 0600 config.json %{buildroot}%{_sysconfdir}/%{name}/%{name}.json
 | 
			
		||||
install -Dpm 644 scripts/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
 | 
			
		||||
install -Dpm 600 scripts/%{name}.config %{buildroot}%{_sysconfdir}/default/%{name}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%check
 | 
			
		||||
# go test should be here... :)
 | 
			
		||||
@@ -41,9 +43,10 @@ install -Dpm 644 scripts/%{name}.service %{buildroot}%{_unitdir}/%{name}.service
 | 
			
		||||
 | 
			
		||||
%files
 | 
			
		||||
%dir %{_sysconfdir}/%{name}
 | 
			
		||||
%{_bindir}/%{name}
 | 
			
		||||
%{_sbindir}/%{name}
 | 
			
		||||
%{_unitdir}/%{name}.service
 | 
			
		||||
%config(noreplace) %{_sysconfdir}/%{name}/config.json
 | 
			
		||||
%{_sysconfdir}/default/%{name}
 | 
			
		||||
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.json
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
%changelog
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user