-
Notifications
You must be signed in to change notification settings - Fork 1
68 lines (64 loc) · 1.9 KB
/
unit_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
name: Tests
on:
workflow_dispatch:
push:
merge_group:
pull_request:
types: [labeled]
env:
IBMQ_TOKEN: ${{ secrets.IBMQ_TOKEN }}
jobs:
build:
if: contains(github.event.pull_request.labels.*.name, 'run-workflow') || github.event_name == 'push'
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
python-version: [3.9, '3.10', '3.11']
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v3
- name: Setup python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install and configure poetry
uses: snok/install-poetry@v1
with:
virtualenvs-create: true
virtualenvs-in-project: true
- name: Disable modern installer
run: poetry config installer.modern-installation false
- name: Load cached venv
id: cached-pip-wheels
uses: actions/cache@v3
with:
path: ~/.cache
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
run: poetry install --no-interaction --no-root
if: steps.cache.outputs.cache-hit != 'true'
- name: Install project
run: poetry install --no-interaction "--with dev"
- name: Install task runner
run: pip install poethepoet
- name: Lint
run: |
source $VENV
poe lint
poe lint-warnings
- name: Test
run: |
source $VENV
poe test
- name: Upload coverage to Codecov
if: startsWith(runner.os, 'Linux')
uses: codecov/codecov-action@v3
with:
files: ./coverage.xml
flags: unittests
name: unit-tests
fail_ci_if_error: true
token: ${{ secrets.codecov_token }}