Coverage test #638
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: Coverage test | |
defaults: | |
run: | |
shell: bash | |
env: | |
CFLAGS: -Og | |
on: | |
pull_request: | |
# all pull-requests on to main | |
branches: [main] | |
schedule: | |
# only once every 4 days | |
# We can always force run this. | |
- cron: '37 10 */4 * *' | |
workflow_dispatch: | |
inputs: | |
branch: | |
description: 'Which branch to test' | |
required: false | |
default: 'main' | |
marks: | |
description: 'Which marks to test' | |
required: false | |
default: '' | |
jobs: | |
# Define a few jobs that can be runned | |
check_schedule: | |
if: ${{ github.event_name == 'schedule' }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.inputs.branch }}' | |
- run: test -n $(git rev-list --after="1 week" --max-count=1 ${{ github.sha }}) | |
test_runs: | |
needs: [check_schedule] | |
if: ${{ always() && (contains(needs.*.result, 'success') || contains(needs.*.result, 'skipped')) }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: ['3.8', '3.11'] | |
steps: | |
- name: Checkout sisl | |
uses: actions/checkout@v4 | |
with: | |
ref: '${{ github.event.inputs.branch }}' | |
# The files submodule is required for tests purposes | |
submodules: true | |
# the 'files' submodule uses lfs | |
lfs: true | |
- name: Print-out commit information | |
run: | | |
echo "branch: ${{ github.event.inputs.branch }}" | |
echo "hash: ${{ github.sha }}" | |
echo "python-version: ${{ matrix.python-version }}" | |
# This should generally not be required, but in the end it is just easier | |
- name: Ensure system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install gcc gfortran | |
- name: Python installation | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install sisl + dependencies | |
run: | | |
python -m pip install --progress-bar=off --upgrade pip | |
python -m pip install --progress-bar=off Cython "scikit-build-core[pyproject]" | |
python -m pip install --progress-bar=off -r ci/requirements.txt -r ci/requirements-viz.txt -r requirements.txt | |
CC=gcc FC=gfortran python -m pip install -vvv . | |
- name: Running sisl tests | |
env: | |
SISL_FILES_TESTS: ${{ github.workspace }}/files/tests | |
run: | | |
# This needs to be done in a separate folder | |
# Otherwise the import will try to use the one in the current folder | |
mkdir sisl-test-dir ; cd sisl-test-dir | |
if [[ "${{ github.event.inputs.marks }}" == "" ]]; then | |
ADD_FLAGS="" | |
else | |
ADD_FLAGS="-m ${{ github.event.inputs.marks }}" | |
fi | |
# --cov forces the reading of .coveragerc | |
ADD_TOOLS="" | |
for tool in btd models ; do | |
ADD_TOOLS="$ADD_TOOLS sisl_toolbox.$tool" | |
done | |
for tool in atom minimizer ; do | |
ADD_TOOLS="$ADD_TOOLS sisl_toolbox.siesta.$tool" | |
done | |
for tool in poisson ; do | |
ADD_TOOLS="$ADD_TOOLS sisl_toolbox.transiesta.$tool" | |
done | |
py.test -vv -rX --cov --cov-report term-missing --cov-report xml --cov-config=../.coveragerc $ADD_FLAGS --pyargs sisl $ADD_TOOLS | |
#cp coverage.xml ../ | |
- name: Upload code-coverage | |
if: ${{ github.event.inputs.marks == '' }} | |
uses: codecov/codecov-action@v3 | |
with: | |
directory: ./sisl-test-dir/ | |
verbose: true |