Skip to content

clush: ignore '#' comments in --hostfile #271

clush: ignore '#' comments in --hostfile

clush: ignore '#' comments in --hostfile #271

Workflow file for this run

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', '3.14']
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 (WorkerPdsh) and bash-completion (completion tests)
run: |
set -euxo pipefail
sudo apt-get update
sudo apt-get -y install pdsh bash-completion
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 }}