Skip to content

Fix release workflow #92

Fix release workflow

Fix release workflow #92

name: Test_with_MFEM_release
on:
pull_request:
types:
- labeled
#push:
# branches: [ test ]
#pull_request:
# branches: [ test ]
# types: [synchronize]
jobs:
build:
if: contains(github.event.pull_request.labels.*.name, 'in-test-with-mfem-release')
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "3.8", "3.9"]
#python-version: ["3.10"]
#os: [ubuntu-latest]
os: [ubuntu-20.04]
# USE_FLAGS : cuda, parallel, libceed
env:
- { USE_FLAGS: "000"}
- { USE_FLAGS: "010"}
include:
- os: macos-latest
python-version: 3.9
env: {USE_FLAGS: "000"}
runs-on: ${{ matrix.os }}
#env: ${{ matrix.env }}
env:
USE_FLAGS: ${{ matrix.env.USE_FLAGS }}
CUDA: "11.5"
SANDBOX: ~/sandbox
steps:
- uses: actions/checkout@v3
# with:
# ref: master_tracking_branch
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
#python -m pip install --upgrade pip setuptools wheel
python -c "import setuptools;print(setuptools.__version__)"
PYTHONLIB=~/sandbox/lib/python${{ matrix.python-version }}/site-packages
mkdir -p $PYTHONLIB
export PYTHONPATH=$PYTHONLIB:$PYTHONPATH
echo "PYTHONPATH:"$PYTHONPATH
pip install six --verbose
if [ "${{matrix.python-version}}" = "3.10" ] ; then
pip install numba numba-scipy --verbose
#pip install scipy
else
pip install numba numba-scipy --verbose
fi
if [ -f requirements.txt ]; then
pip install -r requirements.txt --prefix=~/sandbox --verbose
fi
python -c "import sys;print(sys.path)"
python -c "import numpy;print(numpy.__file__)"
which swig # this default is 4.0.1
pip install swig --prefix=~/sandbox
export PATH=/usr/local/cuda-${CUDA}/bin:~/sandbox/bin:$PATH
which swig
swig -version
if [ "${USE_FLAGS:0:1}" = "1" ] ; then
echo $cuda
source ./ci_scripts/add_cuda_11_5.sh;
fi
if [ "${USE_FLAGS:1:1}" = "1" ] ; then
sudo apt-get install mpich;
sudo apt-get install libmpich-dev;
pip install mpi4py --prefix=~/sandbox
#pip install mpi4py --no-cache-dir --prefix=~/sandbox;
#python -m pip install git+https://github.com/mpi4py/mpi4py
python -c "import mpi4py;print(mpi4py.get_include())";
fi
ls -l $PYTHONLIB
- name: Build
run: |
export PATH=/usr/local/cuda-${CUDA}/bin:~/sandbox/bin:$PATH
PYTHONLIB=~/sandbox/lib/python${{ matrix.python-version }}/site-packages
export PYTHONPATH=$PYTHONLIB:$PYTHONPATH
echo $PATH
echo $PYTHONPATH
echo $SANDBOX
echo "SWIG exe"$(which swig)
if [ "${USE_FLAGS}" = "000" ]; then
# test workflow to manually run swig
python setup.py clean --swig
python setup.py install --ext-only --with-gslib --verbose
python setup.py install --swig --with-gslib --verbose
python setup.py install --skip-ext --skip-swig --with-gslib --verbose
fi
if [ "${USE_FLAGS}" = "010" ]; then
python setup.py install --with-gslib --with-parallel --prefix=$SANDBOX
fi
- name: RUN_EXAMPLES
run: |
export PATH=/usr/local/cuda-${CUDA}/bin:$PATH
PYTHONLIB=~/sandbox/lib/python${{ matrix.python-version }}/site-packages
export PYTHONPATH=$PYTHONLIB:$PYTHONPATH
echo $PATH
echo $PYTHONPATH
echo $SANDBOX
cd test
echo $PATH
echo $PYTHONPATH
if [ "${USE_FLAGS}" = "000" ]; then
python run_examples.py -serial -verbose
fi
if [ "${USE_FLAGS}" = "010" ]; then
which mpicc
python run_examples.py -parallel -verbose -np 2
fi
- name: Generate Artifact
if: always()
run: |
tar -cvzf sandbox.tar.gz test/sandbox
- name: Generate artifact name
if: always()
id: generate-name
run: |
txt=$(python -c "import datetime;print(datetime.datetime.now().strftime('%H_%M_%S_%f'))")
name="test_result_"${txt}"_"${{ github.run_id }}".tar.gz"
echo $name
# (deprecated) echo "::set-output name=artifact::${name}"
echo "artifact=${name}" >> $GITHUB_OUTPUT
- name: Upload Artifact
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ steps.generate-name.outputs.artifact }}
path: sandbox.tar.gz
retention-days: 1