Merge pull request #2205 from devitocodes/misc-issues #5818
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-core | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
# Trigger the workflow on push or pull request, | |
# but only for the master branch | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
pytest: | |
name: ${{ matrix.name }}-${{ matrix.set }} | |
runs-on: "${{ matrix.os }}" | |
env: | |
DEVITO_ARCH: "${{ matrix.arch }}" | |
DEVITO_LANGUAGE: ${{ matrix.language }} | |
OMP_NUM_THREADS: 2 | |
strategy: | |
# Prevent all build to stop if a single one fails | |
fail-fast: false | |
matrix: | |
name: [ | |
pytest-ubuntu-py311-gcc11-noomp, | |
pytest-ubuntu-py38-gcc12-omp, | |
pytest-ubuntu-py37-gcc7-omp, | |
pytest-ubuntu-py310-gcc10-noomp, | |
pytest-ubuntu-py38-gcc8-omp, | |
pytest-ubuntu-py39-gcc9-omp, | |
pytest-osx-py37-clang-omp, | |
pytest-docker-py39-gcc-omp, | |
pytest-docker-py39-icx-omp | |
] | |
set: [base, adjoint] | |
include: | |
- name: pytest-ubuntu-py311-gcc11-noomp | |
python-version: '3.11' | |
os: ubuntu-22.04 | |
arch: "gcc-11" | |
language: "C" | |
sympy: "1.11" | |
- name: pytest-ubuntu-py38-gcc12-omp | |
python-version: '3.8' | |
os: ubuntu-22.04 | |
arch: "gcc-12" | |
language: "openmp" | |
sympy: "1.10" | |
- name: pytest-ubuntu-py37-gcc7-omp | |
python-version: '3.7' | |
os: ubuntu-20.04 | |
arch: "gcc-7" | |
language: "openmp" | |
sympy: "1.9" | |
- name: pytest-ubuntu-py310-gcc10-noomp | |
python-version: '3.10' | |
os: ubuntu-20.04 | |
arch: "gcc-10" | |
language: "C" | |
sympy: "1.10" | |
- name: pytest-ubuntu-py38-gcc8-omp | |
python-version: '3.8' | |
os: ubuntu-20.04 | |
arch: "gcc-8" | |
language: "openmp" | |
sympy: "1.11" | |
- name: pytest-ubuntu-py39-gcc9-omp | |
python-version: '3.9' | |
os: ubuntu-20.04 | |
arch: "gcc-9" | |
language: "openmp" | |
sympy: "1.9" | |
- name: pytest-osx-py37-clang-omp | |
python-version: '3.7' | |
os: macos-latest | |
arch: "clang" | |
language: "C" | |
sympy: "1.9" | |
- name: pytest-docker-py39-gcc-omp | |
python-version: '3.9' | |
os: ubuntu-latest | |
arch: "gcc" | |
language: "openmp" | |
sympy: "1.12" | |
- name: pytest-docker-py39-icx-omp | |
python-version: '3.9' | |
os: ubuntu-22.04 | |
arch: "icx" | |
language: "openmp" | |
sympy: "1.12" | |
- set: base | |
test-set: 'not adjoint' | |
- set: adjoint | |
test-set: 'adjoint' | |
exclude: | |
- name: pytest-osx-py37-clang-omp | |
set: adjoint | |
steps: | |
- name: Checkout devito | |
uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
if: "!contains(matrix.name, 'docker')" | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Build docker image | |
if: contains(matrix.name, 'docker') | |
run: | | |
docker build . --file docker/Dockerfile.devito --tag devito_img --build-arg base=devitocodes/bases:cpu-${{ matrix.arch }} | |
- name: Set run prefix | |
run: | | |
if [[ "${{ matrix.name }}" =~ "docker" ]]; then | |
echo "RUN_CMD=docker run --rm -e CODECOV_TOKEN=${{ secrets.CODECOV_TOKEN }} --name testrun devito_img" >> $GITHUB_ENV | |
else | |
echo "RUN_CMD=" >> $GITHUB_ENV | |
fi | |
id: set-run | |
- name: Install ${{ matrix.arch }} compiler | |
if: "runner.os == 'linux' && !contains(matrix.name, 'docker')" | |
run : | | |
sudo apt-get install -y ${{ matrix.arch }} | |
- name: Set tests (reduced number for OSX) | |
run : | | |
if [ "${{ runner.os }}" == 'macOS' ]; then | |
echo "TESTS=tests/test_operator.py" >> $GITHUB_ENV | |
else | |
echo "TESTS=tests/" >> $GITHUB_ENV | |
fi | |
id: set-tests | |
- name: Install dependencies | |
if: "!contains(matrix.name, 'docker')" | |
run: | | |
pip install --upgrade pip | |
pip install -e .[tests] | |
pip install sympy==${{matrix.sympy}} | |
- name: Test with pytest | |
run: | | |
${{ env.RUN_CMD }} ${{ matrix.arch }} --version | |
${{ env.RUN_CMD }} python3 --version | |
${{ env.RUN_CMD }} pytest -k "${{ matrix.test-set }}" -m "not parallel" --cov --cov-config=.coveragerc --cov-report=xml ${{ env.TESTS }} | |
- name: Upload coverage to Codecov | |
if: "!contains(matrix.name, 'docker')" | |
uses: codecov/codecov-action@v3 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
name: ${{ matrix.name }} |