Skip to content

Commit

Permalink
Switch to matrix build
Browse files Browse the repository at this point in the history
  • Loading branch information
guyzsarun committed Sep 20, 2023
1 parent e7e3534 commit 69ff566
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 50 deletions.
80 changes: 42 additions & 38 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ env:

jobs:
build:
name: Build
strategy:
matrix:
version: [8, 9]
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
Expand All @@ -21,52 +23,54 @@ jobs:
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
file: docker/Dockerfile.rpm
tags: ${{ env.BASE_TAG }}
build-args: |
IMAGE_TAG =${{ matrix.version }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max

test-json:
name: Test JSON Conversion
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
# test-json:
# name: Test JSON Conversion
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Check out Git repository
# uses: actions/checkout@v2

- uses: docker/setup-buildx-action@v2
# - uses: docker/setup-buildx-action@v2

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile
tags: ${{ env.BASE_TAG }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Build Docker image
# uses: docker/build-push-action@v4
# with:
# context: .
# file: docker/Dockerfile
# tags: ${{ env.BASE_TAG }}
# load: true
# cache-from: type=gha
# cache-to: type=gha,mode=max

- name: Unit test
run: |
docker run --rm ${{ env.BASE_TAG }} python3 -m pytest -v
# - name: Unit test
# run: |
# docker run --rm ${{ env.BASE_TAG }} python3 -m pytest -v

test-rpm:
name: Package RPM
needs: build
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v2
# test-rpm:
# name: Package RPM
# needs: build
# runs-on: ubuntu-latest
# steps:
# - name: Check out Git repository
# uses: actions/checkout@v2

- uses: docker/setup-buildx-action@v2
# - uses: docker/setup-buildx-action@v2

- name: Build Docker image
uses: docker/build-push-action@v4
with:
context: .
file: docker/Dockerfile.rpm
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
# - name: Build Docker image
# uses: docker/build-push-action@v4
# with:
# context: .
# file: docker/Dockerfile.rpm
# load: true
# cache-from: type=gha
# cache-to: type=gha,mode=max

34 changes: 22 additions & 12 deletions docker/Dockerfile.rpm
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
FROM almalinux:8
ARG IMAGE_TAG=8
FROM almalinux:$IMAGE_TAG

MAINTAINER Sarun Nuntaviriyakul <sarun.nuntaviriyakul@cern.ch>
LABEL org.opencontainers.image.source https://github.com/guyzsarun/xrootd-cmsjson

WORKDIR /xrootd

ARG IMAGE_TAG=8
RUN yum -y update && \
yum install -y dnf \
https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm \
https://repo.opensciencegrid.org/osg/3.6/osg-3.6-el8-release-latest.rpm \
yum install -y \
dnf \
https://repo.opensciencegrid.org/osg/3.6/osg-3.6-el${IMAGE_TAG}-release-latest.rpm \
epel-release

RUN dnf group install -y "Development Tools"

# CMS TFC dependency
RUN yum install -y cmake \
wget \
xrootd \
python3-devel \
python3-xrootd \
xrootd-devel \
pcre-devel \
xerces-c-devel \
xrootd-devel \
https://cbs.centos.org/kojifiles/packages/jsoncpp/1.9.4/4.el8s/x86_64/jsoncpp-1.9.4-4.el8s.x86_64.rpm \
https://cbs.centos.org/kojifiles/packages/jsoncpp/1.9.4/4.el8s/x86_64/jsoncpp-devel-1.9.4-4.el8s.x86_64.rpm
xrootd-devel

RUN yum install -y --enablerepo=osg-contrib \
jsoncpp \
jsoncpp-devel

COPY . .

RUN mkdir -p /root/rpmbuild/SOURCES
RUN tar -zvcf /root/rpmbuild/SOURCES/xrootd-cmstfc.tar.gz --transform s/xrootd/xrootd-cmstfc-2.0.0/ ../xrootd
# RUN mkdir -p /root/rpmbuild/SOURCES
# RUN tar -zvcf /root/rpmbuild/SOURCES/xrootd-cmstfc.tar.gz --transform s/xrootd/xrootd-cmstfc-2.0.0/ ../xrootd

# RUN rpmbuild -bb spec/xrootd-cmstfc.spec

# RUN yum install -y /root/rpmbuild/RPMS/x86_64/xrootd-cmstfc-2.0.0-1.el8.x86_64.rpm

RUN rpmbuild -bb spec/xrootd-cmstfc.spec
RUN mkdir -p build
RUN cd build && \
cmake .. -DBUILD_TEST=true && \
make && \
make install

RUN yum install -y /root/rpmbuild/RPMS/x86_64/xrootd-cmstfc-2.0.0-1.el8.x86_64.rpm

0 comments on commit 69ff566

Please sign in to comment.