Skip to content

Commit

Permalink
Add test-rpmbuild Makefile target
Browse files Browse the repository at this point in the history
This adds a Containerfile.rpmbuild file in order to test
the new spec file in a centos container.
  • Loading branch information
cfergeau authored and guillaumerose committed Mar 23, 2021
1 parent ba106f5 commit 47e644b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
- run:
name: Build driver binary
command: make CONTAINER_RUNTIME="docker"
- run:
name: Test RPM build
command: make CONTAINER_RUNTIME="docker" test-rpmbuild
- store_artifacts:
path: ~/work/crc-driver-libvirt-centos8
destination: crc-driver-libvirt
Expand Down
10 changes: 10 additions & 0 deletions Containerfile.rpmbuild
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM registry.centos.org/centos
WORKDIR $APP_ROOT/src
RUN yum -y install git-core rpm-build dnf-plugins-core 'dnf-command(builddep)'
COPY . .
RUN mkdir -p ~/rpmbuild/SOURCES/ && \
export VERSION=$(rpmspec -q --qf %{Version} --srpm crc-driver-libvirt.spec) && \
git archive --format=tar --prefix=machine-driver-libvirt-${VERSION}/ HEAD | gzip >~/rpmbuild/SOURCES/machine-driver-libvirt-${VERSION}.tar.gz
RUN yum config-manager --set-enabled powertools && \
yum -y builddep crc-driver-libvirt.spec && \
rpmbuild -bb -v crc-driver-libvirt.spec
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,12 @@ vendor:
go mod tidy
go mod vendor

.PHONY: spec
.PHONY: spec test-rpmbuild
spec: crc-driver-libvirt.spec

test-rpmbuild: spec
${CONTAINER_RUNTIME} build -f Containerfile.rpmbuild .

$(gopath)/bin/gomod2rpmdeps:
(cd /tmp && GO111MODULE=on go get github.com/cfergeau/gomod2rpmdeps/cmd/gomod2rpmdeps)

Expand Down

0 comments on commit 47e644b

Please sign in to comment.