Skip to content

Merge branch 'cowrie:main' into main #1

Merge branch 'cowrie:main' into main

Merge branch 'cowrie:main' into main #1

Workflow file for this run

# SPDX-FileCopyrightText: 2025-2026 Michel Oosterhof <michel@oosterhof.net>
#
# SPDX-License-Identifier: BSD-3-Clause
---
name: test-pypi
on: # yamllint disable-line rule:truthy
push:
# Publish `main` as to test.pypi.org
branches:
- main
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-pypi-publish:
name: Upload commit to PyPI
runs-on: ubuntu-latest
environment:
name: test-pypi
url: https://test.pypi.org/p/cowrie
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
# retrieve your distributions here, need fetch-depth to get metadata for version
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
python-version: 3.13
cache: pip
- name: Install dependencies
run: |
python -m pip install build==1.5.0 setuptools==83.0.0 setuptools-scm==9.2.0 twine==6.2.0 wheel==0.45.1 packaging==26.2
- name: Build and check
run: |
SETUPTOOLS_SCM_OVERRIDES_FOR_COWRIE='{local_scheme="no-local-version"}' python -m build
twine check --strict dist/*
- name: Publish package distributions to PyPI
if: ${{ github.repository == 'cowrie/cowrie' }}
uses: pypa/gh-action-pypi-publish@dc37677b2e1c63e2034f94d8a5b11f265b73ba33
with:
repository-url: https://test.pypi.org/legacy/
verbose: true
print-hash: true
- name: Sleep for publishing
run: sleep 60s
shell: bash
- name: Smoke-test installed package
if: ${{ github.repository == 'cowrie/cowrie' }}
run: |
set -eu
# Install exactly the version this run built; a plain
# 'pip install cowrie' can silently test the previous release
# when the index has not propagated yet.
EXPECTED=$(python -c "from setuptools_scm import get_version; print(get_version(local_scheme='no-local-version'))")
python -m pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple/ "cowrie==${EXPECTED}"
# entry point is registered and on PATH
which cowrie
# bundled package data is reachable via importlib.resources
python -c "from cowrie.core.resources import read_data_bytes; assert read_data_bytes('fs.pickle')"
python -c "from cowrie.shell.honeyfs import read_honeyfs_bytes; assert b'root:' in read_honeyfs_bytes('etc/passwd')"
python -c "from cowrie.core.config import readConfigFile; p = readConfigFile([]); assert 'honeypot' in p.sections()"
# cowrie init materialises a working state directory
mkdir -p /tmp/cowrie-smoke
cd /tmp/cowrie-smoke
cowrie init
test -f etc/cowrie.cfg
test -d var/log/cowrie
test -d var/lib/cowrie/downloads
test -d var/lib/cowrie/tty
test -d var/run
# cowrie start refuses to run from uninitialised dirs
rm -rf /tmp/cowrie-empty && mkdir /tmp/cowrie-empty && cd /tmp/cowrie-empty
cowrie start 2>&1 | grep -q "not initialized"