Skip to content

Commit 330fa23

Browse files
committed
fix ci/cd for github
1 parent 9ecefab commit 330fa23

File tree

1 file changed

+295
-0
lines changed

1 file changed

+295
-0
lines changed
Lines changed: 295 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,295 @@
1+
name: CI Additional
2+
on:
3+
push:
4+
branches:
5+
- "main"
6+
pull_request:
7+
branches:
8+
- "main"
9+
workflow_dispatch: # allows you to trigger manually
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
FORCE_COLOR: 3
17+
18+
jobs:
19+
detect-ci-trigger:
20+
name: detect ci trigger
21+
runs-on: ubuntu-latest
22+
if: |
23+
github.repository == 'gedidb'
24+
&& (github.event_name == 'push' || github.event_name == 'pull_request')
25+
outputs:
26+
triggered: ${{ steps.detect-trigger.outputs.trigger-found }}
27+
steps:
28+
- uses: actions/checkout@v4
29+
with:
30+
fetch-depth: 2
31+
- uses: gedidb-contrib/ci-trigger@v1
32+
id: detect-trigger
33+
with:
34+
keyword: "[skip-ci]"
35+
36+
doctest:
37+
name: Doctests
38+
runs-on: "ubuntu-latest"
39+
needs: detect-ci-trigger
40+
if: needs.detect-ci-trigger.outputs.triggered == 'false'
41+
42+
defaults:
43+
run:
44+
shell: bash -l {0}
45+
env:
46+
CONDA_ENV_FILE: ci/requirements/environment.yml
47+
PYTHON_VERSION: "3.12"
48+
steps:
49+
- uses: actions/checkout@v4
50+
with:
51+
fetch-depth: 0 # Fetch all history for all branches and tags.
52+
53+
- name: set environment variables
54+
run: |
55+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
56+
57+
- name: Setup micromamba
58+
uses: mamba-org/setup-micromamba@v2
59+
with:
60+
environment-file: ${{env.CONDA_ENV_FILE}}
61+
environment-name: gedidb-tests
62+
create-args: >-
63+
python=${{env.PYTHON_VERSION}}
64+
cache-environment: true
65+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
66+
67+
- name: Install gedidb
68+
run: |
69+
python -m pip install --no-deps -e .
70+
- name: Version info
71+
run: |
72+
python gedidb/utils/print_versions.py
73+
- name: Run doctests
74+
run: |
75+
# Raise an error if there are warnings in the doctests, with `-Werror`.
76+
# This is a trial; if it presents an problem, feel free to remove.
77+
# See https://github.com/simonbesnard1/gedidb/issues for more info.
78+
#
79+
# If dependencies emit warnings we can't do anything about, add ignores to
80+
# `gedidb/tests/__init__.py`.
81+
python -m pytest --doctest-modules gedidb --ignore gedidb/tests -Werror
82+
83+
mypy:
84+
name: Mypy
85+
runs-on: "ubuntu-latest"
86+
needs: detect-ci-trigger
87+
defaults:
88+
run:
89+
shell: bash -l {0}
90+
env:
91+
CONDA_ENV_FILE: ci/requirements/environment.yml
92+
PYTHON_VERSION: "3.12"
93+
94+
steps:
95+
- uses: actions/checkout@v4
96+
with:
97+
fetch-depth: 0 # Fetch all history for all branches and tags.
98+
99+
- name: set environment variables
100+
run: |
101+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
102+
- name: Setup micromamba
103+
uses: mamba-org/setup-micromamba@v2
104+
with:
105+
environment-file: ${{env.CONDA_ENV_FILE}}
106+
environment-name: gedidb-tests
107+
create-args: >-
108+
python=${{env.PYTHON_VERSION}}
109+
cache-environment: true
110+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
111+
- name: Install gedidb
112+
run: |
113+
python -m pip install --no-deps -e .
114+
- name: Version info
115+
run: |
116+
python gedidb/utils/print_versions.py
117+
- name: Install mypy
118+
run: |
119+
python -m pip install "mypy==1.15" --force-reinstall
120+
121+
- name: Run mypy
122+
run: |
123+
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
124+
125+
- name: Upload mypy coverage to Codecov
126+
uses: codecov/codecov-action@v5.3.1
127+
with:
128+
file: mypy_report/cobertura.xml
129+
flags: mypy
130+
env_vars: PYTHON_VERSION
131+
name: codecov-umbrella
132+
fail_ci_if_error: false
133+
134+
mypy-min:
135+
name: Mypy 3.10
136+
runs-on: "ubuntu-latest"
137+
needs: detect-ci-trigger
138+
defaults:
139+
run:
140+
shell: bash -l {0}
141+
env:
142+
CONDA_ENV_FILE: ci/requirements/environment.yml
143+
PYTHON_VERSION: "3.10"
144+
145+
steps:
146+
- uses: actions/checkout@v4
147+
with:
148+
fetch-depth: 0 # Fetch all history for all branches and tags.
149+
150+
- name: set environment variables
151+
run: |
152+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
153+
- name: Setup micromamba
154+
uses: mamba-org/setup-micromamba@v2
155+
with:
156+
environment-file: ${{env.CONDA_ENV_FILE}}
157+
environment-name: gedidb-tests
158+
create-args: >-
159+
python=${{env.PYTHON_VERSION}}
160+
cache-environment: true
161+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
162+
- name: Install gedidb
163+
run: |
164+
python -m pip install --no-deps -e .
165+
- name: Version info
166+
run: |
167+
python gedidb/utils/print_versions.py
168+
- name: Install mypy
169+
run: |
170+
python -m pip install "mypy==1.15" --force-reinstall
171+
172+
- name: Run mypy
173+
run: |
174+
python -m mypy --install-types --non-interactive --cobertura-xml-report mypy_report
175+
176+
- name: Upload mypy coverage to Codecov
177+
uses: codecov/codecov-action@v5.3.1
178+
with:
179+
file: mypy_report/cobertura.xml
180+
flags: mypy-min
181+
env_vars: PYTHON_VERSION
182+
name: codecov-umbrella
183+
fail_ci_if_error: false
184+
185+
pyright:
186+
name: Pyright
187+
runs-on: "ubuntu-latest"
188+
needs: detect-ci-trigger
189+
if: |
190+
always()
191+
&& (
192+
contains( github.event.pull_request.labels.*.name, 'run-pyright')
193+
)
194+
defaults:
195+
run:
196+
shell: bash -l {0}
197+
env:
198+
CONDA_ENV_FILE: ci/requirements/environment.yml
199+
PYTHON_VERSION: "3.12"
200+
201+
steps:
202+
- uses: actions/checkout@v4
203+
with:
204+
fetch-depth: 0 # Fetch all history for all branches and tags.
205+
206+
- name: set environment variables
207+
run: |
208+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
209+
- name: Setup micromamba
210+
uses: mamba-org/setup-micromamba@v2
211+
with:
212+
environment-file: ${{env.CONDA_ENV_FILE}}
213+
environment-name: gedidb-tests
214+
create-args: >-
215+
python=${{env.PYTHON_VERSION}}
216+
cache-environment: true
217+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
218+
- name: Install gedidb
219+
run: |
220+
python -m pip install --no-deps -e .
221+
- name: Version info
222+
run: |
223+
python gedidb/utils/print_versions.py
224+
- name: Install pyright
225+
run: |
226+
python -m pip install pyright --force-reinstall
227+
228+
- name: Run pyright
229+
run: |
230+
python -m pyright gedidb/
231+
232+
- name: Upload pyright coverage to Codecov
233+
uses: codecov/codecov-action@v5.3.1
234+
with:
235+
file: pyright_report/cobertura.xml
236+
flags: pyright
237+
env_vars: PYTHON_VERSION
238+
name: codecov-umbrella
239+
fail_ci_if_error: false
240+
241+
pyright39:
242+
name: Pyright 3.10
243+
runs-on: "ubuntu-latest"
244+
needs: detect-ci-trigger
245+
if: |
246+
always()
247+
&& (
248+
contains( github.event.pull_request.labels.*.name, 'run-pyright')
249+
)
250+
defaults:
251+
run:
252+
shell: bash -l {0}
253+
env:
254+
CONDA_ENV_FILE: ci/requirements/environment.yml
255+
PYTHON_VERSION: "3.10"
256+
257+
steps:
258+
- uses: actions/checkout@v4
259+
with:
260+
fetch-depth: 0 # Fetch all history for all branches and tags.
261+
262+
- name: set environment variables
263+
run: |
264+
echo "TODAY=$(date +'%Y-%m-%d')" >> $GITHUB_ENV
265+
- name: Setup micromamba
266+
uses: mamba-org/setup-micromamba@v2
267+
with:
268+
environment-file: ${{env.CONDA_ENV_FILE}}
269+
environment-name: gedidb-tests
270+
create-args: >-
271+
python=${{env.PYTHON_VERSION}}
272+
cache-environment: true
273+
cache-environment-key: "${{runner.os}}-${{runner.arch}}-py${{env.PYTHON_VERSION}}-${{env.TODAY}}-${{hashFiles(env.CONDA_ENV_FILE)}}"
274+
- name: Install gedidb
275+
run: |
276+
python -m pip install --no-deps -e .
277+
- name: Version info
278+
run: |
279+
python gedidb/utils/print_versions.py
280+
- name: Install pyright
281+
run: |
282+
python -m pip install pyright --force-reinstall
283+
284+
- name: Run pyright
285+
run: |
286+
python -m pyright gedidb/
287+
288+
- name: Upload pyright coverage to Codecov
289+
uses: codecov/codecov-action@v5.3.1
290+
with:
291+
file: pyright_report/cobertura.xml
292+
flags: pyright39
293+
env_vars: PYTHON_VERSION
294+
name: codecov-umbrella
295+
fail_ci_if_error: false

0 commit comments

Comments
 (0)