Skip to content

Adaptive ray directions #215

Adaptive ray directions

Adaptive ray directions #215

#separated, as a failed build on a pr should not impact the current status badge
name: Build and test on pull request
on:
pull_request:
branches: [ stable ]
jobs:
#Before testing the code, make sure that it is linted properly
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v3
- name: Install ClangFormat
run: sudo apt-get install -y clang-format
- name: Set up Python
uses: actions/setup-python@v4
- name: Install Python dependencies
run: pip install black flake8
- name: Run linters
uses: wearerequired/lint-action@v2
with:
auto_fix: true
clang_format: true
clang_format_extensions: "c,cc,cpp,h,hpp,tpp"
clang_format_dir: "src/"
clang_format_auto_fix: true
# black: true
# black_extensions: "py"
# black_dir: #ignoring python formatting for now, as the github action does not support multiple directories
# -"src/"
# -"tests/"
# -"magritte/"
# -"docs/"
# black_auto_fix: true
BuildAndTest:
needs: run-linters
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
C-COMPILER: gcc-11
CXX-COMPILER: g++-11
- os: ubuntu-latest
C-COMPILER: gcc
CXX-COMPILER: g++
defaults:
run:
shell: bash -l {0} #necessary for conda
steps:
- name: (linux) install libegl1
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libegl1 libglu1-mesa
#I think these dependencies are all required for gmsh; TODO: remove them after I remove gmsh
# retrying checkout: 3 tries, with 5 seconds wait inbetween
- name: Check out repository code (try 1)
id: checkouttry1
uses: actions/checkout@v3
with: #no ref: thus checks out commit which triggered workflow
submodules: true
ref: ${{ github.ref }} #note: linter might create new commit; that one needs to be tested (github.ref points to branch -> latest commit on branch)
- name: wait 5 s if attempt failed
if: steps.checkouttry1.outcome == 'failure'
run: sleep 5
- name: Check out repository code (try 2)
id: checkouttry2
if: steps.checkouttry1.outcome == 'failure'
uses: actions/checkout@v3
with: #no ref: thus checks out commit which triggered workflow
submodules: true
ref: ${{ github.ref }}
- name: wait 5 s if attempt failed
if: steps.checkouttry2.outcome == 'failure'
run: sleep 5
- name: Check out repository code (try 3)
id: checkouttry3
if: steps.checkouttry2.outcome == 'failure'
uses: actions/checkout@v3
with: #no ref: thus checks out commit which triggered workflow
submodules: true
ref: ${{ github.ref }}
# end retrying checkout
- name: install gmsh
run: |
bash ./dependencies/get_gmsh.sh
echo "$GITHUB_WORKSPACE/dependencies/gmsh/bin/" >> $GITHUB_PATH
#err, relies a bit too much on absolute path for which the script install gmsh
- name: gmsh version
run: gmsh --version
- name: setup python
uses: actions/setup-python@v4
# retrying setting up conda: 3 tries, with 5 seconds wait inbetween
- name: Install conda packages (try 1)
id: setupcondatry1
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: magritte
environment-file: dependencies/conda_env.yml
auto-activate-base: false
miniforge-variant: Mambaforge
channels: conda-forge, defaults
- name: wait 5 s if attempt failed
if: steps.setupcondatry1.outcome == 'failure'
run: sleep 5
- name: Install conda packages (try 2)
id: setupcondatry2
if: steps.setupcondatry1.outcome == 'failure'
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: magritte
environment-file: dependencies/conda_env.yml
auto-activate-base: false
miniforge-variant: Mambaforge
channels: conda-forge, defaults
- name: wait 5 s if attempt failed
if: steps.setupcondatry2.outcome == 'failure'
run: sleep 5
- name: Install conda packages (try 3)
id: setupcondatry3
if: steps.setupcondatry2.outcome == 'failure'
uses: conda-incubator/setup-miniconda@v3
with:
activate-environment: magritte
environment-file: dependencies/conda_env.yml
auto-activate-base: false
miniforge-variant: Mambaforge
channels: conda-forge, defaults
# end retrying conda
- name: build Magritte
run: bash build.sh
env:
CC : ${{ matrix.C-COMPILER }}
CXX: ${{ matrix.CXX-COMPILER }}
#and finally do our tests (located in the benchmarks folder)
- name: run analytic tests
run: pytest --verbose
working-directory: tests/benchmarks/analytic
- name: run numeric tests
run: pytest --verbose
working-directory: tests/benchmarks/numeric