-
Notifications
You must be signed in to change notification settings - Fork 4
111 lines (95 loc) · 3.32 KB
/
python-test.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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: Testing
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#on
# Triggers the workflow on push pushed to any branch in a repository
on: push
jobs:
unittests:
name: Unit tests / ${{ matrix.os }} / ${{ matrix.python-version }}
runs-on: ${{ matrix.os }}
# Ref: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idcontinue-on-error
continue-on-error: ${{ matrix.experimental }}
strategy:
matrix:
experimental: [false]
# Ref: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
os: [macos-latest, ubuntu-latest]
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
include:
- python-version: "3.12.0-alpha.5"
os: ubuntu-latest
experimental: true
# How to add an experimental job:
# - "3.10.0-alpha.6"
# include:
# - python-version: "3.10.0-alpha.6"
# os: ubuntu-latest
# experimental: true
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install --no-interaction
- name: Test with pytest
run: |
poetry run pytest --cov=blocklib --cov-report=xml:coverage.xml -q tests
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v3
with:
env_vars: OS,PYTHON
fail_ci_if_error: false
files: ./coverage.xml
flags: unittests
name: codecov-blocklib
notebooktests:
name: Notebook tests / ${{ matrix.python }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ macos-latest, ubuntu-latest ]
python: [ "3.10" ]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install Poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ runner.os }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: |
poetry install --no-interaction --with docs
- name: Test notebooks
shell: bash
run: poetry run pytest --nbval docs/tutorial