-
Notifications
You must be signed in to change notification settings - Fork 1
131 lines (121 loc) · 3.95 KB
/
Copy pathci.yml
File metadata and controls
131 lines (121 loc) · 3.95 KB
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
name: ci
on:
pull_request:
push:
branches:
- main
workflow_dispatch:
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
harness-validate:
name: harness-validate
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements.txt
- run: python -m pip install -r requirements-dev.txt
- run: python scripts/agent_harness/validate_harness.py
- run: python scripts/agent_harness/validate_references.py
- run: python scripts/agent_harness/validate_pr.py --ci
lint:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements.txt
- run: python -m pip install -r requirements-dev.txt
- run: python -m flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
- run: python -m pydocstyle --count --convention=numpy
- run: python -m black --check -l 99 dphtools tests scripts setup.py versioneer.py
tests:
name: tests (${{ matrix.os }}, py${{ matrix.python-version }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements.txt
- run: python -m pip install -r requirements-dev.txt
- run: python -m pip install .
- run: python -m pytest --doctest-modules dphtools tests
coverage:
name: coverage
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements.txt
- run: python -m pip install -r requirements-dev.txt
- run: python -m pip install .
- run: python -m pytest --cov=dphtools --cov-branch --cov-report=term-missing --cov-report=xml tests
- run: python scripts/agent_harness/coverage_gate.py
- run: python scripts/agent_harness/diff_coverage_gate.py --enabled
package:
name: package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- run: python -m pip install --upgrade pip
- run: python -m pip install -r requirements.txt
- run: python -m pip install -r requirements-dev.txt
- run: python setup.py sdist bdist_wheel
- run: python -m twine check dist/*
ci-required:
name: ci-required
runs-on: ubuntu-latest
needs: [harness-validate, lint, tests, coverage, package]
if: always()
steps:
- name: Fail if required jobs failed, skipped, or were cancelled
env:
NEEDS_JSON: ${{ toJson(needs) }}
run: |
python - <<'PY'
import json
import os
import sys
needs = json.loads(os.environ["NEEDS_JSON"])
bad = {
name: data["result"]
for name, data in needs.items()
if data["result"] != "success"
}
if bad:
print("Required CI jobs did not succeed:", bad)
sys.exit(1)
print("All required CI jobs succeeded.")
PY