Skip to content

Commit

Permalink
Merge 4598ef3 into d5e3e07
Browse files Browse the repository at this point in the history
  • Loading branch information
MSallermann committed Aug 16, 2021
2 parents d5e3e07 + 4598ef3 commit 6746ae7
Show file tree
Hide file tree
Showing 7 changed files with 195 additions and 290 deletions.
122 changes: 0 additions & 122 deletions .appveyor.yml

This file was deleted.

175 changes: 175 additions & 0 deletions .github/workflows/ci.yml
@@ -0,0 +1,175 @@
name: CI

on: [push, pull_request]

jobs:

test:
runs-on: ${{ matrix.os }}
name: test${{ matrix.name-suffix }} (${{ matrix.os }}, ${{ matrix.build-type }})
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build-type: [Release, Debug]
name-suffix: [""]
include:
- build-type: Debug
env:
CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=ON
BUILD_TYPE: ${{ matrix.build-type }}

steps:
- uses: actions/checkout@v2

- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy
- name: 📁 Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build

- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
if [ "${{ matrix.os }}" == "ubuntu-latest" ]
then
export CMAKE_FLAGS="$CMAKE_FLAGS -DOVF_BUILD_FORTRAN_BINDINGS=ON"
fi
cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS
- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2

- name: 🧪 Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -C $BUILD_TYPE -E $EXCLUDETESTS --output-on-failure --verbose

test-coverage:
runs-on: ubuntu-latest
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=ON -DOVF_TEST_COVERAGE=ON

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: 📁 Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build

- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS

- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config Release -j 2

- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install coverage numpy 'coveralls<3' wheel
sudo apt update
sudo apt install lcov
- name: Generate C++ coverage
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
lcov -c -i --no-external --directory . --base-directory $GITHUB_WORKSPACE -o baseline.info
make test
lcov -c --no-external --directory . --base-directory $GITHUB_WORKSPACE -o after_test.info
lcov -a baseline.info -a after_test.info -o total_test.info
lcov -r total_test.info \*thirdparty\* \*/test/\* \*Collection\* \*DLL_\* -o coverage.info
- name: Upload C++ coverage
uses: codecov/codecov-action@v1
with:
files: ${{runner.workspace}}/build/coverage.info

- name: Python API coverage
working-directory: ./python
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
coverage run --source ovf --omit=ovf/ovflib.py setup.py test > cov.txt
head cov.txt
coverage report -m
coverage xml
coveralls
deploy-pypi:
if: github.event_name != 'pull_request'
needs: test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
env:
BUILD_TYPE: Release
CMAKE_FLAGS: -DOVF_BUILD_PYTHON_BINDINGS=ON -DOVF_BUILD_TEST=OFF
OVF_ADD_VERSION_SUFFIX: true

steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Configure environment
shell: bash
if: github.ref == 'refs/heads/master'
run: echo "OVF_ADD_VERSION_SUFFIX=false" >> $GITHUB_ENV

- name: Create build folder
run: cmake -E make_directory ${{runner.workspace}}/build

- name: ⚙ Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE $CMAKE_FLAGS

- name: 🛠 Build
shell: bash
working-directory: ${{runner.workspace}}/build
run: cmake --build . --config $BUILD_TYPE -j 2

- name: Install necessary packages
run: |
python -m pip install --upgrade pip
python -m pip install numpy setuptools wheel twine
- name: Build python package
shell: bash
working-directory: ./python
run: |
echo "Python package build"
echo "Add suffix to ovf version tag for python package $OVF_ADD_VERSION_SUFFIX"
python setup.py sdist bdist_wheel
- name: 🚀 Deploy to TestPyPI
working-directory: ./python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref != 'refs/heads/master'
run: twine upload --skip-existing --repository testpypi dist/*

- name: 🚀 Deploy to PyPI
working-directory: ./python
env:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
if: github.ref == 'refs/heads/master'
run: twine upload --skip-existing dist/*

0 comments on commit 6746ae7

Please sign in to comment.