Skip to content

Commit 1141556

Browse files
committed
split CI into different workflows
1 parent 4423ccf commit 1141556

File tree

3 files changed

+101
-9
lines changed

3 files changed

+101
-9
lines changed

.github/workflows/ci_extra.yml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This workflow is for any branch. It runs additional tests for several python versions.
2+
3+
name: Build extra
4+
5+
on: [push, pull_request]
6+
7+
jobs:
8+
build:
9+
10+
runs-on: ubuntu-latest
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
python-version: ["3.9", "3.10"]
15+
16+
steps:
17+
18+
- uses: actions/checkout@v3
19+
- name: Set up Python ${{ matrix.python-version }}
20+
uses: actions/setup-python@v3
21+
with:
22+
python-version: ${{ matrix.python-version }}
23+
- name: Install dependencies
24+
run: |
25+
python -m pip install --upgrade pip
26+
python -m pip install pytest
27+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
28+
29+
- name: Lint with pylint
30+
run: |
31+
pylint pyformlang || true
32+
- name: Lint with pycodestyle
33+
run: |
34+
pycodestyle pyformlang || true
35+
- name: Test with pytest
36+
run: |
37+
pytest --showlocals -v pyformlang

.github/workflows/ci_feature.yml

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# This workflow is for feature branches. It sets up python, lints with several analyzers,
2+
# runs tests, collects test coverage and makes a coverage comment.
3+
4+
name: Build feature
5+
6+
on:
7+
push:
8+
branches-ignore: "master"
9+
pull_request:
10+
11+
jobs:
12+
build:
13+
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
python-version: ["3.8"]
19+
20+
steps:
21+
22+
- uses: actions/checkout@v3
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install dependencies
28+
run: |
29+
python -m pip install --upgrade pip
30+
python -m pip install pytest
31+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
32+
33+
- name: Lint with pylint
34+
run: |
35+
pylint pyformlang || true
36+
- name: Lint with pycodestyle
37+
run: |
38+
pycodestyle pyformlang || true
39+
- name: Test with pytest
40+
run: |
41+
pytest --showlocals -v pyformlang
42+
43+
- name: Build coverage file
44+
run: |
45+
pytest pyformlang --junitxml=pytest.xml --cov=pyformlang | tee ./pytest-coverage.txt
46+
- name: Make coverage comment
47+
uses: MishaKav/pytest-coverage-comment@main
48+
id: coverageComment
49+
with:
50+
pytest-coverage-path: ./pytest-coverage.txt
51+
junitxml-path: ./pytest.xml
52+
default-branch: master

.github/workflows/python-package.yml renamed to .github/workflows/ci_master.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2-
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
1+
# This workflow is for master branch only. It sets up python, lints with several analyzers,
2+
# runs tests, collects test coverage, makes a coverage comment and creates a coverage badge.
33

4-
name: Python package
4+
name: Build master
55

6-
on: [push, pull_request]
6+
on:
7+
push:
8+
branches: "master"
79

810
jobs:
911
build:
@@ -12,9 +14,10 @@ jobs:
1214
strategy:
1315
fail-fast: false
1416
matrix:
15-
python-version: ["3.8", "3.9", "3.10"]
17+
python-version: ["3.8"]
1618

1719
steps:
20+
1821
- uses: actions/checkout@v3
1922
- name: Set up Python ${{ matrix.python-version }}
2023
uses: actions/setup-python@v3
@@ -25,6 +28,7 @@ jobs:
2528
python -m pip install --upgrade pip
2629
python -m pip install pytest
2730
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
31+
2832
- name: Lint with pylint
2933
run: |
3034
pylint pyformlang || true
@@ -34,20 +38,19 @@ jobs:
3438
- name: Test with pytest
3539
run: |
3640
pytest --showlocals -v pyformlang
41+
3742
- name: Build coverage file
38-
if: ${{ matrix.python-version == '3.8'}}
3943
run: |
4044
pytest pyformlang --junitxml=pytest.xml --cov=pyformlang | tee ./pytest-coverage.txt
41-
- name: Pytest coverage comment
42-
if: ${{ matrix.python-version == '3.8'}}
45+
- name: Make coverage comment
4346
uses: MishaKav/pytest-coverage-comment@main
4447
id: coverageComment
4548
with:
4649
pytest-coverage-path: ./pytest-coverage.txt
4750
junitxml-path: ./pytest.xml
4851
default-branch: master
52+
4953
- name: Create coverage Badge
50-
if: ${{ github.ref_name == 'master' && matrix.python-version == '3.8'}}
5154
uses: schneegans/dynamic-badges-action@v1.0.0
5255
with:
5356
auth: ${{ secrets.GIST_SECRET }}

0 commit comments

Comments
 (0)