forked from clustershell/clustershell
-
Notifications
You must be signed in to change notification settings - Fork 0
124 lines (122 loc) · 4 KB
/
nosetests.yml
File metadata and controls
124 lines (122 loc) · 4 KB
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
name: ClusterShell tests
on: [push, pull_request, merge_group]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13']
include:
- os: ubuntu-22.04
python-version: '3.7'
name: Tests with Python ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5.2.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
set -euxo pipefail
python -m pip install --upgrade pip
pip install coverage .
- name: Allow us to SSH passwordless to localhost
run: |
set -euxo pipefail
chmod og-rw ~
ssh-keygen -f ~/.ssh/id_rsa -N ""
cp ~/.ssh/{id_rsa.pub,authorized_keys}
- name: Avoid ssh "known hosts" warnings
run: |
set -euxo pipefail
printf '%s\n %s\n %s\n' 'Host *' 'StrictHostKeyChecking no' 'LogLevel ERROR' >> ~/.ssh/config
- name: Set Python paths when sshing for gateway tests
run: |
set -euxo pipefail
PYTHON_SITE_PACKAGES=$(python -c "import site; print(site.getsitepackages()[0])")
sed -i "1iexport CLUSTERSHELL_GW_PYTHON_EXECUTABLE=$(which python)" ~/.bashrc
sed -i "2iexport PYTHONPATH=\$PYTHONPATH:$PYTHON_SITE_PACKAGES" ~/.bashrc
head -3 ~/.bashrc
ssh 127.0.0.2 'python -c "import ClusterShell; print(ClusterShell.__file__)"'
- name: Install pdsh to test WorkerPdsh
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get -y install pdsh
sudo sh -c 'echo ssh > /etc/pdsh/rcmd_default'
- name: Add tests/bin to remote PATH
run: |
set -euxo pipefail
sed -i "1iexport PATH=$PWD/tests/bin:\$PATH" ~/.bashrc
head -1 ~/.bashrc
ssh 127.0.0.2 which hostname
ssh 127.0.0.2 hostname
- name: Post to Slack (start)
continue-on-error: true
id: slack-start
uses: slackapi/slack-github-action@v1.24.0
with:
channel-id: 'C07GRMDK3'
payload: |
{
"text": "${{ github.workflow }}: Python ${{ matrix.python-version }} tests started (In Progress)",
"attachments": [
{
"color": "#ECB32D",
"fields": [
{
"title": "Branch",
"short": true,
"value": "${{ github.ref }}"
},
{
"title": "Actor",
"short": true,
"value": "${{ github.actor }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
- name: Run tests
id: tests
run: |
set -euxo pipefail
python --version
export CLUSTERSHELL_GW_PYTHON_EXECUTABLE=$(which python)
coverage run --branch --source=ClusterShell -m unittest discover -v -s tests -p '*Test.py' -t .
coverage report -m
- name: Post to Slack (end)
if: always()
continue-on-error: true
id: slack-end
uses: slackapi/slack-github-action@v1.24.0
with:
channel-id: 'C07GRMDK3'
update-ts: ${{ steps.slack-start.outputs.ts }}
payload: |
{
"text": "${{ github.workflow }}: Python ${{ matrix.python-version }} tests completed",
"attachments": [
{
"fields": [
{
"title": "Branch",
"short": true,
"value": "${{ github.ref }}"
},
{
"title": "Status",
"short": true,
"value": "${{ job.status }}"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}