-
Notifications
You must be signed in to change notification settings - Fork 7
100 lines (86 loc) · 3.67 KB
/
main.yml
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
# 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: unittest with flake8
on: [push, pull_request]
jobs:
build:
strategy:
fail-fast: false
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
install-extras: [0, 1, 2] # TODO(#129): update to replace extra flag
exclude:
- os: "windows-latest"
install-extras: 2
name: Python ${{ matrix.python-version }} on ${{ matrix.os }} with extras ${{ matrix.install-extras }}
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Set CDF Lib environment variable
if: ${{ matrix.install-extras == 2 }}
run: echo "CDF_LIB=$HOME/lib" >> $GITHUB_ENV
- name: Install standard and test dependencies, then ocbpy for SSJ
if: ${{ matrix.install-extras == 2 }}
env:
CDF_LIB: $HOME/lib
run: |
pip install .[test]
bash requirements.extra ${{ matrix.install-extras }}
- name: Install standard and test dependencies, then ocbpy without SSJ
if: ${{ matrix.install-extras != 2 }}
run: |
pip install .[test]
bash requirements.extra ${{ matrix.install-extras }}
- name: Test PEP8 compliance
run: flake8 . --count --show-source --statistics
- name: Evaluate complexity
run: flake8 . --count --exit-zero --max-complexity=10 --statistics
- name: Run unit and integration tests
run: |
coverage run --rcfile=pyproject.toml -m unittest discover
coverage report
coverage xml --rcfile=pyproject.toml
- name: Install and run Coveralls Reporter(Linux)
if: startsWith(matrix.os, 'ubuntu')
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz
./coveralls report -f coverage.xml --parallel --repo-token=${{ secrets.COVERALLS_REPO_TOKEN }} --build-number ${{ github.run_number }}
- name: Install and run Coveralls Reporter (Windows)
if: startsWith(matrix.os, 'windows')
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
curl -L https://github.com/coverallsapp/coverage-reporter/releases/latest/download/coveralls-windows.exe -o coveralls.exe
./coveralls.exe report -f coverage.xml --parallel --repo-token=${{ secrets.COVERALLS_REPO_TOKEN }} --build-number ${{ github.run_number }}
- name: Report and run Coveralls (macOS)
if: startsWith(matrix.os, 'macos')
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
brew tap coverallsapp/coveralls --quiet
brew install coveralls --quiet
coveralls report -f coverage.xml --parallel --repo-token=${{ secrets.COVERALLS_REPO_TOKEN }} --build-number ${{ github.run_number }}
finish:
name: Finish Coverage Analysis
needs: build
runs-on: "ubuntu-latest"
steps:
- name: Coveralls Finished
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_PARALLEL: true
run: |
curl -sL https://coveralls.io/coveralls-linux.tar.gz | tar -xz
./coveralls done --build-number ${{ github.run_number }}