-
Notifications
You must be signed in to change notification settings - Fork 198
68 lines (63 loc) · 2.14 KB
/
main.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: CI
on:
pull_request:
branches: [master]
push:
branches: [master]
jobs:
linter:
name: flake8
runs-on: ubuntu-latest
steps:
- name: Step 1 - Checkout repository
uses: actions/checkout@v2
- name: Step 2 - Install python
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Step 3 - Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements-tox.txt
- name: Step 4 - Run flake with tox
run: "python -m tox -e flake8"
unit-tests:
name: "Python ${{ matrix.python-version }} ${{ matrix.tox-env }}"
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
tox-env: [""]
steps:
- name: Step 1 - Checkout repository
uses: actions/checkout@v2
- name: Step 2 - Install python
uses: actions/setup-python@v2
with:
python-version: "${{ matrix.python-version }}"
- name: Step 3 - Do some caching for python packages
uses: actions/cache@v2
id: cache-python-packages
with:
path: ${{ env.pythonLocation }}
key: ${{matrix.python-version}}-${{ hashFiles('requirements-tox.txt') }}-${{ env.pythonLocation }}
restore-keys: |
${{matrix.python-version}}-${{ hashFiles('requirements-tox.txt') }}-
- name: Step 3.5 - Install system deps for extras
run: |
sudo apt update && sudo apt-get install libsnappy-dev
- name: Step 4 - Install dependencies to run tox
if: steps.cache-python-packages.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip setuptools wheel
python -m pip install -r requirements-tox.txt
python -m pip install --upgrade tox-gh-actions
- name: Step 5 - Run tox targets for ${{ matrix.python-version }} ${{matrix.tox-env}}
run: |
if [[ -z "${{ matrix.tox-env }}" ]]
then
python -m tox
else
python -m tox -e ${{ matrix.tox-env }}
fi