Skip to content

Commit fdf0829

Browse files
committed
ci: adding linter and tester workflows
1 parent 4a25702 commit fdf0829

File tree

2 files changed

+93
-0
lines changed

2 files changed

+93
-0
lines changed

.github/workflows/linter.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: "✅ Linter"
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- '**.py'
9+
10+
pull_request:
11+
branches:
12+
- main
13+
paths:
14+
- '**.py'
15+
16+
env:
17+
PROJECT_FOLDER: "LoopStructural"
18+
PYTHON_VERSION: 3.9
19+
20+
21+
jobs:
22+
lint-py:
23+
name: Python 🐍
24+
25+
runs-on: ubuntu-latest
26+
27+
steps:
28+
- name: Get source code
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Python
32+
uses: actions/setup-python@v5
33+
with:
34+
cache: "pip"
35+
python-version: ${{ env.PYTHON_VERSION }}
36+
37+
- name: Install dependencies
38+
run: |
39+
python -m pip install --upgrade pip
40+
pip install black ruff
41+
- name: Autoformat with black
42+
run: |
43+
black .
44+
- name: Lint with ruff
45+
run: |
46+
ruff check ${{env.PROJECT_FOLDER}} --fix
47+
- uses: stefanzweifel/git-auto-commit-action@v5
48+
with:
49+
commit_message: "style: style fixes by ruff and autoformatting by black"
50+

.github/workflows/tester.yml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: "🎳 Tester"
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '**.py'
9+
- .github/workflows/tester.yml
10+
11+
pull_request:
12+
branches:
13+
- main
14+
paths:
15+
- '**.py'
16+
- .github/workflows/tester.yml
17+
jobs:
18+
continuous-integration:
19+
name: Continuous integration ${{ matrix.os }} python ${{ matrix.python-version }}
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
os: ${{ fromJSON(vars.BUILD_OS)}}
25+
python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}}
26+
steps:
27+
- uses: actions/checkout@v4
28+
- uses: conda-incubator/setup-miniconda@v3
29+
with:
30+
python-version: ${{ matrix.python }}
31+
- name: Installing dependencies
32+
shell: |
33+
bash -l {0}
34+
run: |
35+
conda install -c conda-forge numpy scipy scikit-image scikit-learn pytest networkx osqp matplotlib -y
36+
- name: Building and install
37+
shell: bash -l {0}
38+
run: |
39+
pip install . --user
40+
- name: pytest
41+
shell: bash -l {0}
42+
run: |
43+
pytest

0 commit comments

Comments
 (0)