mirror of
https://github.com/ClusterCockpit/cc-metric-collector.git
synced 2024-12-26 07:29:04 +01:00
GitHub actions (#51)
Create new GitHub action which uses unmodified AlmaLinux Docker image
This commit is contained in:
parent
d40163cf8f
commit
a5325a6535
60
.github/workflows/AlmaLinux.yml
vendored
Normal file
60
.github/workflows/AlmaLinux.yml
vendored
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
# See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
|
||||||
|
|
||||||
|
# Workflow name
|
||||||
|
name: AlmaLinux 8.5 RPM build
|
||||||
|
|
||||||
|
# Run on event push
|
||||||
|
on: push
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
|
||||||
|
#
|
||||||
|
# Build on AlmaLinux 8.5 using golang version 1.16
|
||||||
|
#
|
||||||
|
AlmaLinux-RPM-build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
container: almalinux:8.5
|
||||||
|
steps:
|
||||||
|
|
||||||
|
# Use dnf to install development packages
|
||||||
|
- name: Install development packages
|
||||||
|
run: dnf --assumeyes group install "Development Tools" "RPM Development Tools"
|
||||||
|
|
||||||
|
# Checkout git repository and submodules
|
||||||
|
# fetch-depth must be 0 to use git describe
|
||||||
|
# See: https://github.com/marketplace/actions/checkout
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
# Use dnf to install build dependencies
|
||||||
|
- name: Install build dependencies
|
||||||
|
run: dnf --assumeyes builddep scripts/cc-metric-collector.spec
|
||||||
|
|
||||||
|
- name: RPM build MetricCollector
|
||||||
|
id: rpmbuild
|
||||||
|
run: make RPM
|
||||||
|
|
||||||
|
# See: https://github.com/actions/upload-artifact
|
||||||
|
- name: Save RPM as artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: cc-metric-collector RPM AlmaLinux 8.5
|
||||||
|
path: ${{ steps.rpmbuild.outputs.RPM }}
|
||||||
|
- name: Save SRPM as artifact
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: cc-metric-collector SRPM AlmaLinux 8.5
|
||||||
|
path: ${{ steps.rpmbuild.outputs.SRPM }}
|
||||||
|
|
||||||
|
# See: https://github.com/softprops/action-gh-release
|
||||||
|
- name: Release
|
||||||
|
uses: softprops/action-gh-release@v1
|
||||||
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
|
with:
|
||||||
|
name: cc-metric-collector-${{github.ref_name}}
|
||||||
|
files: |
|
||||||
|
${{ steps.rpmbuild.outputs.RPM }}
|
||||||
|
${{ steps.rpmbuild.outputs.SRPM }}
|
36
.github/workflows/runonce.yml
vendored
36
.github/workflows/runonce.yml
vendored
@ -1,46 +1,68 @@
|
|||||||
|
# See: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions
|
||||||
|
|
||||||
|
# Workflow name
|
||||||
name: Run Test
|
name: Run Test
|
||||||
|
|
||||||
|
# Run on event push
|
||||||
on: push
|
on: push
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
#
|
||||||
|
# Job build-1-17
|
||||||
|
# Build on latest Ubuntu using golang version 1.17
|
||||||
|
#
|
||||||
build-1-17:
|
build-1-17:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
# See: https://github.com/marketplace/actions/checkout
|
||||||
|
# Checkout git repository and submodules
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
# See: https://github.com/marketplace/actions/setup-go-environment
|
# See: https://github.com/marketplace/actions/setup-go-environment
|
||||||
- name: Setup Golang
|
- name: Setup Golang
|
||||||
uses: actions/setup-go@v2.1.5
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '^1.17.6'
|
go-version: '^1.17.7'
|
||||||
|
|
||||||
|
# Install libganglia
|
||||||
- name: Setup Ganglia
|
- name: Setup Ganglia
|
||||||
run: sudo apt install ganglia-monitor libganglia1
|
run: sudo apt install ganglia-monitor libganglia1
|
||||||
|
|
||||||
- name: Build MetricCollector
|
- name: Build MetricCollector
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
- name: Run MetricCollector
|
- name: Run MetricCollector once
|
||||||
run: ./cc-metric-collector --once --config .github/ci-config.json
|
run: ./cc-metric-collector --once --config .github/ci-config.json
|
||||||
|
|
||||||
|
#
|
||||||
|
# Job build-1-16
|
||||||
|
# Build on latest Ubuntu using golang version 1.16
|
||||||
|
#
|
||||||
build-1-16:
|
build-1-16:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
# See: https://github.com/marketplace/actions/checkout
|
||||||
|
# Checkout git repository and submodules
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
|
|
||||||
# See: https://github.com/marketplace/actions/setup-go-environment
|
# See: https://github.com/marketplace/actions/setup-go-environment
|
||||||
- name: Setup Golang
|
- name: Setup Golang
|
||||||
uses: actions/setup-go@v2.1.5
|
uses: actions/setup-go@v2
|
||||||
with:
|
with:
|
||||||
go-version: '^1.16.7' # The version AlmaLinux 8.5 uses
|
go-version: '^1.16.7' # The version AlmaLinux 8.5 uses
|
||||||
|
|
||||||
|
# Install libganglia
|
||||||
- name: Setup Ganglia
|
- name: Setup Ganglia
|
||||||
run: sudo apt install ganglia-monitor libganglia1
|
run: sudo apt install ganglia-monitor libganglia1
|
||||||
|
|
||||||
- name: Build MetricCollector
|
- name: Build MetricCollector
|
||||||
run: make
|
run: make
|
||||||
|
|
||||||
- name: Run MetricCollectorlibganglia1
|
- name: Run MetricCollector once
|
||||||
run: ./cc-metric-collector --once --config .github/ci-config.json
|
run: ./cc-metric-collector --once --config .github/ci-config.json
|
||||||
|
30
Makefile
30
Makefile
@ -56,3 +56,33 @@ vet:
|
|||||||
staticcheck:
|
staticcheck:
|
||||||
go install honnef.co/go/tools/cmd/staticcheck@latest
|
go install honnef.co/go/tools/cmd/staticcheck@latest
|
||||||
$$(go env GOPATH)/bin/staticcheck ./...
|
$$(go env GOPATH)/bin/staticcheck ./...
|
||||||
|
|
||||||
|
.ONESHELL:
|
||||||
|
.PHONY: RPM
|
||||||
|
RPM: scripts/cc-metric-collector.spec
|
||||||
|
@WORKSPACE="$${PWD}"
|
||||||
|
@SPECFILE="$${WORKSPACE}/scripts/cc-metric-collector.spec"
|
||||||
|
# Setup RPM build tree
|
||||||
|
@eval $$(rpm --eval "ARCH='%{_arch}' RPMDIR='%{_rpmdir}' SOURCEDIR='%{_sourcedir}' SPECDIR='%{_specdir}' SRPMDIR='%{_srcrpmdir}' BUILDDIR='%{_builddir}'")
|
||||||
|
@mkdir --parents --verbose "$${RPMDIR}" "$${SOURCEDIR}" "$${SPECDIR}" "$${SRPMDIR}" "$${BUILDDIR}"
|
||||||
|
# Create source tarball
|
||||||
|
@COMMITISH="HEAD"
|
||||||
|
@VERS=$$(git describe --tags $${COMMITISH})
|
||||||
|
@VERS=$${VERS#v}
|
||||||
|
@VERS=$${VERS//-/_}
|
||||||
|
@eval $$(rpmspec --query --queryformat "NAME='%{name}' VERSION='%{version}' RELEASE='%{release}' NVR='%{NVR}' NVRA='%{NVRA}'" --define="VERS $${VERS}" "$${SPECFILE}")
|
||||||
|
@PREFIX="$${NAME}-$${VERSION}"
|
||||||
|
@FORMAT="tar.gz"
|
||||||
|
@SRCFILE="$${SOURCEDIR}/$${PREFIX}.$${FORMAT}"
|
||||||
|
@git archive --verbose --format "$${FORMAT}" --prefix="$${PREFIX}/" --output="$${SRCFILE}" $${COMMITISH}
|
||||||
|
# Build RPM and SRPM
|
||||||
|
@rpmbuild -ba --define="VERS $${VERS}" --rmsource --clean "$${SPECFILE}"
|
||||||
|
# Report RPMs and SRPMs when in GitHub Workflow
|
||||||
|
@if [[ "$${GITHUB_ACTIONS}" == true ]]; then
|
||||||
|
@ RPMFILE="$${RPMDIR}/$${ARCH}/$${NVRA}.rpm"
|
||||||
|
@ SRPMFILE="$${SRPMDIR}/$${NVR}.src.rpm"
|
||||||
|
@ echo "RPM: $${RPMFILE}"
|
||||||
|
@ echo "SRPM: $${SRPMFILE}"
|
||||||
|
@ echo "::set-output name=SRPM::$${SRPMFILE}"
|
||||||
|
@ echo "::set-output name=RPM::$${RPMFILE}"
|
||||||
|
@fi
|
||||||
|
@ -55,16 +55,13 @@ $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION): $(BUILD_FOLDER)/likwid-$(LIKWID_VERSIO
|
|||||||
tar -C $(BUILD_FOLDER) -xf $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION).tar.gz
|
tar -C $(BUILD_FOLDER) -xf $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION).tar.gz
|
||||||
|
|
||||||
$(INSTALL_FOLDER)/liblikwid.a: $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION) $(INSTALL_FOLDER)
|
$(INSTALL_FOLDER)/liblikwid.a: $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION) $(INSTALL_FOLDER)
|
||||||
sed -i -e s+"PREFIX ?= .*"+"PREFIX = $(LIKWID_BASE)"+g \
|
cd "$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)" && make "PREFIX=$(LIKWID_BASE)" "SHARED_LIBRARY=false" "ACCESSMODE=$(ACCESSMODE)" "INSTALLED_ACCESSDAEMON=$(DAEMON_INSTALLDIR)/likwid-accessD"
|
||||||
-e s+"SHARED_LIBRARY = .*"+"SHARED_LIBRARY = false"+g \
|
cp \
|
||||||
-e s+"ACCESSMODE = .*"+"ACCESSMODE = $(ACCESSMODE)"+g \
|
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/liblikwid.a \
|
||||||
-e s+"INSTALLED_ACCESSDAEMON = .*"+"INSTALLED_ACCESSDAEMON = $(DAEMON_INSTALLDIR)/likwid-accessD"+g \
|
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/ext/hwloc/liblikwid-hwloc.a \
|
||||||
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/config.mk
|
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/src/includes/likwid*.h \
|
||||||
cd $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION) && make
|
$(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/src/includes/bstrlib.h \
|
||||||
cp $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/liblikwid.a $(INSTALL_FOLDER)
|
$(INSTALL_FOLDER)
|
||||||
cp $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/ext/hwloc/liblikwid-hwloc.a $(INSTALL_FOLDER)
|
|
||||||
cp $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/src/includes/likwid*.h $(INSTALL_FOLDER)
|
|
||||||
cp $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/src/includes/bstrlib.h $(INSTALL_FOLDER)
|
|
||||||
|
|
||||||
$(DAEMON_INSTALLDIR)/likwid-accessD: $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/likwid-accessD
|
$(DAEMON_INSTALLDIR)/likwid-accessD: $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/likwid-accessD
|
||||||
sudo -u $(DAEMON_USER) -g $(DAEMON_GROUP) install -m 4775 $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/likwid-accessD $(DAEMON_INSTALLDIR)/likwid-accessD
|
sudo -u $(DAEMON_USER) -g $(DAEMON_GROUP) install -m 4775 $(BUILD_FOLDER)/likwid-$(LIKWID_VERSION)/likwid-accessD $(DAEMON_INSTALLDIR)/likwid-accessD
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Name: cc-metric-collector
|
Name: cc-metric-collector
|
||||||
Version: 0.2
|
Version: %{VERS}
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: Metric collection daemon from the ClusterCockpit suite
|
Summary: Metric collection daemon from the ClusterCockpit suite
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user