weblate/rundev.sh
Kartik Ohri 12d27937f1
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 (#18243)
* 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>
2026-02-27 12:52:18 +01:00

92 lines
1.9 KiB
Bash
Executable file

#!/usr/bin/env bash
# Copyright © Michal Čihař <michal@weblate.org>
#
# SPDX-License-Identifier: GPL-3.0-or-later
set -e
GREEN='\033[0;32m'
NC='\033[0m'
# Used by docker-compose-plugin
WEBLATE_PORT=8080
export WEBLATE_PORT
WEBLATE_HOST=localhost:$WEBLATE_PORT
export WEBLATE_HOST
# Used by docker on start
USER_ID=$(id -u)
export USER_ID
GROUP_ID=$(id -g)
export GROUP_ID
cd dev-docker/
build() {
mkdir -p data
# Build the container
docker compose build --build-arg USER_ID="$USER_ID" --build-arg GROUP_ID="$GROUP_ID"
cat > .env << EOT
USER_ID="$USER_ID"
GROUP_ID="$GROUP_ID"
WEBLATE_PORT="$WEBLATE_PORT"
WEBLATE_HOST="$WEBLATE_HOST"
EOT
}
case $1 in
stop)
docker compose down
;;
logs)
shift
docker compose logs "$@"
;;
compilemessages)
shift
docker compose exec -T -e WEBLATE_ADD_APPS=weblate.billing,weblate.legal weblate weblate compilemessages
;;
test)
shift
docker compose exec -T \
--env CI_BASE_DIR=/tmp \
--env CI_DB_HOST=database \
--env CI_DB_NAME=weblate \
--env CI_DB_USER=weblate \
--env CI_DB_PASSWORD=weblate \
--env DJANGO_SETTINGS_MODULE=weblate.settings_test \
--workdir /app/src \
weblate pytest -n auto "$@"
;;
check)
shift
docker compose exec -T weblate weblate check "$@"
;;
build)
build
;;
wait)
TIMEOUT=0
while ! docker compose ps | grep "weblate-dev:.*healthy"; do
echo "Waiting for the container startup..."
sleep 5
docker compose ps
TIMEOUT=$((TIMEOUT + 1))
if [ $TIMEOUT -gt 60 ]; then
docker compose logs
exit 1
fi
done
;;
start | restart | "")
build
# Start it up
docker compose up -d --force-recreate
echo -e "\n${GREEN}Running development version of Weblate on http://${WEBLATE_HOST}/${NC}\n"
echo "maildev is running on http://localhost:1080/"
;;
*)
docker compose "$@"
;;
esac