mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-24 10:07:26 +08:00
Some checks are pending
API / API Lint (push) Waiting to run
Documentation / update-autogenerated-docs (push) Waiting to run
Documentation / list-languages (push) Blocked by required conditions
Documentation / Sphinx (push) Blocked by required conditions
FOSSA / fossa-scan (push) Waiting to run
Linkcheck / Linkcheck (push) Waiting to run
macOS / macos (push) Waiting to run
Migrations / postgresql (push) Waiting to run
mypy / mypy (push) Waiting to run
Pre-commit check / pre-commit (push) Waiting to run
pylint check / pylint (push) Waiting to run
Rundev / Test development Docker (push) Waiting to run
jsonschema update / jsonschema-update (push) Waiting to run
Scorecard supply-chain security / Scorecard analysis (push) Waiting to run
Distribution / Build packages (push) Waiting to run
Distribution / Lint packages (push) Blocked by required conditions
Distribution / Build release notes (push) Waiting to run
Distribution / Publish to PyPI (push) Blocked by required conditions
Distribution / Publish to GitHub (push) Blocked by required conditions
Test / py3.12, latest deps (push) Waiting to run
Test / py3.12, minimal deps (push) Waiting to run
Test / py3.13, latest deps (push) Waiting to run
Test / py3.14, latest deps (push) Waiting to run
Test / py3.14, edge deps (push) Waiting to run
uv lock update / uv-update (push) Waiting to run
Add ComponentLink explicit through model for Component.links M2M with an optional category FK, enabling shared components to be organized into categories within the target project. Add a separate "Share in Projects" tab in component settings and add a dynamic category input based on selected project when creating a component link.
152 lines
4.4 KiB
Bash
Executable file
152 lines
4.4 KiB
Bash
Executable file
#!/bin/sh
|
|
|
|
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# Migrations test executor
|
|
|
|
# shellcheck source=/dev/null
|
|
. ci/lib.sh
|
|
|
|
if [ -n "$1" ]; then
|
|
TAG="weblate-$1"
|
|
else
|
|
echo "Missing version to migrate from!"
|
|
exit 1
|
|
fi
|
|
|
|
HEAD_COMMIT=$(git rev-parse HEAD)
|
|
|
|
# Copy the current file to survive checkout
|
|
MIGRATE_DIR=$(mktemp -d)
|
|
cp ci/migrate-override.txt "$MIGRATE_DIR/migrate-override.txt"
|
|
cp -r ci/migrate-scripts "$MIGRATE_DIR/"
|
|
|
|
print_step "Testing migration from $TAG..."
|
|
cleanup_database
|
|
check
|
|
if ! git fetch --depth 1 origin tag "$TAG"; then
|
|
git remote add upstream https://github.com/WeblateOrg/weblate.git
|
|
git fetch --depth 1 upstream tag "$TAG"
|
|
fi
|
|
check
|
|
git checkout "$TAG"
|
|
check
|
|
# Use clean Python environment for each version, this avoids problems when trying to downgrade from current versions
|
|
if semver_compare "$1" "<" "5.14"; then
|
|
uv venv --python python3.11 ".venv-$TAG"
|
|
else
|
|
uv venv --python python3.13 ".venv-$TAG"
|
|
fi
|
|
check
|
|
# shellcheck source=/dev/null
|
|
. ".venv-$TAG/bin/activate"
|
|
# Install matching Weblate package
|
|
# - Need to keep "ci" as Weblate 5.8 and older have the dependency separately
|
|
# - Force PyGobject 3.52 to be compatible with girepository-2.0
|
|
uv pip install --override "$MIGRATE_DIR/migrate-override.txt" -e ".[all,ci]"
|
|
check
|
|
if [ -n "$CI_DB_HOST" ]; then
|
|
echo "DATABASES['default']['HOST'] = '$CI_DB_HOST'" >> weblate/settings_test.py
|
|
check
|
|
fi
|
|
if [ -n "$CI_DB_PASSWORD" ]; then
|
|
echo "DATABASES['default']['PASSWORD'] = '$CI_DB_PASSWORD'" >> weblate/settings_test.py
|
|
check
|
|
fi
|
|
if [ -n "$CI_DB_PORT" ]; then
|
|
echo "DATABASES['default']['PORT'] = '$CI_DB_PORT'" >> weblate/settings_test.py
|
|
check
|
|
fi
|
|
./manage.py migrate
|
|
check
|
|
|
|
# Delete automatically created languages to be able to load fixture
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-languages.py"
|
|
check
|
|
|
|
# Load basic project fixture from the older version
|
|
./manage.py loaddata simple-project.json
|
|
check
|
|
|
|
# Setup migration testing
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-base.py"
|
|
check
|
|
|
|
# Add component links for through-model migration test
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-links.py"
|
|
check
|
|
|
|
# Add a pending unit
|
|
semver_compare "$1" "<" "5.12"
|
|
pending_migration_test=$?
|
|
if [ "$pending_migration_test" -eq 0 ]; then
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-pending.py"
|
|
check
|
|
fi
|
|
|
|
semver_compare "$1" ">" "5.5"
|
|
addon_scopes=$?
|
|
# Create addons with different scopes
|
|
semver_compare "$1" "<" "5.12"
|
|
file_format_params=$?
|
|
|
|
if [ "$addon_scopes" -eq 0 ] && [ "$file_format_params" -eq 0 ]; then
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-addon-customize.py"
|
|
check
|
|
fi
|
|
|
|
# File format encoding migration
|
|
semver_compare "$1" "<" "5.16"
|
|
file_format_encoding_merge=$?
|
|
if [ "$file_format_encoding_merge" -eq 0 ]; then
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-formats.py"
|
|
check
|
|
fi
|
|
|
|
# Add users with billing permission
|
|
semver_compare "$1" "<" "5.16"
|
|
billing_users_migrate=$?
|
|
if [ "$billing_users_migrate" -eq 0 ]; then
|
|
./manage.py shell < "$MIGRATE_DIR/migrate-scripts/setup-billing.py"
|
|
check
|
|
fi
|
|
|
|
git reset --hard
|
|
check
|
|
git checkout "$HEAD_COMMIT"
|
|
check
|
|
# Use CI environment
|
|
deactivate
|
|
check
|
|
run_coverage ./manage.py migrate
|
|
check
|
|
# Check migrated vote exists
|
|
uv run --all-extras ./manage.py shell < "$MIGRATE_DIR/migrate-scripts/assert-vote.py"
|
|
check
|
|
|
|
# Check component links survived through-model migration
|
|
uv run --all-extras ./manage.py shell < "$MIGRATE_DIR/migrate-scripts/assert-links.py"
|
|
check
|
|
|
|
# Check migrated pending unit
|
|
if [ "$pending_migration_test" -eq 0 ]; then
|
|
uv run --all-extras ./manage.py shell < "$MIGRATE_DIR/migrate-scripts/assert-pending.py"
|
|
fi
|
|
|
|
if [ "$addon_scopes" -eq 0 ] && [ "$file_format_params" -eq 0 ]; then
|
|
# check that relevant addon parameters have been migrated to file_format_params
|
|
uv run --all-extras ./manage.py shell < "$MIGRATE_DIR/migrate-scripts/assert-params.py"
|
|
check
|
|
fi
|
|
|
|
if [ "$file_format_encoding_merge" -eq 0 ]; then
|
|
# check that different encoding file-formats are merged into a single one with correct file format params
|
|
uv run --all-extras ./manage.py shell < "$MIGRATE_DIR/migrate-scripts/assert-encoding.py"
|
|
fi
|
|
|
|
if [ "$billing_users_migrate" -eq 0 ]; then
|
|
# Verify that the user has been migrated from the billing permission to the owner
|
|
uv run --all-extras ./manage.py shell < "$MIGRATE_DIR/migrate-scripts/assert-billing.py"
|
|
fi
|