Skip to content

Commit

Permalink
feat: add wlhosted extra
Browse files Browse the repository at this point in the history
This makes it easier to develop with the hosted environment.
  • Loading branch information
nijel committed Nov 6, 2024
1 parent f73e8ad commit 0639fd9
Show file tree
Hide file tree
Showing 11 changed files with 154 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ jobs:
- name: Prepare database
run: ./ci/prepare-database
- name: Migrate database
run: uv run ./manage.py migrate --noinput --traceback
run: uv run --no-sources ./manage.py migrate --noinput --traceback
- name: Generate OpenAPI
run: |
echo "::add-matcher::.github/matchers/spectacular.json"
uv run ./manage.py spectacular --urlconf="weblate.api.urls" > weblate-openapi.yaml
uv run --no-sources ./manage.py spectacular --urlconf="weblate.api.urls" > weblate-openapi.yaml
echo "::remove-matcher owner=spectacular::"
- name: openapi-lint
run: npx @redocly/cli lint --format github-actions weblate-openapi.yaml
4 changes: 2 additions & 2 deletions .github/workflows/migrations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ jobs:
run: ./ci/run-migrate 5.8
- name: Coverage
run: |
uv run coverage combine
uv run coverage xml
uv run --no-sources coverage combine
uv run --no-sources coverage xml
- uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ jobs:
python-version: '3.13'

- name: Run mypy
run: uv run --group types mypy --show-column-numbers weblate > mypy.log
run: uv run --no-sources --group types mypy --show-column-numbers weblate > mypy.log
# Temporary hack until we have this fully working
continue-on-error: true
- name: Report mypy
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
fi
- name: pre-commit (PEP 735)
if: steps.detect.outputs.method == 'pep735'
run: uv run --only-group pre-commit pre-commit run --all
run: uv run --no-sources --only-group pre-commit pre-commit run --all
env:
RUFF_OUTPUT_FORMAT: github
REUSE_OUTPUT_FORMAT: github
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pylint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,4 @@ jobs:
- name: Add pylint annotator
uses: pr-annotators/[email protected]
- name: Run pylint
run: uv run --only-group pylint pylint weblate/
run: uv run --no-sources --only-group pylint pylint weblate/
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,27 +93,27 @@ jobs:
- name: Prepare database
run: ./ci/prepare-database
- name: Compile MO files
run: uv run coverage run ./manage.py compilemessages
run: uv run --no-sources coverage run ./manage.py compilemessages
- name: Collect static files
run: uv run coverage run ./manage.py collectstatic --noinput --verbosity 0
run: uv run --no-sources coverage run ./manage.py collectstatic --noinput --verbosity 0
- name: Migrate database
run: uv run coverage run ./manage.py migrate --noinput --traceback
run: uv run --no-sources coverage run ./manage.py migrate --noinput --traceback
- name: Django checks
run: uv run coverage run ./manage.py check
run: uv run --no-sources coverage run ./manage.py check
- name: Demo import
run: uv run coverage run ./manage.py import_demo
run: uv run --no-sources coverage run ./manage.py import_demo
- name: Test with Django
run: |
uv run --all-extras pytest --junitxml=junit.xml --cov=weblate weblate
uv run --no-sources --all-extras pytest --junitxml=junit.xml --cov=weblate weblate
cp .coverage .coverage.pytest
- name: Test wsgi startup
env:
PYTHONPATH: .
run: uv run coverage run weblate/wsgi.py
run: uv run --no-sources coverage run weblate/wsgi.py
- name: Coverage
run: |
uv run coverage combine
uv run coverage xml
uv run --no-sources coverage combine
uv run --no-sources coverage xml
- uses: codecov/codecov-action@v4
with:
token: ${{secrets.CODECOV_TOKEN}}
Expand Down
2 changes: 1 addition & 1 deletion ci/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ check() {
}

run_coverage() {
uv run --all-extras coverage run --source . --append "$@"
uv run --no-sources --all-extras coverage run --source . --append "$@"
}

get_mysql_args() {
Expand Down
12 changes: 6 additions & 6 deletions ci/pip-install
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ set -e -x
if [ "${1:-latest}" = minimal ]; then
# Adjust deps to force minimal version
sed -i '/^ *"/ s/>=/==/' pyproject.toml
uv sync --all-extras --dev
uv sync --no-sources --all-extras --dev
elif [ "${1:-latest}" = edge ]; then
# Install from git / pre-release
mkdir -p build/packages
Expand All @@ -20,16 +20,16 @@ elif [ "${1:-latest}" = edge ]; then
# TODO: lxml can use wheels once xmlsec has one
# see https://github.com/xmlsec/python-xmlsec/issues/327
# Add downloaded zip, cannot add URL as uv complains about missing checksum
uv add --no-binary-package lxml build/packages/*
uv add --no-sources --no-binary-package lxml build/packages/*
# Allow pre-repeases
uv add --no-binary-package lxml --prerelease allow Django
uv sync --all-extras --dev --no-binary-package lxml
uv add --no-sources --no-binary-package lxml --prerelease allow Django
uv sync --no-sources --all-extras --dev --no-binary-package lxml
elif python -c 'import sys; sys.exit(0 if sys.version_info >= (3,13) else 1)'; then
# TODO: lxml can use wheels once xmlsec has one
# see https://github.com/xmlsec/python-xmlsec/issues/327
uv sync --frozen --all-extras --dev --no-binary-package lxml
uv sync --no-sources --frozen --all-extras --dev --no-binary-package lxml
else
uv sync --frozen --all-extras --dev
uv sync --no-sources --frozen --all-extras --dev
fi

# Verify that deps are consistent
Expand Down
2 changes: 1 addition & 1 deletion ci/run-migrate
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,5 @@ check
run_coverage ./manage.py migrate
check
# Check migrated vote exists
uv run --all-extras ./manage.py shell -c 'from weblate.trans.models import Vote; Vote.objects.get(value=1)'
uv run --no-sources --all-extras ./manage.py shell -c 'from weblate.trans.models import Vote; Vote.objects.get(value=1)'
check
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ saml = [
saml2idp = [
"djangosaml2idp==0.7.2"
]
wlhosted = [
"wlhosted"
]
wllegal = [
"wllegal>=2024.6"
]
Expand Down Expand Up @@ -530,3 +533,6 @@ zip-safe = false

[tool.setuptools.packages]
find = {namespaces = false}

[tool.uv.sources]
wlhosted = {path = "../hosted", editable = true}
127 changes: 124 additions & 3 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 0639fd9

Please sign in to comment.