-
Notifications
You must be signed in to change notification settings - Fork 35
128 lines (100 loc) · 3.42 KB
/
create_pr.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
name: Pull request workflows
on: pull_request
# pwd: /home/runner/work/sinergym/sinergym
jobs:
autopep8-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: autopep8 check
id: autopep8
uses: peter-evans/autopep8@v2
with:
args: --exit-code --recursive --diff --aggressive --aggressive .
- name: Fail if autopep8 made changes
if: steps.autopep8.outputs.exit-code == 2
run: exit 1
isort-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: isort check
id: isort-step
# default configuration use --check-only and --diff instead of --in-place options.
uses: isort/isort-action@master
continue-on-error: false
type-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: Install pytype
run: poetry install --no-interaction --only typing
- name: Check pytype
run: poetry run pytype -d import-error sinergym/
documentation-check:
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: latest
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ vars.PYTHON_VERSION }}
- name: Verify documentation update
uses: dorny/paths-filter@v3
id: verify-documentation-update
with:
filters: |
doc:
- 'docs/source/**'
- name: Install dependencies
if: steps.verify-documentation-update.outputs.doc == 'true'
run: |
sudo apt install python3-enchant
sudo apt install pandoc
poetry install --no-interaction --only main,doc
- name: Check build docs
if: steps.verify-documentation-update.outputs.doc == 'true'
run: poetry run sphinx-build -M html docs/source docs/build
- name: Check sphinx spelling
if: steps.verify-documentation-update.outputs.doc == 'true'
run: poetry run sphinx-build -M spelling docs/source docs/build
tests:
name: build container and execute pytest
runs-on: ubuntu-24.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build the latest Docker image
run: docker build . --file Dockerfile --build-arg SINERGYM_EXTRAS="test" --tag pullrequest/sinergym:latest
- name: Execute tests from container
run: docker run -t pullrequest/sinergym:latest /bin/bash -c 'pytest -vv --cov sinergym tests/'