-
Notifications
You must be signed in to change notification settings - Fork 89
147 lines (121 loc) · 3.35 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
144
145
146
147
name: CI Tests
on:
pull_request:
push:
branches:
- master # Run tests only when changes are pushed to 'default'
workflow_dispatch:
jobs:
Sphinx-Pytest-Coverage:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env: [environment_a, environment_b, conda-forge]
steps:
- uses: actions/checkout@v4
- name: Environment creation
uses: mamba-org/setup-micromamba@v2
with:
environment-file: envs/${{ matrix.env }}.yml
init-shell: bash
cache-environment: true
- name: Environment info
run: |
micromamba info
micromamba list
shell: bash -el {0}
- name: sphinx documentation
run: |
make -C doc html SPHINXOPTS="-W --keep-going"
shell: micromamba-shell {0}
- name: pytest without coverage
if: matrix.env == 'conda-forge'
run: |
pytest
shell: micromamba-shell {0}
- name: pytest with coverage
if: matrix.env != 'conda-forge'
run: |
pytest --cov=improver --cov-report xml:coverage.xml
shell: micromamba-shell {0}
- name: codacy upload
if: env.CODACY_PROJECT_TOKEN && matrix.env == 'environment_a'
run: |
python-codacy-coverage -v -r coverage.xml
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
shell: micromamba-shell {0}
- name: codecov upload
uses: codecov/codecov-action@v5
with:
name: ${{ matrix.env }}
if: matrix.env != 'conda_forge'
pre-commit-checks:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
steps:
- name: improver checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.7
cache: 'pip'
- name: pip install pre-commit
run: |
pip install pre-commit
- name: Python interpreter version sha (PYSHA)
run: echo "PYSHA=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Cache pre-commit
uses: actions/cache@v4
id: pre-commit-cache
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.PYSHA }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: pre-commit install
run: |
pre-commit install
- name: pre-commit run
run: |
pre-commit run --verbose --color=always --all-files
PR-standards:
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check CONTRIBUTING.md
uses: cylc/release-actions/check-shortlog@v1
Safety-Bandit:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
env: [environment_a, environment_b, conda-forge]
steps:
- uses: actions/checkout@v4
- name: Environment creation
uses: mamba-org/setup-micromamba@v2
with:
environment-file: envs/${{ matrix.env }}.yml
init-shell: bash
cache-environment: true
- name: Environment info
run: |
micromamba info
micromamba list
shell: bash -el {0}
- name: safety
run: |
safety check || true
shell: micromamba-shell {0}
- name: bandit
run: |
bandit -r improver
shell: micromamba-shell {0}