1+ name : Test package
2+
3+ on :
4+ push :
5+ # The CI is executed on every push on every branch
6+ branches :
7+ - " **"
8+ pull_request :
9+ # The CI is executed on every pull request to the main branch
10+ branches :
11+ - main
12+
13+ schedule :
14+ # The CI is executed every day at 8am
15+ - cron : " 0 8 * * *"
16+ jobs :
17+ check-code :
18+ # This skips running the test if '[ci skip]' or '[skip ci]' is in the commit message
19+ # if: "!(contains(github.event.head_commit.message, '[ci skip]') || contains(github.event.head_commit.message, '[skip ci]'))"
20+
21+ # Choose which operating system to run on, for more options see:
22+ # https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
23+ runs-on : ubuntu-22.04
24+
25+ steps :
26+ # This action sets the current path to the root of your github repo
27+ - uses : actions/checkout@v3
28+
29+ - uses : actions/setup-python@v4
30+ with :
31+ python-version : ' 3.10'
32+
33+ - name : " Install code"
34+ run : pip install .[test,docs]
35+
36+ - name : Flake8 code
37+ run : flake8 .
38+
39+ - name : Mypy check
40+ run : |
41+ pip install mypy
42+ python -m mypy . --exclude=build
43+
44+ - name : Generate coverage report
45+ run : python -m pytest --cov=mypackage test
46+
47+ - name : Generate html report
48+ run : python -m coverage html
49+
50+ - name : Upload coverage report as artifact
51+ uses : actions/upload-artifact@v3
52+ with :
53+ name : code-coverage-report
54+ path : htmlcov
55+ if-no-files-found : error
56+
57+ test-code :
58+ # This code depends on the result of check-code
59+ needs : check-code
60+ runs-on : ${{ matrix.os }}
61+
62+ strategy :
63+ matrix :
64+ os : [ubuntu-22.04, windows-latest, macos-12]
65+
66+ steps :
67+ - uses : actions/setup-python@v4
68+ with :
69+ python-version : ' 3.10'
70+
71+ - uses : actions/checkout@v3
72+
73+ - name : " Install mypackage"
74+ run : pip install .[test]
75+
76+ - name : Run tests
77+ run : |
78+ python -m pytest test/
0 commit comments