Add SCP only tests #164
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: CI | |
"on": | |
push: | |
branches: | |
- master | |
- devel | |
pull_request: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cache-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Run poetry install | |
run: poetry install | |
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true' | |
- uses: psf/black@stable | |
# https://github.com/PyCQA/flake8/pull/1438 | |
- name: Install flake8 | |
run: | | |
source $VENV | |
pip install flake8 | |
- name: Lint with flake8 | |
run: | | |
poetry run flake8 nornir_paramiko --count --max-line-length=120 --show-source --statistics | |
- name: mypy | |
run: poetry run mypy nornir_paramiko | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cache-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Run poetry install | |
run: poetry install | |
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Start containers | |
run: docker-compose up -d | |
working-directory: tests | |
- name: Wait for containers to start | |
working-directory: tests | |
run: | | |
SSH_PORTS="2222 2223 2224" | |
for p in $SSH_PORTS; do | |
echo "::group::Wait for container $p to start" | |
for i in {1..20}; do ssh-keyscan -p $p localhost && break || echo -e "\033[0;33mNot started yet ($i)\033[0m" && sleep 1; done | |
if ! ssh-keyscan -p $p localhost; then | |
echo "::error container $p failed to start." | |
docker-compose logs | |
exit $CURL_RET | |
fi | |
echo -e "\033[0;32mSSH Container $p started\033[0m" | |
echo "::endgroup::" | |
done | |
- name: Run tests | |
run: poetry run pytest -v tests | |
docs: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
- name: Install Poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cache-poetry-dependencies | |
uses: actions/cache@v3 | |
with: | |
path: .venv | |
key: ${{ runner.os }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Run poetry install | |
run: poetry install | |
if: steps.cache-poetry-dependencies.outputs.cache-hit != 'true' | |
- name: Build docs | |
working-directory: ./docs | |
run: poetry run make html |