-
Notifications
You must be signed in to change notification settings - Fork 3
143 lines (127 loc) · 4.4 KB
/
ci.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
# Run all CI checks on pushes to the main branch or pull-request updates.
#
# This includes: running static checks such as linting and type checking,
# running the test suite on all supported Python versions, and uploading
# coverage reports to Codecov and Codacy. Additionally, the Sphinx docs
# are built, and a link to the docs will be added to the PR description
#
name: CI checks
on:
push:
branches: [ main ]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.event.issue.number || github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
pull-requests: write
jobs:
# Build the docs and update the PR description w/ a link to readthedocs
# https://github.com/readthedocs/actions/tree/main/preview
documentation-links:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
timeout-minutes: 1
steps:
- uses: readthedocs/actions/preview@v1
with:
project-slug: "ridgeplot"
# Run static checks only for Ubuntu and Python 3.9
static-checks:
name: Static checks
runs-on: ubuntu-latest
timeout-minutes: 6
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/setup-python
with:
python-version: "3.9"
requirements: tox
# Instead of running all checks in one task (i.e., `tox -m static`),
# we'll instead run them one-by-one, so that it's easier to
# identify and debug failing checks in the GitHub UI.
- name: Run static checks with pre-commit
shell: bash
env:
SKIP: "no-commit-to-branch"
run: tox -e pre-commit
- name: Run type checks with mypy
shell: bash
run: tox -e mypy
# Run test suits for all supported platforms and Python versions
software-tests:
name: Software tests
strategy:
matrix:
python-version:
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
os:
- ubuntu-latest
# There shouldn't be any behavior differences between OSes,
# so we'll only run the test suite on Ubuntu for now. Also,
# since I (the main maintainer) develop on a macOS machine,
# I will run all tests locally on macOS before merging any
# PRs or releasing new versions. This should be sufficient
# and will speed up the CI/CD process quite significantly.
# - macos-latest
# - windows-latest
fail-fast: true
runs-on: ${{ matrix.os }}
timeout-minutes: 8
steps:
- uses: actions/checkout@v4
with:
# TODO: This can be very expensive for large repos. Is there a better way to do this?
# Fetch all history and tags for setuptools_scm to work
fetch-depth: 0
- uses: ./.github/actions/setup-python
with:
python-version: "${{ matrix.python-version }}"
requirements: tox
# Instead of running all tests in one task (i.e., `tox -m tests`),
# we'll instead run them one-by-one, so that it's easier to
# identify and debug failing tests in the GitHub UI.
- name: Run unit tests
shell: bash
run: tox -e tests-unit
env:
DIFF_AGAINST: HEAD
- name: Run E2E tests
shell: bash
run: tox -e tests-e2e
env:
DIFF_AGAINST: HEAD
- name: Test the CI/CD utilities
shell: bash
run: tox -e tests-cicd_utils
env:
DIFF_AGAINST: HEAD
# Combine coverage reports from all test suites
- name: Combine coverage reports
shell: bash
run: tox -e coverage-combine
env:
DIFF_AGAINST: HEAD
# Upload coverage reports to Codecov and Codacy.
- name: Upload coverage to codecov
uses: codecov/codecov-action@v4
env:
OS: "${{ matrix.os }}"
PYTHON: "${{ matrix.python-version }}"
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.coverage-combine.xml
disable_search: true
flags: combined-src
env_vars: OS,PYTHON
fail_ci_if_error: true
verbose: true
- name: Upload coverage to codacy
uses: codacy/codacy-coverage-reporter-action@v1
with:
project-token: ${{ secrets.CODACY_PROJECT_TOKEN }}
coverage-reports: coverage.coverage-combine.xml