-
Notifications
You must be signed in to change notification settings - Fork 53
126 lines (102 loc) · 2.94 KB
/
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: test
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
schedule:
- cron: "0 5 * * *"
concurrency:
group: test-${{ github.head_ref }}
cancel-in-progress: true
env:
PYTHONUNBUFFERED: 1
FORCE_COLOR: 1
jobs:
test:
name: py ${{ matrix.python-version }}
strategy:
fail-fast: false
matrix:
# os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.8, 3.9, "3.10", 3.11]
node-version: [18]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: arduino/setup-task@v1
# ------------------------------------------------------------------------
# JS
- name: Setup Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Load cached node_modules
id: cached-node_modules
uses: actions/cache@v3
with:
path: js/node_modules
key: >
node_modules
${{ runner.os }}
node-${{ matrix.node-version }}
${{ hashFiles('js/package*.json') }}
- name: Install JS deps
if: steps.cached-node_modules.outputs.cache-hit != 'true'
run: |
task js-install
- name: Build JS
run: |
task js-build
# ------------------------------------------------------------------------
# Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
id: cached-python-env
with:
path: ${{ env.pythonLocation }}
key: >
python2
${{ runner.os }}
python-${{ matrix.python-version }}
${{ hashFiles('pyproject.toml') }}
${{ hashFiles('requirements/*') }}
- name: Install dependencies
if: steps.cached-python-env.outputs.cache-hit != 'true'
run: |
pip install -r requirements/pyproject.txt
- name: Install Hatch
run: |
pip install --upgrade hatch
- name: Print Python info
run: |
which python
python --version
which pip
pip --version
pip freeze
# ------------------------------------------------------------------------
# Test
- name: Build package
run: task build
- name: Install package
run: |
pip install dist/*.tar.gz
pip freeze
- name: Run tests
run: |
task test:all
task report
- name: Codecov
uses: codecov/codecov-action@v2
with:
file: ./coverage.xml
- name: Upload test results to GitHub
uses: actions/upload-artifact@v2
if: failure()
with:
name: test-results-py${{ matrix.python-version }}
path: htmlcov