keep-github-workflows-active 2.1.1__tar.gz → 2.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- keep_github_workflows_active-2.1.3/.github/actions/extract-metadata/action.yml +91 -0
- keep_github_workflows_active-2.1.1/.github/workflows/ci.yml → keep_github_workflows_active-2.1.3/.github/workflows/activate_workflows.yml +1 -1
- keep_github_workflows_active-2.1.3/.github/workflows/default_cicd_public.yml +287 -0
- keep_github_workflows_active-2.1.1/.github/workflows/release.yml → keep_github_workflows_active-2.1.3/.github/workflows/default_release_public.yml +41 -15
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/CHANGELOG.md +26 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/PKG-INFO +11 -10
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/pyproject.toml +17 -11
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/_utils.py +4 -38
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/toml_config.py +3 -25
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/__init__conf__.py +1 -1
- keep_github_workflows_active-2.1.3/tests/test_github_integration.py +90 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_metadata.py +3 -4
- keep_github_workflows_active-2.1.1/.github/workflows/do_not_change_ci_yml.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.devcontainer/devcontainer.json +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.devcontainer/settings.json +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.env.example +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.github/dependabot.yml +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.github/workflows/codeql.yml +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.gitignore +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.qlty/qlty.toml +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.snyk +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/CLAUDE.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/CONTRIBUTING.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/DEVELOPMENT.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/INSTALL.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/LICENSE +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/Makefile +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/README.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/codecov.yml +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/concept.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/docs/systemdesign/SECURITY.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/docs/systemdesign/module_reference.md +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/notebooks/Quickstart.ipynb +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/reset_git_history.sh +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/__init__.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/__main__.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/build.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_major.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_minor.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_patch.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_version.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/clean.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/cli.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/dependencies.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/dev.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/help.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/install.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/menu.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/push.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/release.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/run_cli.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/target_metadata.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/test.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/version_current.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/__init__.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/__main__.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/behaviors.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/cli.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/doctest.env +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/keep_github_workflow_active.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/py.typed +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/src/keep_github_workflows_active/sanitization.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/conftest.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_behaviors.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_cli.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_module_entry.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_sanitization.py +0 -0
- {keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_scripts.py +0 -0
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
name: Extract project metadata
|
|
2
|
+
description: >-
|
|
3
|
+
Parse pyproject.toml and expose project metadata as step outputs.
|
|
4
|
+
Requires Python and tomllib (or tomli for Python < 3.11) to be
|
|
5
|
+
available in the runner environment.
|
|
6
|
+
|
|
7
|
+
outputs:
|
|
8
|
+
PACKAGE_MODULE:
|
|
9
|
+
description: Python-importable module name (underscored)
|
|
10
|
+
value: ${{ steps.meta.outputs.PACKAGE_MODULE }}
|
|
11
|
+
PROJECT_NAME:
|
|
12
|
+
description: Project name from pyproject.toml
|
|
13
|
+
value: ${{ steps.meta.outputs.PROJECT_NAME }}
|
|
14
|
+
CLI_BIN:
|
|
15
|
+
description: CLI entry-point binary name
|
|
16
|
+
value: ${{ steps.meta.outputs.CLI_BIN }}
|
|
17
|
+
SRC_PATH:
|
|
18
|
+
description: Source directory path (e.g. "src")
|
|
19
|
+
value: ${{ steps.meta.outputs.SRC_PATH }}
|
|
20
|
+
COV_FAIL_UNDER:
|
|
21
|
+
description: Minimum coverage percentage from tool.coverage.report.fail_under
|
|
22
|
+
value: ${{ steps.meta.outputs.COV_FAIL_UNDER }}
|
|
23
|
+
COV_REPORT_FILE:
|
|
24
|
+
description: Coverage report filename (e.g. "coverage.xml")
|
|
25
|
+
value: ${{ steps.meta.outputs.COV_REPORT_FILE }}
|
|
26
|
+
PYTEST_VERBOSITY:
|
|
27
|
+
description: Pytest verbosity flag (e.g. "-vv")
|
|
28
|
+
value: ${{ steps.meta.outputs.PYTEST_VERBOSITY }}
|
|
29
|
+
BANDIT_SKIP_FLAG:
|
|
30
|
+
description: Bandit skip flag string (e.g. "-s B101,B601") or empty
|
|
31
|
+
value: ${{ steps.meta.outputs.BANDIT_SKIP_FLAG }}
|
|
32
|
+
|
|
33
|
+
runs:
|
|
34
|
+
using: composite
|
|
35
|
+
steps:
|
|
36
|
+
- name: Extract project metadata from pyproject.toml
|
|
37
|
+
id: meta
|
|
38
|
+
shell: python
|
|
39
|
+
run: |
|
|
40
|
+
import os
|
|
41
|
+
try:
|
|
42
|
+
import tomllib
|
|
43
|
+
except ModuleNotFoundError:
|
|
44
|
+
import tomli as tomllib
|
|
45
|
+
|
|
46
|
+
with open('pyproject.toml', 'rb') as f:
|
|
47
|
+
data = tomllib.load(f)
|
|
48
|
+
|
|
49
|
+
# --- [project] section ---
|
|
50
|
+
project = data['project']['name']
|
|
51
|
+
module = project.replace('-', '_')
|
|
52
|
+
dash = project.replace('_', '-')
|
|
53
|
+
scripts = list(data['project'].get('scripts', {}).keys())
|
|
54
|
+
cli_bin = scripts[0] if scripts else dash
|
|
55
|
+
|
|
56
|
+
# --- [tool.scripts.test] section ---
|
|
57
|
+
scripts_test = data.get('tool', {}).get('scripts', {}).get('test', {})
|
|
58
|
+
src_path = scripts_test.get('src-path', 'src')
|
|
59
|
+
pytest_verbosity = scripts_test.get('pytest-verbosity', '-vv')
|
|
60
|
+
cov_report_file = scripts_test.get('coverage-report-file', 'coverage.xml')
|
|
61
|
+
|
|
62
|
+
# --- [tool.coverage.report] section ---
|
|
63
|
+
cov_fail_under = (
|
|
64
|
+
data.get('tool', {}).get('coverage', {}).get('report', {}).get('fail_under', 90)
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# --- [tool.bandit] section ---
|
|
68
|
+
bandit_skips = data.get('tool', {}).get('bandit', {}).get('skips', [])
|
|
69
|
+
bandit_skip_flag = f"-s {','.join(bandit_skips)}" if bandit_skips else ""
|
|
70
|
+
|
|
71
|
+
# Write to GITHUB_OUTPUT for composite action outputs
|
|
72
|
+
with open(os.environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as out:
|
|
73
|
+
out.write(f"PROJECT_NAME={project}\n")
|
|
74
|
+
out.write(f"PACKAGE_MODULE={module}\n")
|
|
75
|
+
out.write(f"CLI_BIN={cli_bin}\n")
|
|
76
|
+
out.write(f"SRC_PATH={src_path}\n")
|
|
77
|
+
out.write(f"PYTEST_VERBOSITY={pytest_verbosity}\n")
|
|
78
|
+
out.write(f"COV_REPORT_FILE={cov_report_file}\n")
|
|
79
|
+
out.write(f"COV_FAIL_UNDER={cov_fail_under}\n")
|
|
80
|
+
out.write(f"BANDIT_SKIP_FLAG={bandit_skip_flag}\n")
|
|
81
|
+
|
|
82
|
+
# Also write to GITHUB_ENV so subsequent steps can use ${{ env.VAR }}
|
|
83
|
+
with open(os.environ['GITHUB_ENV'], 'a', encoding='utf-8') as env:
|
|
84
|
+
env.write(f"PROJECT_NAME={project}\n")
|
|
85
|
+
env.write(f"PACKAGE_MODULE={module}\n")
|
|
86
|
+
env.write(f"CLI_BIN={cli_bin}\n")
|
|
87
|
+
env.write(f"SRC_PATH={src_path}\n")
|
|
88
|
+
env.write(f"PYTEST_VERBOSITY={pytest_verbosity}\n")
|
|
89
|
+
env.write(f"COV_REPORT_FILE={cov_report_file}\n")
|
|
90
|
+
env.write(f"COV_FAIL_UNDER={cov_fail_under}\n")
|
|
91
|
+
env.write(f"BANDIT_SKIP_FLAG={bandit_skip_flag}\n")
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ main, master ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ main, master ]
|
|
8
|
+
schedule:
|
|
9
|
+
# Run daily at 3:17 AM UTC (off-peak hours, odd minute to avoid congestion)
|
|
10
|
+
- cron: '17 3 * * *'
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
test:
|
|
14
|
+
name: Tests (Python ${{ matrix.python }}, ${{ matrix.os }})
|
|
15
|
+
runs-on: ${{ matrix.os }}
|
|
16
|
+
strategy:
|
|
17
|
+
fail-fast: false
|
|
18
|
+
matrix:
|
|
19
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
20
|
+
# Test against all supported Python versions (3.10+)
|
|
21
|
+
python: ["3.10", "3.11", "3.12", "3.13", "3.14"]
|
|
22
|
+
env:
|
|
23
|
+
PYO3_USE_ABI3_FORWARD_COMPATIBILITY: "1"
|
|
24
|
+
PYTHONIOENCODING: "utf-8"
|
|
25
|
+
UV_LINK_MODE: "copy"
|
|
26
|
+
steps:
|
|
27
|
+
- uses: actions/checkout@v6
|
|
28
|
+
- uses: actions/setup-python@v6
|
|
29
|
+
with:
|
|
30
|
+
python-version: ${{ matrix.python }}
|
|
31
|
+
- name: Install uv
|
|
32
|
+
uses: astral-sh/setup-uv@v7
|
|
33
|
+
with:
|
|
34
|
+
enable-cache: true
|
|
35
|
+
prune-cache: false
|
|
36
|
+
|
|
37
|
+
- name: Install tomli (Python < 3.11)
|
|
38
|
+
shell: bash
|
|
39
|
+
run: python -c "import tomllib" 2>/dev/null || uv pip install tomli --system
|
|
40
|
+
|
|
41
|
+
- name: Extract project metadata
|
|
42
|
+
id: metadata
|
|
43
|
+
uses: ./.github/actions/extract-metadata
|
|
44
|
+
|
|
45
|
+
- name: Install journald prerequisites
|
|
46
|
+
if: runner.os == 'Linux'
|
|
47
|
+
shell: bash
|
|
48
|
+
run: |
|
|
49
|
+
sudo apt-get update
|
|
50
|
+
sudo apt-get install -y python3-systemd
|
|
51
|
+
|
|
52
|
+
- name: Install dev deps
|
|
53
|
+
shell: bash
|
|
54
|
+
run: |
|
|
55
|
+
uv pip install -e .[dev] --system
|
|
56
|
+
|
|
57
|
+
- name: Install Windows Event Log prerequisites
|
|
58
|
+
if: runner.os == 'Windows'
|
|
59
|
+
shell: bash
|
|
60
|
+
run: |
|
|
61
|
+
uv pip install pywin32 --system
|
|
62
|
+
|
|
63
|
+
- name: Restore ruff cache
|
|
64
|
+
id: ruff-cache
|
|
65
|
+
uses: actions/cache/restore@v5
|
|
66
|
+
with:
|
|
67
|
+
path: .ruff_cache
|
|
68
|
+
key: ruff-${{ runner.os }}-py${{ matrix.python }}-${{ github.sha }}
|
|
69
|
+
restore-keys: |
|
|
70
|
+
ruff-${{ runner.os }}-py${{ matrix.python }}-
|
|
71
|
+
ruff-${{ runner.os }}-
|
|
72
|
+
|
|
73
|
+
- name: Run ruff (lint + format)
|
|
74
|
+
id: ruff
|
|
75
|
+
continue-on-error: true
|
|
76
|
+
shell: bash
|
|
77
|
+
run: |
|
|
78
|
+
ruff check .
|
|
79
|
+
ruff format --check .
|
|
80
|
+
|
|
81
|
+
- name: Run pyright (type check)
|
|
82
|
+
id: pyright
|
|
83
|
+
continue-on-error: true
|
|
84
|
+
shell: bash
|
|
85
|
+
run: pyright
|
|
86
|
+
|
|
87
|
+
- name: Run pytest (tests + coverage)
|
|
88
|
+
id: pytest
|
|
89
|
+
continue-on-error: true
|
|
90
|
+
shell: bash
|
|
91
|
+
env:
|
|
92
|
+
TEST_VERBOSE: "1"
|
|
93
|
+
# Write coverage SQLite database to local disk — network mounts
|
|
94
|
+
# and stale journal files cause "database is locked" errors.
|
|
95
|
+
COVERAGE_FILE: "${{ runner.temp }}/.coverage"
|
|
96
|
+
run: >-
|
|
97
|
+
python -m pytest -m "not local_only"
|
|
98
|
+
--cov=${{ env.SRC_PATH }}/${{ env.PACKAGE_MODULE }}
|
|
99
|
+
--cov-report=term-missing
|
|
100
|
+
--cov-report=xml:${{ env.COV_REPORT_FILE }}
|
|
101
|
+
--cov-fail-under=${{ env.COV_FAIL_UNDER }}
|
|
102
|
+
${{ env.PYTEST_VERBOSITY }}
|
|
103
|
+
|
|
104
|
+
- name: Upload coverage to Codecov
|
|
105
|
+
if: >-
|
|
106
|
+
always()
|
|
107
|
+
&& steps.pytest.outcome == 'success'
|
|
108
|
+
&& matrix.os == 'ubuntu-latest'
|
|
109
|
+
&& matrix.python == '3.13'
|
|
110
|
+
uses: codecov/codecov-action@v5
|
|
111
|
+
with:
|
|
112
|
+
files: ${{ env.COV_REPORT_FILE }}
|
|
113
|
+
fail_ci_if_error: false
|
|
114
|
+
|
|
115
|
+
- name: Run import-linter (architecture)
|
|
116
|
+
id: importlinter
|
|
117
|
+
continue-on-error: true
|
|
118
|
+
shell: bash
|
|
119
|
+
run: lint-imports
|
|
120
|
+
|
|
121
|
+
- name: Run bandit (security scan)
|
|
122
|
+
id: bandit
|
|
123
|
+
continue-on-error: true
|
|
124
|
+
shell: bash
|
|
125
|
+
run: bandit -q -r ${{ env.SRC_PATH }}/${{ env.PACKAGE_MODULE }} ${{ env.BANDIT_SKIP_FLAG }}
|
|
126
|
+
|
|
127
|
+
- name: Run pip-audit (vulnerability scan)
|
|
128
|
+
id: pipaudit
|
|
129
|
+
continue-on-error: true
|
|
130
|
+
shell: python
|
|
131
|
+
run: |
|
|
132
|
+
import subprocess, sys
|
|
133
|
+
try:
|
|
134
|
+
import tomllib
|
|
135
|
+
except ModuleNotFoundError:
|
|
136
|
+
import tomli as tomllib
|
|
137
|
+
with open("pyproject.toml", "rb") as f:
|
|
138
|
+
data = tomllib.load(f)
|
|
139
|
+
vulns = data.get("tool", {}).get("pip-audit", {}).get("ignore-vulns", [])
|
|
140
|
+
cmd = ["pip-audit", "--skip-editable"]
|
|
141
|
+
for v in vulns:
|
|
142
|
+
cmd.extend(["--ignore-vuln", v])
|
|
143
|
+
sys.exit(subprocess.call(cmd))
|
|
144
|
+
|
|
145
|
+
- name: Check all steps passed
|
|
146
|
+
shell: bash
|
|
147
|
+
run: |
|
|
148
|
+
if [[ "${{ steps.ruff.outcome }}" != "success" ]]; then
|
|
149
|
+
echo "::error::Ruff check failed"
|
|
150
|
+
exit 1
|
|
151
|
+
fi
|
|
152
|
+
if [[ "${{ steps.pyright.outcome }}" != "success" ]]; then
|
|
153
|
+
echo "::error::Pyright check failed"
|
|
154
|
+
exit 1
|
|
155
|
+
fi
|
|
156
|
+
if [[ "${{ steps.pytest.outcome }}" != "success" ]]; then
|
|
157
|
+
echo "::error::Pytest failed"
|
|
158
|
+
exit 1
|
|
159
|
+
fi
|
|
160
|
+
if [[ "${{ steps.importlinter.outcome }}" != "success" ]]; then
|
|
161
|
+
echo "::error::Import-linter check failed"
|
|
162
|
+
exit 1
|
|
163
|
+
fi
|
|
164
|
+
if [[ "${{ steps.bandit.outcome }}" != "success" ]]; then
|
|
165
|
+
echo "::error::Bandit security scan failed"
|
|
166
|
+
exit 1
|
|
167
|
+
fi
|
|
168
|
+
if [[ "${{ steps.pipaudit.outcome }}" != "success" ]]; then
|
|
169
|
+
echo "::error::pip-audit vulnerability scan failed"
|
|
170
|
+
exit 1
|
|
171
|
+
fi
|
|
172
|
+
echo "All checks passed!"
|
|
173
|
+
|
|
174
|
+
- name: Build wheel/sdist
|
|
175
|
+
shell: bash
|
|
176
|
+
run: uv build
|
|
177
|
+
|
|
178
|
+
- name: Verify wheel install in clean env
|
|
179
|
+
shell: bash
|
|
180
|
+
run: |
|
|
181
|
+
uv venv .venv_wheel
|
|
182
|
+
. .venv_wheel/bin/activate 2>/dev/null || . .venv_wheel/Scripts/activate 2>/dev/null
|
|
183
|
+
uv pip install dist/*.whl
|
|
184
|
+
"$CLI_BIN" --version 2>/dev/null || python -m "$PACKAGE_MODULE" --version
|
|
185
|
+
|
|
186
|
+
- name: Prune uv cache
|
|
187
|
+
continue-on-error: true
|
|
188
|
+
shell: bash
|
|
189
|
+
run: uv cache prune --ci
|
|
190
|
+
|
|
191
|
+
- name: Save ruff cache
|
|
192
|
+
if: always() && steps.ruff-cache.outputs.cache-hit != 'true'
|
|
193
|
+
uses: actions/cache/save@v5
|
|
194
|
+
with:
|
|
195
|
+
path: .ruff_cache
|
|
196
|
+
key: ruff-${{ runner.os }}-py${{ matrix.python }}-${{ github.sha }}
|
|
197
|
+
|
|
198
|
+
pipx-uv:
|
|
199
|
+
name: pipx/uv verification (ubuntu)
|
|
200
|
+
runs-on: ubuntu-latest
|
|
201
|
+
steps:
|
|
202
|
+
- uses: actions/checkout@v6
|
|
203
|
+
- uses: actions/setup-python@v6
|
|
204
|
+
with:
|
|
205
|
+
python-version: "3.14"
|
|
206
|
+
|
|
207
|
+
- name: Install uv
|
|
208
|
+
uses: astral-sh/setup-uv@v7
|
|
209
|
+
with:
|
|
210
|
+
enable-cache: true
|
|
211
|
+
prune-cache: false
|
|
212
|
+
|
|
213
|
+
- name: Install tomli (Python < 3.11)
|
|
214
|
+
shell: bash
|
|
215
|
+
run: python -c "import tomllib" 2>/dev/null || uv pip install tomli --system
|
|
216
|
+
|
|
217
|
+
- name: Extract project metadata
|
|
218
|
+
id: metadata
|
|
219
|
+
uses: ./.github/actions/extract-metadata
|
|
220
|
+
|
|
221
|
+
- name: Build wheel
|
|
222
|
+
run: uv build
|
|
223
|
+
- name: pipx install from wheel
|
|
224
|
+
run: |
|
|
225
|
+
uv pip install --system pipx
|
|
226
|
+
pipx ensurepath
|
|
227
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
228
|
+
pipx install dist/*.whl
|
|
229
|
+
"$CLI_BIN" --version
|
|
230
|
+
|
|
231
|
+
- name: uv tool install
|
|
232
|
+
run: |
|
|
233
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
234
|
+
uv tool install --force .
|
|
235
|
+
"$CLI_BIN" --version
|
|
236
|
+
|
|
237
|
+
- name: Prune uv cache
|
|
238
|
+
continue-on-error: true
|
|
239
|
+
run: uv cache prune --ci
|
|
240
|
+
|
|
241
|
+
notebooks:
|
|
242
|
+
name: Execute notebooks (ubuntu, Python 3.14)
|
|
243
|
+
runs-on: ubuntu-latest
|
|
244
|
+
steps:
|
|
245
|
+
- uses: actions/checkout@v6
|
|
246
|
+
- uses: actions/setup-python@v6
|
|
247
|
+
with:
|
|
248
|
+
python-version: "3.14"
|
|
249
|
+
|
|
250
|
+
- name: Install uv
|
|
251
|
+
uses: astral-sh/setup-uv@v7
|
|
252
|
+
with:
|
|
253
|
+
enable-cache: true
|
|
254
|
+
prune-cache: false
|
|
255
|
+
|
|
256
|
+
- name: Install notebook runner deps
|
|
257
|
+
run: |
|
|
258
|
+
uv pip install --system nbclient nbformat ipykernel jupyter_client
|
|
259
|
+
python -m ipykernel install --user --name python3 --display-name "Python 3"
|
|
260
|
+
- name: Execute Quickstart notebook
|
|
261
|
+
env:
|
|
262
|
+
PIP_DISABLE_PIP_VERSION_CHECK: "1"
|
|
263
|
+
PIP_NO_INPUT: "1"
|
|
264
|
+
run: |
|
|
265
|
+
python - << 'PY'
|
|
266
|
+
from pathlib import Path
|
|
267
|
+
|
|
268
|
+
import nbformat
|
|
269
|
+
from nbclient import NotebookClient
|
|
270
|
+
|
|
271
|
+
nb_path = Path('notebooks/Quickstart.ipynb')
|
|
272
|
+
if not nb_path.exists():
|
|
273
|
+
raise SystemExit(f"Notebook not found: {nb_path}")
|
|
274
|
+
|
|
275
|
+
notebook = nbformat.read(nb_path, as_version=4)
|
|
276
|
+
client = NotebookClient(
|
|
277
|
+
notebook,
|
|
278
|
+
timeout=900,
|
|
279
|
+
kernel_name='python3',
|
|
280
|
+
allow_errors=False,
|
|
281
|
+
)
|
|
282
|
+
client.execute()
|
|
283
|
+
|
|
284
|
+
out_path = Path('notebooks/Quickstart-executed.ipynb')
|
|
285
|
+
nbformat.write(notebook, out_path)
|
|
286
|
+
print(f"Executed notebook written to: {out_path}")
|
|
287
|
+
PY
|
|
@@ -9,35 +9,61 @@ on:
|
|
|
9
9
|
workflow_dispatch: {}
|
|
10
10
|
|
|
11
11
|
jobs:
|
|
12
|
-
build
|
|
12
|
+
build:
|
|
13
13
|
runs-on: ubuntu-latest
|
|
14
14
|
permissions:
|
|
15
15
|
contents: read
|
|
16
|
+
env:
|
|
17
|
+
UV_LINK_MODE: "copy"
|
|
16
18
|
steps:
|
|
17
19
|
- uses: actions/checkout@v6
|
|
20
|
+
- uses: actions/setup-python@v6
|
|
21
|
+
with:
|
|
22
|
+
python-version: '3.14'
|
|
23
|
+
|
|
24
|
+
- name: Install uv
|
|
25
|
+
uses: astral-sh/setup-uv@v7
|
|
26
|
+
with:
|
|
27
|
+
enable-cache: true
|
|
28
|
+
prune-cache: false
|
|
29
|
+
|
|
30
|
+
- name: Build artifacts
|
|
31
|
+
run: uv build
|
|
32
|
+
|
|
33
|
+
- name: Upload artifacts
|
|
34
|
+
uses: actions/upload-artifact@v6
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/*
|
|
38
|
+
|
|
39
|
+
- name: Prune uv cache
|
|
40
|
+
continue-on-error: true
|
|
41
|
+
run: uv cache prune --ci
|
|
42
|
+
|
|
43
|
+
publish:
|
|
44
|
+
needs: build
|
|
45
|
+
runs-on: ubuntu-latest
|
|
46
|
+
environment: pypi
|
|
47
|
+
permissions:
|
|
48
|
+
contents: read
|
|
49
|
+
steps:
|
|
18
50
|
- name: Verify PyPI token is set
|
|
19
51
|
run: |
|
|
20
52
|
if [ -z "${{ secrets.PYPI_API_TOKEN }}" ]; then
|
|
21
|
-
echo "::error title=Missing PyPI token::Set the PYPI_API_TOKEN secret in GitHub repository settings to enable PyPI publishing on releases."
|
|
22
|
-
echo "See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions"
|
|
53
|
+
echo "::error title=Missing PyPI token::Set the PYPI_API_TOKEN secret in GitHub repository settings to enable PyPI publishing on releases."
|
|
54
|
+
echo "See: https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions"
|
|
23
55
|
exit 1
|
|
24
56
|
fi
|
|
25
|
-
|
|
57
|
+
|
|
58
|
+
- name: Download artifacts
|
|
59
|
+
uses: actions/download-artifact@v6
|
|
26
60
|
with:
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
python -m pip install --upgrade pip build
|
|
31
|
-
python -m build
|
|
61
|
+
name: dist
|
|
62
|
+
path: dist/
|
|
63
|
+
|
|
32
64
|
- name: Publish to PyPI
|
|
33
|
-
# Use the rolling major tag to get latest Twine/standards support (e.g., Core Metadata 2.4)
|
|
34
65
|
uses: pypa/gh-action-pypi-publish@release/v1
|
|
35
66
|
with:
|
|
36
67
|
password: ${{ secrets.PYPI_API_TOKEN }}
|
|
37
68
|
attestations: false
|
|
38
69
|
skip-existing: true
|
|
39
|
-
- name: Upload artifacts
|
|
40
|
-
uses: actions/upload-artifact@v5
|
|
41
|
-
with:
|
|
42
|
-
name: dist
|
|
43
|
-
path: dist/*
|
|
@@ -1,5 +1,31 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [2.1.3] - 2026-02-01
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- Fixed pyright errors in `test_metadata.py` by replacing `tomllib` (Python 3.11+) with `rtoml` for Python 3.10 compatibility
|
|
7
|
+
|
|
8
|
+
### Added
|
|
9
|
+
- Added `local_only` pytest marker for tests requiring GitHub credentials
|
|
10
|
+
- Created `test_github_integration.py` with dedicated GitHub API integration tests
|
|
11
|
+
- Tests marked `local_only` are excluded from public CI (`default_cicd_public.yml`) but run in `activate_workflows.yml` where secrets are available
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- Excluded `keep_github_workflow_active.py` from doctest collection (doctests access GitHub API when credentials available)
|
|
15
|
+
- Added setuptools vulnerability exceptions to pip-audit (PYSEC-2022-43012, PYSEC-2025-49, CVE-2024-6345) - transitive dependency pinned by build tools
|
|
16
|
+
|
|
17
|
+
## [2.1.2] - 2025-12-15
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
- Migrated scripts to use `rtoml` for TOML parsing
|
|
21
|
+
|
|
22
|
+
### Dependencies
|
|
23
|
+
- Bumped `lib_cli_exit_tools` to `>=2.2.2`
|
|
24
|
+
- Bumped `ruff` to `>=0.14.9`
|
|
25
|
+
- Bumped `textual` to `>=6.9.0`
|
|
26
|
+
- Bumped `import-linter` to `>=2.9`
|
|
27
|
+
- Added `rtoml>=0.13.0` as dev dependency for improved TOML handling
|
|
28
|
+
|
|
3
29
|
## [2.1.1] - 2025-12-08
|
|
4
30
|
|
|
5
31
|
### Changed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: keep_github_workflows_active
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.3
|
|
4
4
|
Summary: Template for python apps with registered cli commands
|
|
5
5
|
Project-URL: Homepage, https://github.com/bitranox/keep_github_workflows_active
|
|
6
6
|
Project-URL: Repository, https://github.com/bitranox/keep_github_workflows_active.git
|
|
@@ -15,22 +15,23 @@ Classifier: Operating System :: OS Independent
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3
|
|
16
16
|
Classifier: Programming Language :: Python :: 3 :: Only
|
|
17
17
|
Classifier: Typing :: Typed
|
|
18
|
-
Requires-Python: >=3.
|
|
19
|
-
Requires-Dist: lib-cli-exit-tools>=2.
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Requires-Dist: lib-cli-exit-tools>=2.2.4
|
|
20
20
|
Requires-Dist: pydantic>=2.12.5
|
|
21
21
|
Requires-Dist: requests>=2.32.5
|
|
22
|
-
Requires-Dist: rich-click>=1.9.
|
|
22
|
+
Requires-Dist: rich-click>=1.9.7
|
|
23
23
|
Provides-Extra: dev
|
|
24
|
-
Requires-Dist: bandit>=1.9.
|
|
25
|
-
Requires-Dist: build>=1.
|
|
24
|
+
Requires-Dist: bandit>=1.9.3; extra == 'dev'
|
|
25
|
+
Requires-Dist: build>=1.4.0; extra == 'dev'
|
|
26
26
|
Requires-Dist: codecov-cli>=11.2.6; extra == 'dev'
|
|
27
|
-
Requires-Dist: import-linter>=2.
|
|
27
|
+
Requires-Dist: import-linter>=2.9; extra == 'dev'
|
|
28
28
|
Requires-Dist: pip-audit>=2.10.0; extra == 'dev'
|
|
29
|
-
Requires-Dist: pyright>=1.1.
|
|
29
|
+
Requires-Dist: pyright[nodejs]>=1.1.408; extra == 'dev'
|
|
30
30
|
Requires-Dist: pytest-cov>=7.0.0; extra == 'dev'
|
|
31
31
|
Requires-Dist: pytest>=9.0.2; extra == 'dev'
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
32
|
+
Requires-Dist: rtoml>=0.13.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: ruff>=0.14.14; extra == 'dev'
|
|
34
|
+
Requires-Dist: textual>=7.5.0; extra == 'dev'
|
|
34
35
|
Requires-Dist: twine>=6.2.0; extra == 'dev'
|
|
35
36
|
Description-Content-Type: text/markdown
|
|
36
37
|
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "keep_github_workflows_active"
|
|
3
|
-
version = "2.1.
|
|
3
|
+
version = "2.1.3"
|
|
4
4
|
description = "Template for python apps with registered cli commands"
|
|
5
5
|
readme = "README.md"
|
|
6
|
-
requires-python = ">=3.
|
|
7
|
-
dependencies = ["rich-click>=1.9.
|
|
6
|
+
requires-python = ">=3.10"
|
|
7
|
+
dependencies = ["rich-click>=1.9.7", "lib_cli_exit_tools>=2.2.4", "requests>=2.32.5", "pydantic>=2.12.5"]
|
|
8
8
|
license = { text = "MIT" }
|
|
9
9
|
authors = [{ name = "bitranox", email = "bitranox@gmail.com" }]
|
|
10
10
|
keywords = ["logging", "rich", "cli", "terminal", "ansi"]
|
|
@@ -26,15 +26,16 @@ Issues = "https://github.com/bitranox/keep_github_workflows_active/issues"
|
|
|
26
26
|
dev = [
|
|
27
27
|
"pytest>=9.0.2",
|
|
28
28
|
"pytest-cov>=7.0.0",
|
|
29
|
-
"ruff>=0.14.
|
|
30
|
-
"pyright>=1.1.
|
|
31
|
-
"bandit>=1.9.
|
|
32
|
-
"build>=1.
|
|
29
|
+
"ruff>=0.14.14",
|
|
30
|
+
"pyright[nodejs]>=1.1.408",
|
|
31
|
+
"bandit>=1.9.3",
|
|
32
|
+
"build>=1.4.0",
|
|
33
33
|
"twine>=6.2.0",
|
|
34
34
|
"codecov-cli>=11.2.6",
|
|
35
35
|
"pip-audit>=2.10.0",
|
|
36
|
-
"textual>=
|
|
37
|
-
"import-linter>=2.
|
|
36
|
+
"textual>=7.5.0",
|
|
37
|
+
"import-linter>=2.9",
|
|
38
|
+
"rtoml>=0.13.0"
|
|
38
39
|
]
|
|
39
40
|
|
|
40
41
|
[project.scripts]
|
|
@@ -69,7 +70,7 @@ exclude = [
|
|
|
69
70
|
]
|
|
70
71
|
|
|
71
72
|
[tool.pytest.ini_options]
|
|
72
|
-
addopts = ["--doctest-modules"]
|
|
73
|
+
addopts = ["--doctest-modules", "--ignore=src/keep_github_workflows_active/keep_github_workflow_active.py"]
|
|
73
74
|
doctest_optionflags = ["ELLIPSIS", "NORMALIZE_WHITESPACE"]
|
|
74
75
|
pythonpath = ["src"]
|
|
75
76
|
markers = [
|
|
@@ -78,6 +79,7 @@ markers = [
|
|
|
78
79
|
"os_macos: test exercises macOS-only behavior",
|
|
79
80
|
"os_posix: test exercises behavior requiring POSIX semantics",
|
|
80
81
|
"os_linux: test exercises Linux-only behavior",
|
|
82
|
+
"local_only: test requires local credentials or resources unavailable in CI",
|
|
81
83
|
]
|
|
82
84
|
|
|
83
85
|
[tool.coverage.run]
|
|
@@ -141,4 +143,8 @@ layers = [
|
|
|
141
143
|
# Known vulnerabilities to ignore (unfixable or accepted risk)
|
|
142
144
|
# GHSA-4xh5-x5gv-qwph: py library ReDoS (no fix available, low risk)
|
|
143
145
|
# PYSEC-2022-42969: same as above (alias)
|
|
144
|
-
|
|
146
|
+
# setuptools 65.5.0: transitive dep, pinned by build tools
|
|
147
|
+
# PYSEC-2022-43012: fixed in 65.5.1
|
|
148
|
+
# PYSEC-2025-49: fixed in 78.1.1
|
|
149
|
+
# CVE-2024-6345: fixed in 70.0.0
|
|
150
|
+
ignore-vulns = ["GHSA-4xh5-x5gv-qwph", "PYSEC-2022-42969", "PYSEC-2022-43012", "PYSEC-2025-49", "CVE-2024-6345"]
|
|
@@ -35,6 +35,8 @@ from subprocess import CompletedProcess
|
|
|
35
35
|
from typing import Any, Mapping, Sequence, cast
|
|
36
36
|
from urllib.parse import urlparse
|
|
37
37
|
|
|
38
|
+
import rtoml
|
|
39
|
+
|
|
38
40
|
|
|
39
41
|
@dataclass
|
|
40
42
|
class RunResult:
|
|
@@ -118,41 +120,6 @@ class ProjectMetadata:
|
|
|
118
120
|
|
|
119
121
|
_PYPROJECT_DATA_CACHE: dict[Path, dict[str, object]] = {}
|
|
120
122
|
_METADATA_CACHE: dict[Path, ProjectMetadata] = {}
|
|
121
|
-
_toml_module: Any = None
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
def _get_toml_module() -> Any:
|
|
125
|
-
"""Return tomllib (Python 3.11+) or tomli backport (Python 3.9-3.10).
|
|
126
|
-
|
|
127
|
-
Purpose
|
|
128
|
-
-------
|
|
129
|
-
Ensure TOML parsing works across Python 3.9+ by using the standard
|
|
130
|
-
library tomllib on 3.11+ and falling back to the tomli package
|
|
131
|
-
on earlier versions.
|
|
132
|
-
|
|
133
|
-
Returns
|
|
134
|
-
-------
|
|
135
|
-
module
|
|
136
|
-
Either tomllib or tomli with identical interfaces.
|
|
137
|
-
|
|
138
|
-
Raises
|
|
139
|
-
------
|
|
140
|
-
ModuleNotFoundError
|
|
141
|
-
If neither tomllib nor tomli can be imported.
|
|
142
|
-
"""
|
|
143
|
-
global _toml_module
|
|
144
|
-
if _toml_module is not None:
|
|
145
|
-
return _toml_module
|
|
146
|
-
|
|
147
|
-
# Use tomllib (Python 3.11+) or tomli backport (Python 3.9-3.10)
|
|
148
|
-
# Both have the same interface, so we can treat them interchangeably
|
|
149
|
-
try:
|
|
150
|
-
import tomllib as module # type: ignore[import-not-found]
|
|
151
|
-
except ModuleNotFoundError:
|
|
152
|
-
import tomli as module # type: ignore[import-not-found,no-redef]
|
|
153
|
-
|
|
154
|
-
_toml_module = module
|
|
155
|
-
return module
|
|
156
123
|
|
|
157
124
|
|
|
158
125
|
def run(
|
|
@@ -250,10 +217,9 @@ def _load_pyproject(pyproject: Path) -> dict[str, object]:
|
|
|
250
217
|
if cached is not None:
|
|
251
218
|
return cached
|
|
252
219
|
raw_text = path.read_text(encoding="utf-8")
|
|
253
|
-
toml_module = _get_toml_module()
|
|
254
220
|
try:
|
|
255
|
-
parsed_obj =
|
|
256
|
-
except
|
|
221
|
+
parsed_obj = rtoml.loads(raw_text)
|
|
222
|
+
except rtoml.TomlParsingError as exc: # pragma: no cover - invalid pyproject fails fast
|
|
257
223
|
msg = f"Unable to parse {path}: {exc}"
|
|
258
224
|
raise ValueError(msg) from exc
|
|
259
225
|
data = {str(key): value for key, value in parsed_obj.items()}
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/toml_config.py
RENAMED
|
@@ -8,9 +8,10 @@ from __future__ import annotations
|
|
|
8
8
|
|
|
9
9
|
from dataclasses import dataclass, field
|
|
10
10
|
from pathlib import Path
|
|
11
|
-
from types import ModuleType
|
|
12
11
|
from typing import Any, cast
|
|
13
12
|
|
|
13
|
+
import rtoml
|
|
14
|
+
|
|
14
15
|
__all__ = [
|
|
15
16
|
"CleanConfig",
|
|
16
17
|
"CoverageReportConfig",
|
|
@@ -25,28 +26,6 @@ __all__ = [
|
|
|
25
26
|
]
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
# ---------------------------------------------------------------------------
|
|
29
|
-
# TOML Module Loading
|
|
30
|
-
# ---------------------------------------------------------------------------
|
|
31
|
-
|
|
32
|
-
_toml_module: ModuleType | None = None
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def _get_toml_module() -> ModuleType:
|
|
36
|
-
"""Return the TOML parsing module (tomllib or tomli fallback)."""
|
|
37
|
-
global _toml_module
|
|
38
|
-
if _toml_module is not None:
|
|
39
|
-
return _toml_module
|
|
40
|
-
|
|
41
|
-
try:
|
|
42
|
-
import tomllib as module # type: ignore[import-not-found]
|
|
43
|
-
except ImportError:
|
|
44
|
-
import tomli as module # type: ignore[import-not-found,no-redef]
|
|
45
|
-
|
|
46
|
-
_toml_module = module
|
|
47
|
-
return module
|
|
48
|
-
|
|
49
|
-
|
|
50
29
|
# ---------------------------------------------------------------------------
|
|
51
30
|
# Helper Functions for Safe Value Extraction
|
|
52
31
|
# ---------------------------------------------------------------------------
|
|
@@ -436,8 +415,7 @@ class PyprojectConfig:
|
|
|
436
415
|
def from_path(cls, path: Path) -> PyprojectConfig:
|
|
437
416
|
"""Load configuration from a pyproject.toml file."""
|
|
438
417
|
try:
|
|
439
|
-
|
|
440
|
-
data: dict[str, Any] = toml.loads(path.read_text(encoding="utf-8"))
|
|
418
|
+
data: dict[str, Any] = rtoml.loads(path.read_text(encoding="utf-8"))
|
|
441
419
|
return cls.from_dict(data)
|
|
442
420
|
except Exception:
|
|
443
421
|
return cls()
|
|
@@ -24,7 +24,7 @@ name = "keep_github_workflows_active"
|
|
|
24
24
|
#: Human-readable summary shown in CLI help output.
|
|
25
25
|
title = "Template for python apps with registered cli commands"
|
|
26
26
|
#: Current release version pulled from ``pyproject.toml`` by automation.
|
|
27
|
-
version = "2.1.
|
|
27
|
+
version = "2.1.3"
|
|
28
28
|
#: Repository homepage presented to users.
|
|
29
29
|
homepage = "https://github.com/bitranox/keep_github_workflows_active"
|
|
30
30
|
#: Author attribution surfaced in CLI output.
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"""GitHub API integration tests requiring real credentials.
|
|
2
|
+
|
|
3
|
+
These tests exercise the actual GitHub API and require:
|
|
4
|
+
- SECRET_GITHUB_OWNER environment variable or .env entry
|
|
5
|
+
- SECRET_GITHUB_TOKEN environment variable or .env entry
|
|
6
|
+
|
|
7
|
+
Marked with local_only to exclude from CI runs.
|
|
8
|
+
"""
|
|
9
|
+
|
|
10
|
+
from __future__ import annotations
|
|
11
|
+
|
|
12
|
+
import pytest
|
|
13
|
+
|
|
14
|
+
from keep_github_workflows_active import keep_github_workflow_active as keep_active
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def _has_github_credentials() -> bool:
|
|
18
|
+
"""Check if GitHub credentials are available."""
|
|
19
|
+
try:
|
|
20
|
+
keep_active.get_owner()
|
|
21
|
+
keep_active.get_github_token()
|
|
22
|
+
return True
|
|
23
|
+
except RuntimeError:
|
|
24
|
+
return False
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
pytestmark = [pytest.mark.local_only]
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
@pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
|
|
31
|
+
def test_get_repositories_returns_list() -> None:
|
|
32
|
+
"""Verify get_repositories returns a list of repository names."""
|
|
33
|
+
owner = keep_active.get_owner()
|
|
34
|
+
token = keep_active.get_github_token()
|
|
35
|
+
|
|
36
|
+
repos = keep_active.get_repositories(owner=owner, github_token=token)
|
|
37
|
+
|
|
38
|
+
assert isinstance(repos, list)
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
@pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
|
|
42
|
+
def test_get_workflows_returns_list_for_each_repository() -> None:
|
|
43
|
+
"""Verify get_workflows returns workflow filenames for repositories."""
|
|
44
|
+
owner = keep_active.get_owner()
|
|
45
|
+
token = keep_active.get_github_token()
|
|
46
|
+
repos = keep_active.get_repositories(owner=owner, github_token=token)
|
|
47
|
+
|
|
48
|
+
for repo in repos[:3]: # Limit to first 3 repos to avoid rate limits
|
|
49
|
+
workflows = keep_active.get_workflows(owner=owner, repository=repo, github_token=token)
|
|
50
|
+
assert isinstance(workflows, list)
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
@pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
|
|
54
|
+
def test_get_workflow_runs_returns_list_for_each_repository() -> None:
|
|
55
|
+
"""Verify get_workflow_runs returns run IDs for repositories."""
|
|
56
|
+
owner = keep_active.get_owner()
|
|
57
|
+
token = keep_active.get_github_token()
|
|
58
|
+
repos = keep_active.get_repositories(owner=owner, github_token=token)
|
|
59
|
+
|
|
60
|
+
for repo in repos[:3]: # Limit to first 3 repos to avoid rate limits
|
|
61
|
+
run_ids = keep_active.get_workflow_runs(owner=owner, repository=repo, github_token=token)
|
|
62
|
+
assert isinstance(run_ids, list)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
|
|
66
|
+
def test_enable_all_workflows_completes_without_error(capsys: pytest.CaptureFixture[str]) -> None:
|
|
67
|
+
"""Verify enable_all_workflows runs successfully."""
|
|
68
|
+
owner = keep_active.get_owner()
|
|
69
|
+
token = keep_active.get_github_token()
|
|
70
|
+
|
|
71
|
+
keep_active.enable_all_workflows(owner=owner, github_token=token)
|
|
72
|
+
|
|
73
|
+
captured = capsys.readouterr()
|
|
74
|
+
assert f"Activating and maintaining all workflows for owner {owner}" in captured.out
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
@pytest.mark.skipif(not _has_github_credentials(), reason="GitHub credentials not available")
|
|
78
|
+
def test_enable_workflow_handles_known_repository() -> None:
|
|
79
|
+
"""Verify enable_workflow returns success message for a known workflow."""
|
|
80
|
+
owner = keep_active.get_owner()
|
|
81
|
+
token = keep_active.get_github_token()
|
|
82
|
+
|
|
83
|
+
result = keep_active.enable_workflow(
|
|
84
|
+
owner=owner,
|
|
85
|
+
repository="lib_path",
|
|
86
|
+
workflow_filename="python-package.yml",
|
|
87
|
+
github_token=token,
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
assert result # Non-empty result message
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_metadata.py
RENAMED
|
@@ -5,9 +5,9 @@ from __future__ import annotations
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import Any, cast
|
|
7
7
|
import runpy
|
|
8
|
-
import tomllib
|
|
9
8
|
|
|
10
9
|
import pytest
|
|
10
|
+
import rtoml
|
|
11
11
|
|
|
12
12
|
PROJECT_ROOT = Path(__file__).resolve().parent.parent
|
|
13
13
|
PYPROJECT_PATH = PROJECT_ROOT / "pyproject.toml"
|
|
@@ -15,8 +15,7 @@ TARGET_FIELDS = ("name", "title", "version", "homepage", "author", "author_email
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
def _load_pyproject() -> dict[str, Any]:
|
|
18
|
-
|
|
19
|
-
return tomllib.load(stream)
|
|
18
|
+
return rtoml.load(PYPROJECT_PATH)
|
|
20
19
|
|
|
21
20
|
|
|
22
21
|
def _resolve_init_conf_path(pyproject: dict[str, Any]) -> Path:
|
|
@@ -52,7 +51,7 @@ def _load_init_conf_metadata(init_conf_path: Path) -> dict[str, str]:
|
|
|
52
51
|
if not fragments:
|
|
53
52
|
raise AssertionError("No metadata assignments found in __init__conf__.py")
|
|
54
53
|
metadata_text = "[metadata]\n" + "\n".join(fragments)
|
|
55
|
-
parsed =
|
|
54
|
+
parsed = rtoml.loads(metadata_text)
|
|
56
55
|
metadata_table = cast(dict[str, str], parsed["metadata"])
|
|
57
56
|
return metadata_table
|
|
58
57
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/.github/dependabot.yml
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/notebooks/Quickstart.ipynb
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/reset_git_history.sh
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/__init__.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/__main__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_major.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_minor.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_patch.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/bump_version.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/dependencies.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/install.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/release.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/run_cli.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/target_metadata.py
RENAMED
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/scripts/version_current.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_behaviors.py
RENAMED
|
File without changes
|
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_module_entry.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_sanitization.py
RENAMED
|
File without changes
|
{keep_github_workflows_active-2.1.1 → keep_github_workflows_active-2.1.3}/tests/test_scripts.py
RENAMED
|
File without changes
|