Skip to content

Merge pull request #273 from Magritte-code/259-scipy-version-incompat… #120

Merge pull request #273 from Magritte-code/259-scipy-version-incompat…

Merge pull request #273 from Magritte-code/259-scipy-version-incompat… #120

# Connected to the status badge
name: Build
on:
push:
branches: [ stable ]
jobs:
#Before doing anything, make sure that the code is linted
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 cpp linter
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
#Before testing, we increase the version number. Otherwise, some delay (>30 mins) may occur between updating the code and doing the version increase.
UpdateVersion:
needs: run-linters
runs-on: ubuntu-latest
steps:
- name: checkout repo
uses: actions/checkout@v3
with:
ref: ${{ github.ref }} #err, version.txt file should not be linted; but still checking out latest commit to be sure
- name: Update version (locally) using commit message to determine version increase
run: echo "NewVersion=$(python updateVersion.py "${{github.event.head_commit.message}}")" >> $GITHUB_ENV
working-directory: CI
- name: Auto commit the version change
uses: test-room-7/action-update-file@v1
with:
file-path: version.txt
commit-msg: "CI: increment version number to ${{env.NewVersion}}"
github-token: ${{ secrets.GITHUB_TOKEN}}
branch: stable
BuildAndTest:
needs: UpdateVersion
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: macos-latest
C-COMPILER: gcc-14
CXX-COMPILER: g++-14
- 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: gsmh 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