Skip to content

Commit 6629b4d

Browse files
authored
Merge pull request #90 from dianna-ai/test_notebooks
Add testing of tutorial notebooks using nbmake
2 parents 4b0237c + 20873bc commit 6629b4d

File tree

7 files changed

+57
-54
lines changed

7 files changed

+57
-54
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
cache: 'pip'
16+
cache-dependency-path: setup.cfg
17+
- name: Python info
18+
shell: bash {0}
19+
run: |
20+
which python3
21+
python3 --version
22+
- name: Upgrade pip and install dependencies
23+
shell: bash {0}
24+
run: |
25+
python3 -m pip install --upgrade pip setuptools
26+
python3 -m pip install .[dev,publishing]

.github/workflows/build.yml

+2-12
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Python package
1+
name: build
22

33
on:
44
push:
@@ -20,19 +20,9 @@ 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
3828
- name: Verify that we can build the package

.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/notebooks.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: notebooks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
13+
notebooks:
14+
name: Run notebooks on (3.9, ${{ matrix.os }})
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: ./.github/actions/install-python-and-package
23+
- name: Run tutorial notebooks
24+
run: pytest --nbmake tutorials

.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

setup.cfg

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ dev =
6565
sphinx-autoapi
6666
torchtext
6767
coverage [toml]
68+
nbmake
6869
publishing =
6970
twine
7071
wheel

0 commit comments

Comments
 (0)