Skip to content

Commit

Permalink
Moving automated tests from Travis to Github Actions (#285)
Browse files Browse the repository at this point in the history
* Create test.yml for automated testing with Github Actions triggered on pull requests
  • Loading branch information
daurer authored Feb 3, 2021
1 parent 8a59dec commit 33fed02
Show file tree
Hide file tree
Showing 2 changed files with 92 additions and 4 deletions.
18 changes: 14 additions & 4 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -1,10 +1,20 @@
[run]
omit =
ptypy/core/data_old.py
ptypy/core/xy_old.py
ptypy/engines/ML_old.py
ptypy/experiment/I13DLS_legacy.py
ptypy/experiment/ALS_5321.py
ptypy/experiment/AMO_LCLS.py
ptypy/experiment/DiProI_FERMI.py
ptypy/experiment/ID16Anfp.py
ptypy/experiment/UCL.py
ptypy/experiment/cSAXS.py
ptypy/experiment/legacy/*
ptypy/experiment/spec.py
ptypy/experiment/optiklabor.py
ptypy/experiment/plugin.py
ptypy/experiment/savu.py
ptypy/core/pattern.py
ptypy/test/*
ptypy/debug/*
ptypy/resources/*
[report]
exclude_lines =
pragma: no cover
Expand Down
78 changes: 78 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: ptypy automated test workflow

on:
# Trigger the workflow on push or pull request,
# but only for the main branch
push:
branches:
- master
pull_request:
branches:
- master
- pycuda
# Also trigger on page_build, as well as release created events
page_build:
release:
types: # This configuration does not affect the page_build event above
- created

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
max-parallel: 5

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Add conda to system path
run: |
# $CONDA is an environment variable pointing to the root of the miniconda directory
echo $CONDA/bin >> $GITHUB_PATH
- name: Install dependencies
run: |
conda env update --file ptypy_core_dependencies.yml --name base
- name: Prepare ptypy
run: |
# Dry install to create ptypy/version.py
python setup.py install -n
# - name: Lint with flake8
# run: |
# conda install flake8
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
conda install pytest
conda install pytest-cov
# pytest ptypy/test --doctest-modules --junitxml=junit/test-results.xml --cov=ptypy --cov-report=xml --cov-report=html --cov-config=.coveragerc
pytest
# - name: cobertura-report
# if: github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened' || github.event.action == 'synchronize')
# uses: 5monkeys/cobertura-action@v7
# with:
# # The GITHUB_TOKEN for this repo
# repo_token: ${{ secrets.GITHUB_TOKEN }}
# # Path to the cobertura file.
# path: coverage.xml
# # If files with 100% should be skipped from report.
# skip_covered: true
# # Minimum allowed coverage percentage as an integer.
# minimum_coverage: 90
# only_changed_files: true
# - name: Junit Report to Annotations
# uses: ashley-taylor/junit-report-annotations-action@master
# with:
# # github token
# access-token: ${{ secrets.GITHUB_TOKEN }}
# # glob to junit xml files
# path: junit/test-results.xml
# # include summary annotation
# includeSummary: true
# # max number of failed tests to include
# numFailures: 10

0 comments on commit 33fed02

Please sign in to comment.