diff --git a/.github/workflows/build_rpm.sh b/.github/workflows/build_rpm.sh new file mode 100644 index 0000000..2e65203 --- /dev/null +++ b/.github/workflows/build_rpm.sh @@ -0,0 +1,3 @@ +cd $HOME/rpmbuild || exit 1 +spectool -g -R SPECS/prometheus-slurm-exporter.spec +rpmbuild -ba SPECS/prometheus-slurm-exporter.spec \ No newline at end of file diff --git a/.github/workflows/go_config.sh b/.github/workflows/go_config.sh new file mode 100644 index 0000000..7bdab82 --- /dev/null +++ b/.github/workflows/go_config.sh @@ -0,0 +1,7 @@ +rm -f go.mod +go get -v -u github.com/prometheus/client_golang/prometheus +go get -v -u github.com/sirupsen/logrus +go get -v -u gopkg.in/alecthomas/kingpin.v2 +go get -v -u github.com/m3db/prometheus_common/log +mkdir -p ${GOPATH}/src/github.com/prometheus/common/log/ +cp -r ${GOPATH}/src/github.com/m3db/prometheus_common/log/* ${GOPATH}/src/github.com/prometheus/common/log/ \ No newline at end of file diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index 3a39443..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,91 +0,0 @@ -name: Prometheus Slurm Exporter - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] - -jobs: - centos8: - runs-on: ubuntu-latest - container: - image: centos:centos8 - - steps: - - uses: actions/checkout@v2 - - name: Install Prerequisites - run: | - dnf install -y rpm-build rpmdevtools redhat-rpm-config make git go - - name: Configure Go Libraries - run: | - export GOPATH=$(pwd) - rm -f go.mod - go get -v -u github.com/prometheus/client_golang/prometheus - go get -v -u github.com/sirupsen/logrus - go get -v -u gopkg.in/alecthomas/kingpin.v2 - go get -v -u github.com/m3db/prometheus_common/log - mkdir -p ${GOPATH}/src/github.com/prometheus/common/log/ - cp -r ${GOPATH}/src/github.com/m3db/prometheus_common/log/* ${GOPATH}/src/github.com/prometheus/common/log/ - - name: Compile Exporter - run: make build - - name: Prepare RPM Environment - run: | - mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp} - echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros - cp README.md ~/rpmbuild/SOURCES - cp LICENSE ~/rpmbuild/SOURCES - cp bin/prometheus-slurm-exporter ~/rpmbuild/SOURCES - cp lib/systemd/prometheus-slurm-exporter.service ~/rpmbuild/SOURCES - cp packages/rpm/*.spec ~/rpmbuild/SPECS - - name: Build RPM - run: | - cd $HOME/rpmbuild - spectool -g -R SPECS/prometheus-slurm-exporter.spec - rpmbuild -ba SPECS/prometheus-slurm-exporter.spec - - name: Upload RPM - uses: actions/upload-artifact@v2 - with: - name: prometheus-slurm-exporter-centos8-latest - path: /github/home/rpmbuild/RPMS/x86_64/*.rpm - centos7: - runs-on: ubuntu-latest - container: - image: centos:centos7 - - steps: - - uses: actions/checkout@v2 - - name: Install Prerequisites - run: | - dnf install -y rpm-build rpmdevtools redhat-rpm-config make git go - - name: Configure Go Libraries - run: | - export GOPATH=$(pwd) - rm -f go.mod - go get -v -u github.com/prometheus/client_golang/prometheus - go get -v -u github.com/sirupsen/logrus - go get -v -u gopkg.in/alecthomas/kingpin.v2 - go get -v -u github.com/m3db/prometheus_common/log - mkdir -p ${GOPATH}/src/github.com/prometheus/common/log/ - cp -r ${GOPATH}/src/github.com/m3db/prometheus_common/log/* ${GOPATH}/src/github.com/prometheus/common/log/ - - name: Compile Exporter - run: make build - - name: Prepare RPM Environment - run: | - mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp} - echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros - cp README.md ~/rpmbuild/SOURCES - cp LICENSE ~/rpmbuild/SOURCES - cp bin/prometheus-slurm-exporter ~/rpmbuild/SOURCES - cp lib/systemd/prometheus-slurm-exporter.service ~/rpmbuild/SOURCES - cp packages/rpm/*.spec ~/rpmbuild/SPECS - - name: Build RPM - run: | - cd $HOME/rpmbuild - spectool -g -R SPECS/prometheus-slurm-exporter.spec - rpmbuild -ba SPECS/prometheus-slurm-exporter.spec - - name: Upload RPM - uses: actions/upload-artifact@v2 - with: - name: prometheus-slurm-exporter-centos7-latest - path: /github/home/rpmbuild/RPMS/x86_64/*.rpm diff --git a/.github/workflows/prep_rpm.sh b/.github/workflows/prep_rpm.sh new file mode 100644 index 0000000..cd95091 --- /dev/null +++ b/.github/workflows/prep_rpm.sh @@ -0,0 +1,7 @@ +mkdir -p ~/rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS,tmp} +echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros +cp README.md ~/rpmbuild/SOURCES +cp LICENSE ~/rpmbuild/SOURCES +cp bin/prometheus-slurm-exporter ~/rpmbuild/SOURCES +cp lib/systemd/prometheus-slurm-exporter.service ~/rpmbuild/SOURCES +cp packages/rpm/*.spec ~/rpmbuild/SPECS \ No newline at end of file diff --git a/.github/workflows/rpm_ci.yml b/.github/workflows/rpm_ci.yml new file mode 100644 index 0000000..74d91ed --- /dev/null +++ b/.github/workflows/rpm_ci.yml @@ -0,0 +1,60 @@ +name: Prometheus Slurm Exporter + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + centos8: + runs-on: ubuntu-latest + container: + image: centos:centos8 + + steps: + - uses: actions/checkout@v2 + - name: Install Prerequisites + run: dnf install -y rpm-build rpmdevtools redhat-rpm-config make git go + - name: Configure Go Libraries + run: | + export GOPATH=$(pwd) + /bin/bash .github/workflows/go_config.sh + - name: Compile Exporter + run: make build + - name: Prepare RPM Environment + run: /bin/bash .github/workflows/prep_rpm.sh + - name: Build RPM + run: /bin/bash .github/workflows/build_rpm.sh + - name: Upload RPM + uses: actions/upload-artifact@v2 + with: + name: prometheus-slurm-exporter-centos8-x86_64-latest + path: /github/home/rpmbuild/RPMS/x86_64/*.rpm + centos7: + runs-on: ubuntu-latest + container: + image: centos:centos7 + + steps: + - uses: actions/checkout@v2 + - name: Install Prerequisites + run: | + yum install -y epel-release + yum update -y + yum install -y rpm-build rpmdevtools redhat-rpm-config make git golang + - name: Configure Go Libraries + run: | + export GOPATH=$(pwd) + /bin/bash .github/workflows/go_config.sh + - name: Compile Exporter + run: make build + - name: Prepare RPM Environment + run: /bin/bash .github/workflows/prep_rpm.sh + - name: Build RPM + run: /bin/bash .github/workflows/build_rpm.sh + - name: Upload RPM + uses: actions/upload-artifact@v2 + with: + name: prometheus-slurm-exporter-centos7-x86_64-latest + path: /github/home/rpmbuild/RPMS/x86_64/*.rpm