Skip to content

Commit e7c2a41

Browse files
committed
[CI] use composite actions to clean up workflows
1 parent 1a295e2 commit e7c2a41

File tree

5 files changed

+41
-55
lines changed

5 files changed

+41
-55
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Install Python and DIANNA"
2+
description: "Installs Python, updates pip and installs DIANNA together with its dependencies."
3+
inputs:
4+
python-version:
5+
required: false
6+
description: "The Python version to use. Specify major and minor version, e.g. '3.9'."
7+
default: "3.9"
8+
runs:
9+
using: "composite"
10+
steps:
11+
- name: Set up Python ${{ inputs.python-version }}
12+
uses: actions/setup-python@v2
13+
with:
14+
python-version: ${{ inputs.python-version }}
15+
- name: Python info
16+
shell: bash -l {0}
17+
run: |
18+
which python3
19+
python3 --version
20+
- name: Upgrade pip and install dependencies
21+
run: |
22+
python3 -m pip install --upgrade pip setuptools
23+
python3 -m pip install .[dev,publishing]

.github/workflows/build.yml

+14-13
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,26 @@ jobs:
2020
python-version: ['3.7', '3.8', '3.9']
2121
steps:
2222
- uses: actions/checkout@v2
23-
- name: Set up Python ${{ matrix.python-version }}
24-
uses: actions/setup-python@v2
23+
- uses: ./.github/actions/install-python-and-package
2524
with:
2625
python-version: ${{ matrix.python-version }}
27-
- name: Python info
28-
shell: bash -l {0}
29-
run: |
30-
which python3
31-
python3 --version
32-
- name: Upgrade pip and install dependencies
33-
run: |
34-
python3 -m pip install --upgrade pip setuptools
35-
python3 -m pip install .[dev,publishing]
3626
- name: Run unit tests
3727
run: pytest -v
38-
- name: Run tutorial notebooks
39-
run: pytest --nbmake tutorials
4028
- name: Verify that we can build the package
4129
run: python3 setup.py sdist bdist_wheel
4230
- name: Build documentation
4331
run: make coverage doctest html
4432
working-directory: docs
33+
34+
notebooks:
35+
name: Run notebooks on (3.9, ${{ matrix.os }})
36+
runs-on: ${{ matrix.os }}
37+
strategy:
38+
fail-fast: false
39+
matrix:
40+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
41+
steps:
42+
- uses: actions/checkout@v2
43+
- uses: ./.github/actions/install-python-and-package
44+
- name: Run tutorial notebooks
45+
run: pytest --nbmake tutorials

.github/workflows/linting.yml

+1-13
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,7 @@ jobs:
1717
fail-fast: false
1818
steps:
1919
- uses: actions/checkout@v2
20-
- name: Set up Python 3.9
21-
uses: actions/setup-python@v2
22-
with:
23-
python-version: 3.9
24-
- name: Python info
25-
shell: bash -l {0}
26-
run: |
27-
which python3
28-
python3 --version
29-
- name: Upgrade pip and install dependencies
30-
run: |
31-
python3 -m pip install --upgrade pip setuptools
32-
python3 -m pip install .[dev,publishing]
20+
- uses: ./.github/actions/install-python-and-package
3321
- name: Check style against standards using prospector
3422
run: prospector
3523
- name: Check import order

.github/workflows/release.yml

+2-18
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,7 @@ jobs:
1313
steps:
1414
- uses: actions/checkout@v2
1515

16-
- uses: actions/setup-python@v2
17-
name: Install Python
18-
with:
19-
python-version: '3.9'
20-
21-
- name: Upgrade pip and install dependencies
22-
run: |
23-
python3 -m pip install --upgrade pip setuptools
24-
python3 -m pip install .[publishing]
16+
- uses: ./.github/actions/install-python-and-package
2517

2618
- name: Build wheel
2719
run: python setup.py bdist_wheel
@@ -36,15 +28,7 @@ jobs:
3628
steps:
3729
- uses: actions/checkout@v2
3830

39-
- uses: actions/setup-python@v2
40-
name: Install Python
41-
with:
42-
python-version: '3.9'
43-
44-
- name: Upgrade pip and install dependencies
45-
run: |
46-
python3 -m pip install --upgrade pip setuptools
47-
python3 -m pip install .[publishing]
31+
- uses: ./.github/actions/install-python-and-package
4832

4933
- name: Build sdist
5034
run: python setup.py sdist

.github/workflows/sonarcloud.yml

+1-11
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,7 @@ jobs:
1818
- uses: actions/checkout@v2
1919
with:
2020
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
21-
- name: Set up Python
22-
uses: actions/setup-python@v2
23-
with:
24-
python-version: 3.9
25-
- name: Python info
26-
shell: bash -l {0}
27-
run: |
28-
which python3
29-
python3 --version
30-
- name: Install dependencies
31-
run: python3 -m pip install .[dev]
21+
- uses: ./.github/actions/install-python-and-package
3222
- name: Check style against standards using prospector
3323
run: prospector --zero-exit --output-format grouped --output-format pylint:pylint-report.txt
3424
- name: Run unit tests with coverage

0 commit comments

Comments
 (0)