-
Notifications
You must be signed in to change notification settings - Fork 97
106 lines (85 loc) · 2.7 KB
/
test.yaml
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
name: Tests
on:
# Allow to manually trigger through github API
workflow_dispatch:
# Triggers with push to master
push:
branches:
- master
# Triggers with push to a pr aimed at master
pull_request:
branches:
- master
schedule:
# https://crontab.guru/#42_2_3_*_*
# "At 02:42 on day-of-month 3"
# Put it at this odd time to reduce competing with load spikes on github action servers
- cron: '42 2 3 * *'
env:
import-package-name: grakel
extra-requires: "[dev]" # "" for no extra_requires
extra-requires-soft: "[test]" # "" for no extra_requires
test-dir: grakel/tests
# https://github.com/eddiebergman/GraKeL/blob/63a2723fc9488257a7c880fa9b5e5cc95ada9f42/ci_scripts/travis/install.sh#L8-L11
coverage-reqs: "networkx pandas"
codecov-py: "3.7"
codecov-args: >-
--cov=grakel
--cov-report=xml
jobs:
# General unit tests
source-test:
name: ${{ matrix.py }}-${{ matrix.os }}
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash # Default to using bash on all
strategy:
fail-fast: false
matrix:
py: ["3.7", "3.8", "3.9", "3.10", "3.11", "3.12"]
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.py }}
- name: Install ${{ env.import-package-name }}
run: |
python -m pip install --upgrade pip setuptools wheel
# escape for cvxopt
if ( [[ "${{ matrix.os }}" == "windows-latest" ]] && [[ "${{ matrix.py }}" == "3.7" ]] ) || [[ "${{ matrix.py }}" == "3.12" ]];then
python -m pip install -e ".${{ env.extra-requires-soft }}"
else
python -m pip install -e ".${{ env.extra-requires }}"
fi
- name: Tests
run: |
python -m pytest # ${{ env.test-dir }}
# Testing with codecov coverage uploaded
codecov-test:
name: codecov-test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.codecov-py }}
- name: Install ${{ env.import-package-name }}
run: |
python -m pip install --upgrade pip setuptools
python -m pip install -e ".${{ env.extra-requires }}"
- name: Tests
run: |
python -m pytest ${{ env.codecov-args }} ${{ env.test-dir }}
- name: Upload coverage
uses: codecov/codecov-action@v3
# Only upload coverage when it's **not** a scheduled test run
if: ${{ ! github.event.schedule }}
with:
fail_ci_if_error: true
verbose: true