Skip to content

Commit 29664a3

Browse files
authored
Update CI build and requirements (#61)
Updates the build and project structure into a src patterned project and fixes up dependencies and other stale CI configurations to get it working today.
1 parent c5e8151 commit 29664a3

File tree

19 files changed

+104
-128
lines changed

19 files changed

+104
-128
lines changed

.github/workflows/ci.yml

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,29 @@ on:
2121
- published
2222

2323
jobs:
24+
build:
25+
name: build
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Check out code
30+
uses: actions/checkout@v5
31+
32+
- name: Build pypsexec
33+
run: |
34+
python -m pip install build
35+
python -m build
36+
37+
- name: Upload built pypsexec
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: artifact
41+
path: ./dist/*
42+
2443
test:
2544
name: test
45+
needs:
46+
- build
2647
runs-on: ${{ matrix.os }}
2748

2849
strategy:
@@ -32,11 +53,12 @@ jobs:
3253
- ubuntu-latest
3354
- windows-latest
3455
python-version:
35-
- 3.7
36-
- 3.8
3756
- 3.9
3857
- '3.10'
3958
- '3.11'
59+
- '3.12'
60+
- '3.13'
61+
- '3.14'
4062
python-arch:
4163
- x86
4264
- x64
@@ -46,17 +68,23 @@ jobs:
4668
python-arch: x86
4769

4870
steps:
49-
- uses: actions/checkout@v3
71+
- uses: actions/checkout@v5
5072

51-
- uses: actions/setup-python@v4
73+
- uses: actions/setup-python@v6
5274
with:
5375
python-version: ${{ matrix.python-version }}
5476
architecture: ${{ matrix.python-arch }}
5577

78+
- uses: actions/download-artifact@v5
79+
with:
80+
name: artifact
81+
path: ./dist
82+
5683
- name: Extract OS name
5784
shell: bash
5885
run: |
5986
echo NAME=$( echo '${{ matrix.os }}' | tr '-' ' ' | awk '{print $1}' )
87+
echo "${NAME}"
6088
echo "name=${NAME}" >> $GITHUB_OUTPUT
6189
id: os
6290

@@ -73,24 +101,25 @@ jobs:
73101

74102
- name: Upload Test Results
75103
if: always()
76-
uses: actions/upload-artifact@v3
104+
uses: actions/upload-artifact@v4
77105
with:
78106
name: Unit Test Results (${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.python-arch }})
79107
path: ./junit/test-results.xml
80108

81109
- name: Upload Coverage Results
82110
if: always()
83-
uses: actions/upload-artifact@v3
111+
uses: actions/upload-artifact@v4
84112
with:
85113
name: Coverage Results (${{ matrix.os }} ${{ matrix.python-version }} ${{ matrix.python-arch }})
86114
path: ./coverage.xml
87115

88116
- name: Upload Coverage to codecov
89117
if: always()
90-
uses: codecov/codecov-action@v3
118+
uses: codecov/codecov-action@v5
91119
with:
92120
files: ./coverage.xml
93121
flags: ${{ steps.os.outputs.name }},py${{ matrix.python-version }},${{ matrix.python-arch }}
122+
token: ${{ secrets.CODECOV_TOKEN }}
94123

95124
publish:
96125
name: publish
@@ -102,20 +131,11 @@ jobs:
102131
id-token: write
103132

104133
steps:
105-
- uses: actions/checkout@v3
106-
107-
- name: Installing baseline packages
108-
run: python -m pip install --upgrade pip setuptools wheel
109-
110-
- name: Build package
111-
run: python setup.py sdist bdist_wheel
112-
113-
- name: Capture Wheel and SDist
114-
uses: actions/upload-artifact@v3
134+
- uses: actions/download-artifact@v5
115135
with:
116136
name: artifact
117-
path: dist/*
137+
path: ./dist
118138

119139
- name: Publish
120-
if: startsWith(github.ref, 'refs/tags/v')
140+
if: startsWith(github.event.release.tag_name, 'v')
121141
uses: pypa/gh-action-pypi-publish@release/v1

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
## 0.4.0 - TBD
44

5-
* Dropped Python 3.6, new minimum is 3.7
5+
* Dropped old Python versions, new minimum is 3.9
66

77
## 0.3.0 - 2021-10-22
88

MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
include LICENSE
22
include CHANGELOG.md
3-
include pypsexec/paexec.exe
3+
include src/pypsexec/paexec.exe

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ decoded by someone who knows the protocol.
7878

7979
## Requirements
8080

81-
* Python 3.7+
81+
* Python 3.9+
8282
* [smbprotocol](https://github.com/jborean93/smbprotocol)
8383

8484
To install pypsexec, simply run
@@ -353,18 +353,12 @@ by running;
353353

354354
```bash
355355
pip install -r requirements-test.txt
356-
357-
# you can also run tox by installing tox
358-
pip install tox
359356
```
360357

361358
From there to run the basic tests run;
362359

363360
```bash
364-
py.test -v --cov pypsexec --cov-report term-missing
365-
366-
# or with tox
367-
tox
361+
python -m pytest -v --cov pypsexec --cov-report term-missing
368362
```
369363

370364
There are extra tests that only run when certain environment variables are set.
@@ -374,7 +368,7 @@ To run these tests set the following variables;
374368
* `PYPSEXEC_USERNAME`: The username to use authenticate with
375369
* `PYPSEXEC_PASSWORD`: The password for `PYPSEXEC_USERNAME`
376370

377-
From there, you can just run `tox` or `py.test` with these environment
371+
From there, you can just run `pytest` with these environment
378372
variables to run the integration tests.
379373

380374

build_helpers/lib.sh

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,17 @@ lib::setup::python_requirements() {
4141
echo "::group::Installing Python Requirements"
4242
fi
4343

44-
echo "Upgrading baseline packages"
45-
python -m pip install --upgrade pip setuptools wheel
46-
4744
echo "Installing pypsexec"
48-
python -m pip install .
45+
# Getting the version is important so that pip prioritises our local dist
46+
python -m pip install build
47+
PACKAGE_VERSION="$( python -c "import build.util; print(build.util.project_wheel_metadata('.').get('Version'))" )"
48+
49+
python -m pip install pypsexec=="${PACKAGE_VERSION}" \
50+
--find-links ./dist \
51+
--verbose
4952

50-
echo "Install test requirements"
51-
python -m pip install -r requirements-test.txt
53+
echo "Installing dev dependencies"
54+
python -m pip install -r requirements-dev.txt
5255

5356
if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then
5457
echo "::endgroup::"
@@ -60,12 +63,6 @@ lib::sanity::run() {
6063
echo "::group::Running Sanity Checks"
6164
fi
6265

63-
python -m pycodestyle \
64-
pypsexec \
65-
--verbose \
66-
--show-source \
67-
--statistics
68-
6966
if [ x"${GITHUB_ACTIONS}" = "xtrue" ]; then
7067
echo "::endgroup::"
7168
fi

pyproject.toml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
[build-system]
2+
requires = [
3+
"setuptools >= 77.0.0", # Support for SPDX license expressions
4+
]
5+
build-backend = "setuptools.build_meta"
6+
7+
[project]
8+
name = "pypsexec"
9+
version = "0.4.0"
10+
description = "Run commands on a remote Windows host using SMB/RPC"
11+
readme = "README.md"
12+
requires-python = ">=3.9"
13+
license = "MIT"
14+
authors = [
15+
{ name = "Jordan Borean", email = "jborean93@gmail.com" }
16+
]
17+
keywords = ["windows", "psexec", "paexec", "remote", "python"]
18+
classifiers = [
19+
"Development Status :: 4 - Beta",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
26+
"Programming Language :: Python :: 3.14",
27+
]
28+
dependencies = [
29+
"smbprotocol",
30+
]
31+
32+
[project.urls]
33+
homepage = "https://github.com/jborean93/pypsexec"
34+
35+
[tool.setuptools.packages.find]
36+
where = ["src"]
37+
38+
[tool.pytest.ini_options]
39+
testpaths = "tests"
40+
addopts = "--import-mode=importlib"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
pycodestyle
1+
build
22
pytest
33
pytest-cov
44
pytest-mock

setup.cfg

Lines changed: 0 additions & 11 deletions
This file was deleted.

setup.py

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)