-
Notifications
You must be signed in to change notification settings - Fork 35
159 lines (148 loc) · 5.18 KB
/
tox-tests.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
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# GitHub Actions workflow for testing and continuous integration.
#
# This file performs testing using tox and tox.ini to define and configure the test environments.
name: Python Tests
on:
push:
pull_request:
schedule:
# Weekly Monday 4 AM build
# * is a special character in YAML so you have to quote this string
- cron: '0 4 * * 1'
jobs:
# Set up matrix to run tox tests across lists of os, python version, and tox environment
matrix_tests:
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, '[ci skip]')" # github actions doesn't yet support this natively so add here
strategy:
matrix:
# Github actions supports ubuntu, windows, and macos virtual environments:
# https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners
#
# Only run on ubuntu by default, but can add other os's to the test matrix here.
# For example -- os: [ubuntu-latest, macos-latest, windows-latest]
# windows-latest not possible due to how temp files are used in tests currently
# macos failing due to an issue installing h5py - KDG 14may24
# os: [ubuntu-latest, macos-latest]
os: [ubuntu-latest]
# Test python version 3.x
python-ver: [10, 11, 12]
# Specify which tox environments to test in this list.
# tox-env: [cov, alldeps, devdeps, astropylts]
tox-env: [alldeps]
steps:
- uses: actions/checkout@v4
- name: Set up python 3.${{ matrix.python-ver }} with tox environment py3${{ matrix.python-ver }}-${{ matrix.tox-env }} on ${{ matrix.os }}
uses: actions/setup-python@v4
with:
python-version: 3.${{ matrix.python-ver }}
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: |
tox -e py3${{ matrix.python-ver }}-${{ matrix.tox-env }}
# Dev version test
# dev_test:
# runs-on: ubuntu-latest
# if: "!contains(github.event.head_commit.message, '[ci skip]')"
# steps:
# - uses: actions/checkout@v1
# - name: Set up python for astropy, numpy dev test
# uses: actions/setup-python@v1
# with:
# python-version: 3.8
# - name: Install base dependencies
# run: |
# python -m pip install --upgrade pip
# python -m pip install tox
# - name: Test with tox
# run: |
# tox -e py38-devdeps
# LTS version test
lts_test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- name: Set up python for astropy lts test
uses: actions/setup-python@v4
with:
python-version: 3.11
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: |
tox -e py311-astropylts
# Coverage test
cov_test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- name: Set up python for coverage test
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: |
tox -e py309-cov -- --remote-data
# - name: Upload coverage results to codecov
# run: |
# curl -Os https://uploader.codecov.io/latest/linux/codecov
# chmod +x codecov
# ./codecov --verbose upload-process --fail-on-error -t ${{ secrets.CODECOV }} -n 'service'-${{ github_run_id }} -F service -f coverage-service.xml
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV }}
fail_ci_if_error: true
# if: matrix.tox-env == 'cov' && matrix.python-ver == '8'
# uses: coverallsapp/github-action@master
# with:
# github_token: ${{ secrets.COVERALLS }}
# # file: ./coverage.xml
# fail_ci_if_error: true
# Test building of docs and check the links
doc_test:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- name: Set up Python to build docs with sphinx
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
sudo apt-get install graphviz
- name: Build and check docs using tox
run: |
tox -e build_docs
tox -e linkcheck
# Perform codestyle check
codestyle:
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[ci skip]')"
steps:
- uses: actions/checkout@v4
- name: Python codestyle check
uses: actions/setup-python@v4
with:
python-version: 3.12
- name: Install base dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Check codestyle using tox
run: |
tox -e codestyle