Skip to content

Merge pull request #333 from a4894z/main #341

Merge pull request #333 from a4894z/main

Merge pull request #333 from a4894z/main #341

Workflow file for this run

name: Run unit tests
on:
workflow_dispatch:
push:
branches:
- main
paths:
- "tests/**"
- "src/tike/**"
- pyproject.toml
- .github/workflows/unit-tests.yml
pull_request:
branches:
- main
paths:
- "tests/**"
- "src/tike/**"
- pyproject.toml
- .github/workflows/unit-tests.yml
jobs:
linux-x86-no-mpi:
runs-on: self-hosted
continue-on-error: true
strategy:
matrix:
python-version:
- "3.10"
- "3.11"
- "3.9"
steps:
- uses: actions/checkout@v3
- run: |
echo ${CUDA_VISIBLE_DEVICES}
echo "CUDA_VERSION=$(nvidia-smi -q | grep "CUDA Version" | sed 's/CUDA Version\s*: //' | sed 's/\.[0-9]*//')" >> "$GITHUB_ENV"
- run: |
conda config --remove channels defaults || true
conda config --add channels conda-forge
conda config --show channels
name: Configure Conda to only use conda-forge
- run: >
conda create --quiet --yes --force
-n tike
--channel conda-forge
--file requirements.txt
pytest
python=${{ matrix.python-version }}
cuda-version=$CUDA_VERSION
name: Create build environment
- run: conda remove -n tike mpi4py --yes --quiet || true
name: Remove MPI from test environment
- run: conda list -n tike
name: List build environment
- run: |
source activate tike
pip install . --no-deps --no-build-isolation
name: Setup and install
- run: |
source activate tike
python tests/print-gpu-info.py
name: Print GPU info
- run: |
source activate tike
export TIKE_TEST_CI
pytest -vs tests
name: Run tests
- run: |
cd tests/result
zip -r9 ../../result.zip .
name: Zip results
- uses: actions/upload-artifact@v3
if: ${{ matrix.python-version == '3.9' }}
with:
path: result.zip
name: Without MPI results
- run: conda remove -n tike --all
name: Clean up environment
linux-x86-with-mpi:
runs-on: self-hosted
continue-on-error: true
strategy:
matrix:
python-version:
- "3.8"
steps:
- uses: actions/checkout@v3
- run: |
echo ${CUDA_VISIBLE_DEVICES}
echo "CUDA_VERSION=$(nvidia-smi -q | grep "CUDA Version" | sed 's/CUDA Version\s*: //' | sed 's/\.[0-9]*//')" >> "$GITHUB_ENV"
- run: |
conda config --remove channels defaults || true
conda config --add channels conda-forge
conda config --show channels
name: Configure Conda to only use conda-forge
- run: >
conda create --quiet --yes --force
-n tike
--channel conda-forge
--file requirements.txt
pytest
python=${{ matrix.python-version }}
'openmpi=*=h*'
mpi4py
cuda-version=$CUDA_VERSION
name: Create build environment
- run: conda list -n tike
name: List build environment
- run: |
source activate tike
pip install . --no-deps --no-build-isolation
name: Setup and install
- run: |
source activate tike
python tests/print-gpu-info.py
name: Print GPU info
- run: |
source activate tike
export OMPI_MCA_opal_cuda_support=true
export TIKE_TEST_CI
mpiexec -n 2 python -m pytest -vs tests
name: Run tests with MPI
- run: |
cd tests/result
zip -r9 ../../result.zip .
name: Zip results
- uses: actions/upload-artifact@v3
with:
path: result.zip
name: MPI results
- run: conda remove -n tike --all
name: Clean up environment