Skip to content

Commit

Permalink
Merge pull request #31 from KVSlab/johannr/add-ci-and-tests
Browse files Browse the repository at this point in the history
Add tests and CI
  • Loading branch information
keiyamamo authored Aug 25, 2023
2 parents 116ed1d + 5f2c50b commit e96d1a0
Show file tree
Hide file tree
Showing 27 changed files with 19,849 additions and 1,217 deletions.
2 changes: 1 addition & 1 deletion .flake8
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
# https://github.com/PyCQA/flake8/issues/234
[flake8]
ignore = F405, F403, W504, W503
exclude = __init__.py, build
exclude = __init__.py, build, postprocessing_fenics, postprocessing_mesh, postprocessing_h5py
max-line-length = 120
125 changes: 125 additions & 0 deletions .github/workflows/check_and_test_package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Borrowed from VaMPy
# Original Workflow File: https://github.com/KVSlab/VaMPy/blob/master/.github/workflows/check_and_test_package.yml
# Description: Check and test the code of FSIPy

name: CI

on:
push:
# The CI is executed on every push on every branch
branches:
- master
pull_request:
# The CI is executed on every pull request to the main branch
branches:
- master
schedule:
# The CI is executed every day at 4am
- cron: "0 4 * * *"

env:
CACHE_NUMBER: 0 # Increase to reset cache

jobs:
check-code:
name: Check code
runs-on: ubuntu-latest

continue-on-error: true

steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Upgrade pip and setuptools
run: python3 -m pip install pip setuptools --upgrade

- name: Checkout code
uses: actions/checkout@v3

- name: Install types-paramiko
run: python3 -m pip install types-paramiko

- name: Install FSIPy
run: python3 -m pip install .[test]

- name: Check code with Flake8
run: python3 -m flake8

- name: Check code with mypy
run: python3 -m mypy

test-code:
needs: check-code
strategy:
matrix:
include:
- os: ubuntu-latest
label: linux-64
prefix: /usr/share/miniconda3/envs/fsipy
- os: macos-latest
label: osx-64
prefix: /Users/runner/miniconda3/envs/fsipy

name: Test FSIPy on ${{ matrix.label }}
runs-on: ${{ matrix.os }}

# https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
defaults:
run:
shell: bash -l {0}

steps:
- uses: actions/setup-python@v4
with:
python-version: '3.10'

- name: Checkout code
uses: actions/checkout@v3

- name: Upgrade pip and setuptools
run: |
python3 -m pip install pip setuptools --upgrade
# See: https://github.com/marketplace/actions/setup-miniconda
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge
activate-environment: fsipy
use-mamba: true

- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache

- name: Update environment
run: mamba env update -n fsipy -f environment.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Install FSIPy
run: python3 -m pip install .[test]

- name: Run tests
run: python3 -m pytest tests

# FIXME: Uncomment these lines later when we have decided on a package name
#- name: Upload coverage report to codecov
# if: matrix.os == 'ubuntu-latest'
# uses: codecov/codecov-action@v3
# with:
# token: ${{ secrets.CODECOV_TOKEN }}
# files: ./coverage.xml
# fail_ci_if_error: false
# verbose: true

# Original workflow authored by Henrik Kjeldsberg
# Source Repository: https://github.com/KVSlab/VaMPy/
2 changes: 0 additions & 2 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,5 @@ dependencies:
- python >=3.8
- git
- pip:
- cppimport
- git+https://github.com/mikaem/Oasis
- git+https://github.com/KVSlab/VaMPy.git
- git+https://github.com/KVSlab/turtleFSI.git
33 changes: 0 additions & 33 deletions preprocessing_mesh/1xml_to_stl.py

This file was deleted.

54 changes: 0 additions & 54 deletions preprocessing_mesh/2end_cap_remove.py

This file was deleted.

Loading

0 comments on commit e96d1a0

Please sign in to comment.