mirror of
https://github.com/WeblateOrg/weblate.git
synced 2026-07-27 18:43:42 +08:00
188 lines
6.1 KiB
YAML
Vendored
188 lines
6.1 KiB
YAML
Vendored
# Copyright © Michal Čihař <michal@weblate.org>
|
|
#
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
name: Documentation
|
|
|
|
on:
|
|
push:
|
|
branches-ignore:
|
|
- renovate/**
|
|
- weblate
|
|
- dependabot/**
|
|
pull_request:
|
|
schedule:
|
|
- cron: 30 5 * * *
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.run_id }}
|
|
cancel-in-progress: true
|
|
|
|
permissions:
|
|
contents: read
|
|
pull-requests: read
|
|
|
|
jobs:
|
|
update-autogenerated-docs:
|
|
runs-on: ubuntu-24.04
|
|
env:
|
|
CI_REDIS_HOST: 127.0.0.1
|
|
CI_REDIS_PORT: '6379'
|
|
CI_DB_PASSWORD: weblate
|
|
CI_DB_HOST: 127.0.0.1
|
|
CI_DB_PORT: '5432'
|
|
CI_SELENIUM: '1'
|
|
DJANGO_SETTINGS_MODULE: weblate.settings_test
|
|
services:
|
|
database:
|
|
image: postgres:18.4-alpine@sha256:9a8afca54e7861fd90fab5fdf4c42477a6b1cb7d293595148e674e0a3181de15
|
|
env:
|
|
POSTGRES_USER: postgres
|
|
POSTGRES_PASSWORD: weblate
|
|
ports:
|
|
- 5432:5432
|
|
options: >-
|
|
--health-cmd pg_isready
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
cache:
|
|
image: valkey/valkey:9.1.0-alpine@sha256:c9b77919daeba2c02ad954d0c844cc4e7142069d177b89c5fd771f405daf9e02
|
|
ports:
|
|
- 6379:6379
|
|
options: >-
|
|
--health-cmd "redis-cli ping"
|
|
--health-interval 10s
|
|
--health-timeout 5s
|
|
--health-retries 5
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Set up Python
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: '3.14'
|
|
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
with:
|
|
enable-cache: false
|
|
version: 0.11.29
|
|
- name: Install apt dependencies
|
|
run: sudo ./ci/apt-install
|
|
- name: Install Python dependencies
|
|
run: ./ci/pip-install latest
|
|
- name: Prepare database
|
|
run: ./ci/prepare-database
|
|
- name: Migrate database
|
|
run: uv run --frozen ./manage.py migrate --noinput --traceback
|
|
- run: make -C docs update-docs
|
|
|
|
- name: Prepare maintenance patch
|
|
uses: ./.github/actions/auto-commit
|
|
|
|
# Keep this outside the composite action; pre-commit.ci lite detects the
|
|
# top-level post step, and composites expose nested post hooks.
|
|
# The condition mirrors pre-commit-ci/lite-action's main.mjs user-PR check.
|
|
- name: Commit changes (external PR, pre-commit-ci-lite)
|
|
if: github.event_name == 'pull_request' && github.event.sender.type == 'User'
|
|
uses: pre-commit-ci/lite-action@5d6cc0eb514c891a40562a58a8e71576c5c7fb43 # v1.1.0
|
|
with:
|
|
msg: 'docs: Documentation snippets update'
|
|
|
|
list-languages:
|
|
runs-on: ubuntu-24.04
|
|
needs:
|
|
- update-autogenerated-docs
|
|
outputs:
|
|
languages: ${{ steps.list.outputs.languages }}
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- name: Get changed documentation translations
|
|
if: github.event_name == 'pull_request'
|
|
id: changed-documentation-translations
|
|
uses: tj-actions/changed-files@9426d40962ed5378910ee2e21d5f8c6fcbf2dd96 # v47.0.6
|
|
with:
|
|
files: docs/locales/**
|
|
use_rest_api: true
|
|
- name: Check documentation language scope
|
|
id: documentation-language-scope
|
|
env:
|
|
DOCUMENTATION_TRANSLATIONS_CHANGED: ${{ steps.changed-documentation-translations.outputs.any_changed }}
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
run: |
|
|
if [ "$EVENT_NAME" = "pull_request" ] && [ "$DOCUMENTATION_TRANSLATIONS_CHANGED" != "true" ]; then
|
|
echo "all_languages=false" >> "$GITHUB_OUTPUT"
|
|
else
|
|
echo "all_languages=true" >> "$GITHUB_OUTPUT"
|
|
fi
|
|
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
if: steps.documentation-language-scope.outputs.all_languages == 'true'
|
|
with:
|
|
enable-cache: false
|
|
version: 0.11.29
|
|
- name: Set up Python
|
|
if: steps.documentation-language-scope.outputs.all_languages == 'true'
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: '3.14'
|
|
- name: List documentation languages
|
|
id: list
|
|
env:
|
|
ALL_LANGUAGES: ${{ steps.documentation-language-scope.outputs.all_languages }}
|
|
run: |
|
|
if [ "$ALL_LANGUAGES" = "true" ]; then
|
|
uv run --no-project scripts/list-documentation-languages.py >>"$GITHUB_OUTPUT"
|
|
else
|
|
echo 'languages=["en"]' >> "$GITHUB_OUTPUT"
|
|
fi
|
|
|
|
translations:
|
|
runs-on: ubuntu-24.04
|
|
needs:
|
|
- list-languages
|
|
name: Sphinx
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
language: ${{ fromJson(needs.list-languages.outputs.languages) }}
|
|
env:
|
|
READTHEDOCS_LANGUAGE: ${{ matrix.language }}
|
|
|
|
steps:
|
|
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
with:
|
|
persist-credentials: false
|
|
- uses: astral-sh/setup-uv@11f9893b081a58869d3b5fccaea48c9e9e46f990 # v8.3.2
|
|
with:
|
|
enable-cache: false
|
|
version: 0.11.29
|
|
- name: Set up Python
|
|
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
|
|
with:
|
|
python-version: '3.14'
|
|
- name: Install apt dependencies
|
|
run: |
|
|
sudo apt update
|
|
sudo apt install -y graphviz
|
|
- name: Install Python dependencies
|
|
run: uv sync --only-group docs --frozen
|
|
- name: Sphinx build
|
|
run: |
|
|
. .venv/bin/activate
|
|
echo "::add-matcher::.github/matchers/sphinx.json"
|
|
./ci/run-docs
|
|
echo "::remove-matcher owner=sphinx::"
|
|
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
|
|
with:
|
|
name: Documentation ${{ matrix.language }}
|
|
path: docs/_build/html
|
|
|
|
build:
|
|
runs-on: ubuntu-slim
|
|
name: Sphinx
|
|
needs:
|
|
- translations
|
|
steps:
|
|
# This is dependency only job to collect all test results
|
|
- run: echo
|