mirror of
https://gh.wpcy.net/https://github.com/WeblateOrg/weblate.git
synced 2026-04-24 02:21:12 +08:00
Some checks failed
API / API Lint (push) Waiting to run
Documentation / update-snippets (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
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
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
Linkcheck / Linkcheck (push) Has been cancelled
jsonschema update / jsonschema-update (push) Has been cancelled
uv lock update / uv-update (push) Has been cancelled
* ci(services): use service containers instead of custom docker compose files * remove redis from test matrix * simplify ci test matrix * remove redundant CI_DATABASE checks * remove CI_DATABASE variable * CI_DATABASE is needed for migrations workflow * Update .github/workflows/migrations.yml * Update .github/workflows/migrations.yml --------- Co-authored-by: Michal Čihař <michal@cihar.com>
76 lines
1.6 KiB
Bash
76 lines
1.6 KiB
Bash
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
# shell library to help executing tests
|
|
|
|
# shellcheck shell=sh
|
|
|
|
if [ -z "$TERM" ]; then
|
|
export TERM=xterm-256color
|
|
fi
|
|
|
|
check() {
|
|
RET=$?
|
|
if [ $RET -ne 0 ]; then
|
|
exit $RET
|
|
fi
|
|
}
|
|
|
|
run_coverage() {
|
|
uv run --all-extras coverage run --source . --append "$@"
|
|
}
|
|
|
|
cleanup_database() {
|
|
rm -f weblate.db
|
|
|
|
if [ -n "$CI_DB_PASSWORD" ]; then
|
|
export PGPASSWORD="$CI_DB_PASSWORD"
|
|
fi
|
|
if [ -n "$CI_DB_PORT" ]; then
|
|
export PGPORT="$CI_DB_PORT"
|
|
fi
|
|
# shellcheck disable=SC2153
|
|
psql --host="$CI_DB_HOST" -c 'DROP DATABASE IF EXISTS weblate;' -U postgres
|
|
psql --host="$CI_DB_HOST" -c 'CREATE DATABASE weblate;' -U postgres
|
|
# Replaces weblate/utils/migrations/0001_alter_role.py
|
|
psql --host="$CI_DB_HOST" -c 'ALTER ROLE postgres SET timezone = UTC;' -U postgres
|
|
}
|
|
|
|
print_step() {
|
|
tput setaf 2
|
|
echo "$@"
|
|
tput sgr0
|
|
}
|
|
|
|
print_version() {
|
|
for cmd in "$@"; do
|
|
if command -v "$cmd"; then
|
|
$cmd --version
|
|
return
|
|
fi
|
|
done
|
|
echo "not found..."
|
|
}
|
|
|
|
semver_compare() {
|
|
[ "$#" -eq 3 ] || {
|
|
printf 'semver_compare: invalid number of arguments\n' >&2
|
|
return 2
|
|
}
|
|
|
|
ver1=$1
|
|
op=$2
|
|
ver2=$3
|
|
|
|
if [ "$ver1" = "$ver2" ]; then
|
|
[ "$op" = "=" ] || [ "$op" = "<=" ] || [ "$op" = ">=" ]
|
|
return
|
|
fi
|
|
|
|
if printf '%s\n' "$ver1" "$ver2" | sort -C -V; then
|
|
[ "$op" = "<" ] || [ "$op" = "<=" ]
|
|
else
|
|
[ "$op" = ">" ] || [ "$op" = ">=" ]
|
|
fi
|
|
}
|