Skip to content

Commit

Permalink
Updates to Github Actions to allow building with python3.6
Browse files Browse the repository at this point in the history
  • Loading branch information
gartung committed Mar 11, 2020
1 parent fa8a598 commit 07b555f
Show file tree
Hide file tree
Showing 15 changed files with 206 additions and 132 deletions.
6 changes: 6 additions & 0 deletions .github/actions/pylint-in-sl7-docker/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: 'Run pylint'
description: 'Run pylint in preconfigured SL7 docker image'
inputs:
PYVER:
description: "The python version to build with."
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.PYVER }}
9 changes: 6 additions & 3 deletions .github/actions/pylint-in-sl7-docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -x
#!/bin/bash
export PYVER=$1
echo PYVER=$PYVER
decisionengine/build/scripts/run_pylint.sh
tar cvfj $GITHUB_WORKSPACE/logs.tar.bz2 pep8.*.log pylint.*.log
exit 0
status=$?
tar cvfj $GITHUB_WORKSPACE/logs-$PYVER.tar.bz2 pep8.*.log pylint.*.log
exit $status
6 changes: 6 additions & 0 deletions .github/actions/rpmbuild-in-sl7-docker/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: 'RPM build'
description: 'Run rpm build in preconfigured SL7 docker image'
inputs:
PYVER:
description: "The python version to build with."
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.PYVER }}
11 changes: 7 additions & 4 deletions .github/actions/rpmbuild-in-sl7-docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
#!/bin/bash -x
decisionengine/build/packaging/rpm/package.sh $PWD
tar cvf $GITHUB_WORKSPACE/rpmbuild.tar /var/tmp/root/rpm/decisionengine/*
exit 0
#!/bin/bash
echo PYVER=$1
export PYVER=$1
decisionengine/build/packaging/rpm/package.sh decisionengine
status=$?
tar cf $GITHUB_WORKSPACE/rpmbuild-$PYVER.tar /var/tmp/root/rpm/decisionengine/*
exit $status
6 changes: 6 additions & 0 deletions .github/actions/unittest-in-sl7-docker/action.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
name: 'Unit Tests'
description: 'Run unit tests in preconfigured SL7 docker image'
inputs:
PYVER:
description: "The python version to build with."
required: true
runs:
using: 'docker'
image: 'Dockerfile'
args:
- ${{ inputs.PYVER }}
25 changes: 19 additions & 6 deletions .github/actions/unittest-in-sl7-docker/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,28 @@
#!/bin/bash -x
echo $PWD
#!/bin/bash
export PYVER=$1
echo PYVER=$PYVER
echo PWD=$PWD
export PYTHONPATH=$PWD

[ -d decisionengine/framework/logicengine/cxx/build ] && rm -rf decisionengine/framework/logicengine/cxx/build
OLDWD=$PWD
mkdir decisionengine/framework/logicengine/cxx/build
cd decisionengine/framework/logicengine/cxx/build
cmake3 ..
cmake3 .. -DPYVER=$PYVER
make VERBOSE=1
cd ../../
[ -f RE.so ] && rm RE.so
ln -s cxx/build/ErrorHandler/RE.so
[ -f libLogicEngine.so ] && rm libLogicEngine.so
ln -s cxx/build/ErrorHandler/libLogicEngine.so
export LD_LIBRARY_PATH=$PWD
cd ../../
cd $OLDWD

py.test -v --tb=native > $GITHUB_WORKSPACE/test.log 2>&1
exit 0
if [ "$PYVER" == "3.6" ] ;then
py.test-3 -v --tb=native decisionengine > ./test-$PYVER.log 2>&1
status=$?
else
py.test -v --tb=native decisionengine > ./test-$PYVER.log 2>&1
status=$?
fi
exit $status
58 changes: 35 additions & 23 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,39 @@ jobs:
pylint_job:
runs-on: ubuntu-latest
name: A job to run pylint action
strategy:
matrix:
pyver: ["2.7", "3.6"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
path: 'decisionengine'
id: checkout
- name: Cache venv
uses: actions/cache@v1
with:
path: ./venv
key: ${{ runner.os }}-venv
restore-keys: |
${{ runner.os }}-venv
${{ runner.os }}-
- name: pylint action step
uses: ./.github/actions/pylint-in-sl7-docker
id: pylint
- name: Archive reports
if: always()
uses: actions/upload-artifact@v1
with:
name: reports
path: logs.tar.bz2
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
path: 'decisionengine'
id: checkout
- name: Cache venv
uses: actions/cache@v1
with:
path: ./venv
key: ${{ runner.os }}-${{ matrix.pyver}}-venv
restore-keys: |
${{ runner.os }}-${{ matrix.pyver}}-venv
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ./dependencies
key: ${{ runner.os }}-${{ matrix.pyver}}-deps
restore-keys: |
${{ runner.os }}-${{ matrix.pyver}}-deps
- name: pylint action step
uses: ./.github/actions/pylint-in-sl7-docker
id: pylint
with:
PYVER: ${{ matrix.pyver }}
- name: Archive reports
if: always()
uses: actions/upload-artifact@v1
with:
name: reports
path: logs-${{ matrix.pyver }}.tar.bz2
45 changes: 23 additions & 22 deletions .github/workflows/rpm-build.yaml
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
on:
push:
branches:
- master
tags:
- v*
- 0*
on: [pull_request, push]

jobs:
rpm_build_job:
runs-on: ubuntu-latest
name: A job to build the decision engine rpm
strategy:
matrix:
pyver: ["2.7", "3.6"]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
path: 'decisionengine'
id: checkout
- name: rpm build action step
uses: ./.github/actions/rpmbuild-in-sl7-docker
id: rpm_build
- name: Archive rpm
if: always()
uses: actions/upload-artifact@v1
with:
name: rpms
path: rpmbuild.tar
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
path: 'decisionengine'
id: checkout
- name: rpm build action step
uses: ./.github/actions/rpmbuild-in-sl7-docker
id: rpm_build
with:
PYVER: ${{ matrix.pyver }}
- name: Archive rpm
if: always()
uses: actions/upload-artifact@v1
with:
name: rpms
path: rpmbuild-${{ matrix.pyver }}.tar
41 changes: 27 additions & 14 deletions .github/workflows/unit-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,31 @@ jobs:
unit_test_job:
runs-on: ubuntu-latest
name: A job to run unit tests
strategy:
matrix:
pyver: ["2.7", "3.6"]
fail-fast: false
steps:
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
path: 'decisionengine'
- name: unit test action step
id: unit_test
uses: ./.github/actions/unittest-in-sl7-docker
- name: Archive unittest log
if: always()
uses: actions/upload-artifact@v1
with:
name: test-log
path: test.log
- uses: actions/checkout@v2
- name: Checkout
uses: actions/checkout@v2
with:
path: 'decisionengine'
- name: Cache venv
uses: actions/cache@v1
with:
path: ./venv
key: ${{ runner.os }}-${{ matrix.pyver}}-venv
restore-keys: |
${{ runner.os }}-${{ matrix.pyver}}-venv
- name: unit test action step
id: unit_test
uses: ./.github/actions/unittest-in-sl7-docker
with:
PYVER: ${{ matrix.pyver }}
- name: Archive unittest log
if: always()
uses: actions/upload-artifact@v1
with:
name: test-log
path: test-${{ matrix.pyver }}.log
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -105,3 +105,5 @@ venv.bak/

# Decision Engine modules
modules/

.DS_Store
82 changes: 49 additions & 33 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,35 +1,51 @@
FROM sl:7
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
RUN yum -y install yum-plugin-priorities
RUN yum -y clean all
RUN yum -y install https://repo.opensciencegrid.org/osg/3.4/osg-3.4-el7-release-latest.rpm
RUN yum -y clean all
RUN yum -y install condor-python
RUN yum -y install python-pandas
RUN yum -y install gcc gcc-c++ libgcc
RUN yum -y install python-pip
RUN yum -y install git
RUN yum -y install python-unittest2
RUN yum -y install python-behave
RUN yum -y install tmux
RUN yum -y install cmake
RUN yum -y install boost
RUN yum -y install boost-devel
RUN yum -y install libevent-devel
RUN yum -y install ncurses-devel
RUN yum -y install ipython
RUN yum -y install python-matplotlib
RUN yum -y install python-pytest
RUN yum -y install pytest
RUN yum -y install graphviz.x86_64
RUN yum -y install rpm-build
RUN yum -y install rpm-build-libs
RUN yum -y install rpm-devel
RUN yum -y install mock
RUN yum -y install python-boto3
RUN yum -y install python-psycopg2
RUN yum -y install python-setuptools
RUN easy_install DBUtils
RUN yum -y install cmake3 python3-devel
RUN yum -y clean all
RUN yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm yum-plugin-priorities \
&& yum -y clean all
RUN yum -y install https://repo.opensciencegrid.org/osg/3.4/osg-3.4-el7-release-latest.rpm \
&& yum -y clean all
RUN yum -y install condor-python \
python-pandas \
gcc gcc-c++ libgcc \
python-pip \
git \
python-unittest2 \
python-behave \
tmux \
cmake \
boost \
boost-devel \
libevent-devel \
ncurses-devel \
ipython \
python-matplotlib \
python-pytest \
pytest \
graphviz.x86_64 \
rpm-build \
rpm-build-libs \
rpm-devel \
mock \
python-boto3 \
python-psycopg2 \
python-setuptools \
&& easy_install DBUtils \
&& yum -y install cmake3 python3-devel make \
boost-python36-devel \
python3-devel \
boost-regex \
boost-system \
boost-python-devel \
python-devel \
redhat-lsb-core \
python36-virtualenv \
python-virtualenv \
postgresql-devel \
pytest \
python36-pytest \
python36-tabulate \
python2-tabulate \
python36-pip \
&& pip install --upgrade pip \
&& pip3.6 install argparse WebOb astroid pylint pycodestyle unittest2 coverage sphinx DBUtils pytest mock \
&& yum -y clean all
ENTRYPOINT ["/bin/bash"]
14 changes: 6 additions & 8 deletions build/packaging/rpm/decisionengine.spec
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#%define version __DECISIONENGINE_RPM_VERSION__
#%define release __DECISIONENGINE_RPM_RELEASE__
%define pyver %{getenv:PYVER}
%define version 0.3.10
%define release 1
%define release 1_py%pyver

%define de_user decisionengine
%define de_group decisionengine
Expand All @@ -23,6 +24,7 @@

%define de_python_sitelib $RPM_BUILD_ROOT%{python_sitelib}


Name: decisionengine
Version: %{version}
Release: %{release}
Expand All @@ -36,12 +38,8 @@ Source0: decisionengine.tar.gz

BuildArch: x86_64
BuildRequires: cmake3
#BuildRequires: cmake numpy numpy-f2py python-pandas
BuildRequires: boost-python boost-regex boost-system
#Requires: numpy >= 1.7.1
#Requires: numpy-f2py >= 1.7.1
#Requires: python-pandas >= 0.17.1
Requires: boost-python >= 1.53.0
Requires: boost-python%pyver-devel >= 1.53.0
Requires: boost-python%pyver >= 1.53.0
Requires: boost-regex >= 1.53.0
Requires: boost-system >= 1.53.0
Requires(post): /sbin/service
Expand Down Expand Up @@ -80,7 +78,7 @@ The testcase used to try out the Decision Engine.
pwd
mkdir %{le_builddir}
cd %{le_builddir}
cmake3 ..
cmake3 .. -DPYVER=%pyver
make
[ -e ../../RE.so ] && rm ../../RE.so
[ -e ../../libLogicEngine.so ] && rm ../../libLogicEngine.so
Expand Down
Loading

0 comments on commit 07b555f

Please sign in to comment.