-
Notifications
You must be signed in to change notification settings - Fork 3
160 lines (140 loc) · 4.71 KB
/
continuous_integration.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
160
name: EthicML CI
on:
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- 'examples/**'
- '**/*.md'
- .github/dependabot.yml
- .github/release.yml
- .github/workflows/docs.yml
- .github/workflows/dummy_ci.yml
- .github/workflows/dependabot_auto.yml
- .github/workflows/labeler.yml
- .gitignore
- CODEOWNERS
- LICENSE
- make_release.sh
- CITATION.cff
merge_group:
jobs:
lint_with_ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.10
- name: Install ruff
run: uv sync --no-install-project --only-group lint
- name: Lint with ruff
run: |
uv run ruff check --output-format=github ethicml
- name: Lint with ruff
run: |
uv run ruff check --output-format=github tests
format_with_black:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.10
- name: Install ruff
run: uv sync --no-install-project --only-group lint
- name: Format with ruff
run: |
uv run ruff format --diff .
check_with_pydoclint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.11
- name: Install pydoclint
run: uv sync --no-install-project --only-group doclint
- name: Check with pydoclint
run: |
uv run pydoclint ethicml
test_minimal_dependencies:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
- name: Set up Python
run: uv python install 3.10
- name: Install dependencies
run: uv sync --no-install-project --no-group dev --no-group test --no-group typecheck --no-group lint --no-group doclint
- name: Test import
run: |
uv run python -c "import ethicml"
test_build_docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Python
run: uv python install 3.10
- name: Install dependencies
run: uv sync --no-install-project --all-extras --group ci --group torchcpu --group docs --no-group lint --no-group doclint
- name: Test import
run: |
uv run python -c "import ethicml"
- name: Install pandoc
run: sudo apt-get install -y pandoc
- name: Build with sphinx
run: |
uv run sphinx-build -W -b html ./docs ./docs/_build
test_with_pytest:
needs: [lint_with_ruff, format_with_black, check_with_pydoclint, test_minimal_dependencies, test_build_docs]
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# --- check-out repo and set-up python ---
#----------------------------------------------
- uses: actions/checkout@v4
- name: Install uv
if: ${{ github.event_name == 'merge_group' }}
uses: astral-sh/setup-uv@v4
with:
enable-cache: true
- name: Set up Python
if: ${{ github.event_name == 'merge_group' }}
run: uv python install 3.10
#----------------------------------------------
# --------- install dependencies --------
#----------------------------------------------
- name: Install dependencies
if: ${{ github.event_name == 'merge_group' }}
run: uv sync --no-install-project --all-extras --group ci --group torchcpu --no-group lint --no-group doclint
#----------------------------------------------
# ----- Run MyPy -----
#----------------------------------------------
- name: Type check with mypy
if: ${{ github.event_name == 'merge_group' }}
run: |
uv run mypy ethicml
#----------------------------------------------
# ----- Run MyPy on tests -----
#----------------------------------------------
- name: Type check tests with mypy
if: ${{ github.event_name == 'merge_group' }}
run: |
uv run mypy tests
#----------------------------------------------
# ----- Run Tests -----
#----------------------------------------------
- name: Test with pytest
if: ${{ github.event_name == 'merge_group' }}
run: |
uv run python -m pytest -vv -n 2 --dist loadgroup --cov=ethicml --cov-fail-under=80 tests/