mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-10-30 14:17:40 +00:00
Compare commits
7 Commits
08169c23f3
...
test-pypi-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecdd8987bb | ||
|
|
d93dcf9c2a | ||
|
|
76b5b0c959 | ||
|
|
6ec79f8df6 | ||
|
|
03123402e6 | ||
|
|
132ae1e141 | ||
|
|
c925745b86 |
27
.github/workflows/pypi-release.yml
vendored
27
.github/workflows/pypi-release.yml
vendored
@@ -28,7 +28,7 @@ jobs:
|
||||
|
||||
|
||||
test-pypi-package:
|
||||
name: Test the built 📦 package works basically.
|
||||
name: Test the built package works basically.
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build
|
||||
@@ -42,18 +42,39 @@ jobs:
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
python-version: '3.11'
|
||||
|
||||
- name: Test that the basic pip built package runs without error
|
||||
run: |
|
||||
set -ex
|
||||
ls -alR
|
||||
|
||||
# Find and install the first .whl file
|
||||
find dist -type f -name "*.whl" -exec pip3 install {} \; -quit
|
||||
# Install the first wheel found in dist/
|
||||
WHEEL=$(find dist -type f -name "*.whl" -print -quit)
|
||||
echo Installing $WHEEL
|
||||
python3 -m pip install --upgrade pip
|
||||
python3 -m pip install "$WHEEL"
|
||||
changedetection.io -d /tmp -p 10000 &
|
||||
|
||||
sleep 3
|
||||
curl --retry-connrefused --retry 6 http://127.0.0.1:10000/static/styles/pure-min.css >/dev/null
|
||||
curl --retry-connrefused --retry 6 http://127.0.0.1:10000/ >/dev/null
|
||||
|
||||
# --- API test ---
|
||||
# This also means that the docs/api-spec.yml was shipped and could be read
|
||||
test -f /tmp/url-watches.json
|
||||
API_KEY=$(jq -r '.. | .api_access_token? // empty' /tmp/url-watches.json)
|
||||
echo Test API KEY is $API_KEY
|
||||
curl -X POST "http://127.0.0.1:10000/api/v1/watch" \
|
||||
-H "x-api-key: ${API_KEY}" \
|
||||
-H "Content-Type: application/json" \
|
||||
--show-error --fail \
|
||||
--retry 6 --retry-delay 1 --retry-connrefused \
|
||||
-d '{
|
||||
"url": "https://example.com",
|
||||
"title": "Example Site Monitor",
|
||||
"time_between_check": { "hours": 1 }
|
||||
}'
|
||||
|
||||
killall changedetection.io
|
||||
|
||||
|
||||
|
||||
@@ -37,6 +37,10 @@ def get_openapi_spec():
|
||||
from openapi_core import OpenAPI # Lazy import - saves ~10.7 MB on startup
|
||||
|
||||
spec_path = os.path.join(os.path.dirname(__file__), '../../docs/api-spec.yaml')
|
||||
if not os.path.exists(spec_path):
|
||||
# Possibly for pip3 packages
|
||||
spec_path = os.path.join(os.path.dirname(__file__), '../docs/api-spec.yaml')
|
||||
|
||||
with open(spec_path, 'r') as f:
|
||||
spec_dict = yaml.safe_load(f)
|
||||
_openapi_spec = OpenAPI.from_dict(spec_dict)
|
||||
|
||||
19
setup.py
19
setup.py
@@ -5,6 +5,8 @@ import re
|
||||
import sys
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
from setuptools.command.build_py import build_py
|
||||
import shutil
|
||||
|
||||
here = os.path.abspath(os.path.dirname(__file__))
|
||||
|
||||
@@ -22,6 +24,20 @@ def find_version(*file_paths):
|
||||
raise RuntimeError("Unable to find version string.")
|
||||
|
||||
|
||||
class BuildPyCommand(build_py):
|
||||
"""Custom build command to copy api-spec.yaml to the package."""
|
||||
def run(self):
|
||||
build_py.run(self)
|
||||
# Ensure the docs directory exists in the build output
|
||||
docs_dir = os.path.join(self.build_lib, 'changedetectionio', 'docs')
|
||||
os.makedirs(docs_dir, exist_ok=True)
|
||||
# Copy api-spec.yaml to the package
|
||||
shutil.copy(
|
||||
os.path.join(here, 'docs', 'api-spec.yaml'),
|
||||
os.path.join(docs_dir, 'api-spec.yaml')
|
||||
)
|
||||
|
||||
|
||||
install_requires = open('requirements.txt').readlines()
|
||||
|
||||
setup(
|
||||
@@ -37,9 +53,10 @@ setup(
|
||||
scripts=["changedetection.py"],
|
||||
author='dgtlmoon',
|
||||
url='https://changedetection.io',
|
||||
packages=['changedetectionio'],
|
||||
packages=find_packages(include=['changedetectionio', 'changedetectionio.*']),
|
||||
include_package_data=True,
|
||||
install_requires=install_requires,
|
||||
cmdclass={'build_py': BuildPyCommand},
|
||||
license="Apache License 2.0",
|
||||
python_requires=">= 3.10",
|
||||
classifiers=['Intended Audience :: Customer Service',
|
||||
|
||||
Reference in New Issue
Block a user