-
Notifications
You must be signed in to change notification settings - Fork 54
122 lines (106 loc) · 4.05 KB
/
tests_multi_os.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
name: tests
on: [push, pull_request]
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
max-parallel: 6
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
python-version:
- "3.12"
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
# - uses: actions/cache@v3
# if: startsWith(runner.os, 'Linux')
# with:
# path: ~/.cache/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# - uses: actions/cache@v3
# if: startsWith(runner.os, 'macOS')
# with:
# path: ~/Library/Caches/pip
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
# - uses: actions/cache@v3
# if: startsWith(runner.os, 'Windows')
# with:
# path: ~\AppData\Local\pip\Cache
# key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
# restore-keys: |
# ${{ runner.os }}-pip-
- name: Install
# if: steps.devcache.outs.cache-hit != 'true'
run: |
git submodule update --init --recursive
pip install -r requirements.txt
python -m pip install --upgrade pip
pip install .[extras]
- name: Install test requirements
run: |
pip install sphinx recommonmark pytest==8.1.1 pytest-cov pyperclip
- name: Test with pytest
run: |
pytest -v --disable-pytest-warnings --cov-report=xml --cov=chepy --cov-config=.coveragerc tests/
coverage report -m
- name: Test plugins osx
if: matrix.os == 'macOS-latest'
run: |
sed -iE 's/enableplugins = false/enableplugins = true/' ~/.chepy/chepy.conf
sed -iE '/chepy/d' chepy/chepy_plugins/requirements.txt
pip install -r chepy/chepy_plugins/requirements.txt
pip install .
pytest -v --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
- name: Test plugins ubuntu
if: contains(matrix.os, 'ubuntu')
run: |
sed -i 's/enableplugins = false/enableplugins = true/' ~/.chepy/chepy.conf
sed -i '/chepy/d' chepy/chepy_plugins/requirements.txt
pip install -r chepy/chepy_plugins/requirements.txt
pip install .
pytest --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
- name: Test plugins windows
if: matrix.os == 'windows-latest'
run: |
Set-Content -Path ~/.chepy/chepy.conf -Value (Get-Content ~/.chepy/chepy.conf | %{$_ -replace "enableplugins = false","enableplugins = true"})
Set-Content -Path chepy/chepy_plugins/requirements.txt -Value (Get-Content -Path chepy/chepy_plugins/requirements.txt | Select-String -Pattern 'chepy' -NotMatch)
pip install -r chepy/chepy_plugins/requirements.txt
pytest --disable-pytest-warnings tests_plugins/
python -c "from chepy import Chepy"
# - name: Test with bandit
# run: |
# bandit --recursive chepy/ --ignore-nosec --skip B101,B413,B303,B310,B112,B304,B320,B410,B404,B608,B311,B324
# - name: Test docs
# if: ${{ !env.ACT }} && contains(matrix.os, 'ubuntu')
# run: |
# make -C docs/ clean html
publish:
runs-on: ubuntu-latest
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/[email protected]
- name: setup
uses: actions/[email protected]
with:
python-version: "3.7"
- name: build
run: |
python setup.py sdist
- name: publish
uses: pypa/[email protected]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}