-
Notifications
You must be signed in to change notification settings - Fork 60
111 lines (105 loc) · 3.63 KB
/
python-package.yml
File metadata and controls
111 lines (105 loc) · 3.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Python package
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
schedule:
- cron: "0 11 * * 1"
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9, 3.11]
os : ["ubuntu-latest", "macos-15-intel", "macos-latest"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
activate-environment: fermipy
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Install
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install pylint pytest pytest-cov
python -c "import fermipy; print(fermipy.get_st_version())"
- name: Lint with pylint
shell: bash -l {0}
run: |
# stop the build if there are Python syntax errors or undefined names
#pylint --reports=no --errors-only fermipy
# stp the build if there are a lot of messages
#pylint --reports=no --fail-under=9.5 fermipy
# exit-zero treats all errors as warnings.
pylint --exit-zero fermipy
- name: Test with pytest and codecov
shell: bash -l {0}
run: |
python -m pytest --cov=./fermipy --cov-report=xml fermipy
# if: runner.os == 'macOS'
# - name: Test with pytest without codecov
# shell: bash -l {0}
# run: |
# python -m pytest fermipy
# if: runner.os != 'macOS'
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required
build-dev:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.11]
os : ["ubuntu-latest", "macos-15-intel", "macos-latest"]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: conda-incubator/setup-miniconda@v3
with:
miniforge-variant: Miniforge3
activate-environment: fermipy
environment-file: environment-dev.yml
python-version: ${{ matrix.python-version }}
auto-activate: false
- name: Install
shell: bash -l {0}
run: |
python -m pip install --upgrade pip
python -m pip install pylint pytest pytest-cov
python -c "import fermipy; print(fermipy.get_st_version())"
- name: Lint with pylint
shell: bash -l {0}
run: |
# stop the build if there are Python syntax errors or undefined names
#pylint --reports=no --errors-only fermipy
# stp the build if there are a lot of messages
#pylint --reports=no --fail-under=9.5 fermipy
# exit-zero treats all errors as warnings.
pylint --exit-zero fermipy
- name: Test with pytest and codecov
shell: bash -l {0}
run: |
python -m pytest --cov=./fermipy --cov-report=xml fermipy
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
files: ./coverage.xml
flags: unittests
env_vars: OS,PYTHON
name: codecov-umbrella
fail_ci_if_error: true
token: ${{ secrets.CODECOV_TOKEN }} # required