Skip to content

Commit 5c29f1c

Browse files
committed
Adding test step for upgrades
1 parent a0b8d8e commit 5c29f1c

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

.github/workflows/test-stack-reusable-workflow.yml

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,30 @@ jobs:
105105
docker run test-changedetectionio bash -c 'python3 -m unittest changedetectionio.tests.unit.test_semver'
106106
docker run test-changedetectionio bash -c 'python3 -m unittest changedetectionio.tests.unit.test_html_to_text'
107107
108+
upgrade-path-test:
109+
runs-on: ubuntu-latest
110+
needs: build
111+
timeout-minutes: 25
112+
env:
113+
PYTHON_VERSION: ${{ inputs.python-version }}
114+
steps:
115+
- uses: actions/checkout@v6
116+
117+
- name: Check upgrade works without error
118+
run: |
119+
git checkout 0.49.1
120+
python3 -mvenv .venv-${{ inputs.python-version }}
121+
source .venv-${{ inputs.python-version }}/bin/activate
122+
pip3 install -r requirements.txt
123+
pip install 'pyOpenSSL>=23.2.0'
124+
timeout 20 python3 ./changedetection.py -C -d /tmp/data
125+
126+
# check it runs up to this version
127+
git checkout ${{ github.ref_name }}
128+
pip3 install -r requirements.txt
129+
timeout 20 python3 ./changedetection.py -d /tmp/data
130+
131+
108132
# Basic pytest tests with ancillary services
109133
basic-tests:
110134
runs-on: ubuntu-latest
@@ -516,3 +540,63 @@ jobs:
516540
exit 1
517541
fi
518542
docker rm sig-test
543+
544+
# Upgrade path test
545+
upgrade-path-test:
546+
runs-on: ubuntu-latest
547+
needs: build
548+
timeout-minutes: 25
549+
env:
550+
PYTHON_VERSION: ${{ inputs.python-version }}
551+
steps:
552+
- uses: actions/checkout@v6
553+
554+
- name: Set up Python ${{ env.PYTHON_VERSION }}
555+
uses: actions/setup-python@v6
556+
with:
557+
python-version: ${{ env.PYTHON_VERSION }}
558+
559+
- name: Check upgrade works without error
560+
run: |
561+
echo "=== Testing upgrade path from 0.49.1 to ${{ github.ref_name }} ==="
562+
563+
# Checkout old version and create datastore
564+
git checkout 0.49.1
565+
python3 -m venv .venv
566+
source .venv/bin/activate
567+
pip install -r requirements.txt
568+
pip install 'pyOpenSSL>=23.2.0'
569+
570+
echo "=== Running version 0.49.1 to create datastore ==="
571+
timeout 20 python3 ./changedetection.py -C -d /tmp/data || {
572+
echo "Failed to start old version"
573+
exit 1
574+
}
575+
576+
# Upgrade to current version
577+
git checkout ${{ github.ref_name }}
578+
pip install -r requirements.txt
579+
580+
echo "=== Running current version ${{ github.ref_name }} with old datastore ==="
581+
timeout 20 python3 ./changedetection.py -d /tmp/data > /tmp/upgrade-test.log 2>&1 || {
582+
echo "Failed to start current version"
583+
cat /tmp/upgrade-test.log
584+
exit 1
585+
}
586+
587+
# Verify success
588+
echo "=== Verifying upgrade succeeded ==="
589+
grep -q "Loading existing datastore" /tmp/upgrade-test.log || {
590+
echo "ERROR: Datastore not loaded"
591+
cat /tmp/upgrade-test.log
592+
exit 1
593+
}
594+
595+
echo "✓ Upgrade test passed: 0.49.1 → ${{ github.ref_name }}"
596+
597+
- name: Upload upgrade test logs
598+
if: always()
599+
uses: actions/upload-artifact@v6
600+
with:
601+
name: upgrade-test-logs-py${{ env.PYTHON_VERSION }}
602+
path: /tmp/upgrade-test.log

0 commit comments

Comments
 (0)