-
Notifications
You must be signed in to change notification settings - Fork 184
142 lines (124 loc) · 3.47 KB
/
ci.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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
name: CI
on:
workflow_dispatch:
push:
branches:
- master
- main
pull_request:
branches:
- master
- main
release:
types:
- published
env:
FORCE_COLOR: 3
jobs:
pre-commit:
name: Format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- uses: pre-commit/[email protected]
- name: pylint
run: |
echo "::add-matcher::$GITHUB_WORKSPACE/.github/matchers/pylint.json"
pipx run --python python nox -s pylint
tests:
name: Tests on 🐍 ${{ matrix.python-version }} ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.8", "3.11"]
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- python-version: 'pypy-3.7'
os: ubuntu-latest
- python-version: 'pypy-3.9'
os: ubuntu-latest
- python-version: '3.6'
os: ubuntu-20.04
exclude:
- python-version: '3.6'
os: ubuntu-latest
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v3
if: runner.os == 'Linux' && startsWith(matrix.python-version, 'pypy')
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('setup.cfg') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: Install
run: |
pip install wheel coveralls pytest-github-actions-annotate-failures
pip install -e .[dev]
- name: Setup SSH tests
if: runner.os != 'Windows'
run: |
chmod 755 ~
mkdir -p ~/.ssh
chmod 755 ~/.ssh
echo "NoHostAuthenticationForLocalhost yes" >> ~/.ssh/config
echo "StrictHostKeyChecking no" >> ~/.ssh/config
ssh-keygen -q -f ~/.ssh/id_rsa -N ''
cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys
chmod 644 ~/.ssh/authorized_keys
ls -la ~
ssh localhost -vvv "echo 'Worked!'"
- name: Test with pytest
run: pytest --cov --run-optional-tests=ssh,sudo
- name: Upload coverage
run: coveralls --service=github
env:
COVERALLS_PARALLEL: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
COVERALLS_FLAG_NAME: test-${{ matrix.os }}-${{ matrix.python-version }}
dist:
name: Dist
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: hynek/build-and-inspect-python-package@v1
deploy:
name: Deploy
runs-on: ubuntu-22.04
needs: [dist]
if: github.event_name == 'release' && github.event.action == 'published'
steps:
- uses: actions/download-artifact@v3
with:
name: Packages
path: dist
- uses: pypa/[email protected]
with:
password: ${{ secrets.pypi_password }}
coverage:
needs: [tests]
runs-on: ubuntu-22.04
steps:
- uses: actions/setup-python@v4
with:
python-version: "3.x"
- name: Install coveralls
run: pip install coveralls
- name: Coveralls Finished
run: coveralls --service=github --finish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}