From efa1082e1a8b2b6f2405d2f5f3333e88ce0d8c63 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Fri, 27 Oct 2023 13:59:48 +0800 Subject: [PATCH 01/10] Checquea submodule con actions/checkout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Hacerlo por nuestra cuenta no trae ningún beneficio, ya que actions/checkout ya usa --depth=1 (además de otras opciones). --- .github/workflows/main.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e8e7dd1474..44f4c73229 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -12,15 +12,13 @@ jobs: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@v4 + with: + submodules: 'true' - name: Preparar Python v3.11 uses: actions/setup-python@v4 with: python-version: "3.11" cache: "pip" - - name: Sincronizar con CPython - run: | - git submodule update --init --depth=1 cpython - - name: Instalar dependencias run: | sudo apt-get update sudo apt-get install -y hunspell hunspell-es gettext language-pack-es From 34e4479addc6121eb957e7084fb5116730ad989c Mon Sep 17 00:00:00 2001 From: rtobar Date: Sat, 21 Oct 2023 04:22:05 +0800 Subject: [PATCH 02/10] =?UTF-8?q?Separa=20pasos=20de=20instalaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Esto nos permitirá ver mejor en qué pasó en particular nos estamos demorando más. --- .github/workflows/main.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 44f4c73229..c0eefb065b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,10 +19,15 @@ jobs: with: python-version: "3.11" cache: "pip" + - name: Instalar dependencias de sistema run: | sudo apt-get update sudo apt-get install -y hunspell hunspell-es gettext language-pack-es + - name: Instalar dependencias de Python + run: | python -m pip install -r requirements.txt + - name: Listar paquetes y versiones + run: | pip list pospell --version powrap --version From b5709aa040a85b35a26092a2f62ddaa21aa2fe40 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Wed, 1 Nov 2023 15:24:11 +0800 Subject: [PATCH 03/10] Agrupa y comenta steps del job Test MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Todos los pasos estaban antes aglomerados. Ya que queremos agregar más pasos, es beneficioso agrupar los pasos existentes para clarificar qué lógica se está llevando a cabo. Signed-off-by: Rodrigo Tobar --- .github/workflows/main.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c0eefb065b..1ab2f8bfdf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -11,9 +11,12 @@ jobs: name: Test runs-on: ubuntu-22.04 steps: + # Obtención del código - uses: actions/checkout@v4 with: submodules: 'true' + + # Instalación de dependencias - name: Preparar Python v3.11 uses: actions/setup-python@v4 with: @@ -31,6 +34,8 @@ jobs: pip list pospell --version powrap --version + + # Chequeos a realizar - name: TRANSLATORS run: | diff -Naur TRANSLATORS <(LANG=es python scripts/sort.py < TRANSLATORS) @@ -42,6 +47,8 @@ jobs: - name: Pospell run: | python scripts/check_spell.py + + # Construcción de la documentación - name: Construir documentación run: | # FIXME: Relative paths for includes in 'cpython' From 9bc18db74a8e41cb4bbb75febbf6447f9dc925e4 Mon Sep 17 00:00:00 2001 From: rtobar Date: Sat, 21 Oct 2023 04:43:54 +0800 Subject: [PATCH 04/10] =?UTF-8?q?Configura=20apt/dpkg=20para=20minimizar?= =?UTF-8?q?=20tiempos=20de=20instalaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Esto se logra deshabilitando algunos triggers (nostros nos encargamos de postgresql-common) y corriendo con ciertas opciones, como deshabilitando fsyncs --- .github/workflows/main.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1ab2f8bfdf..65f24bd543 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -22,6 +22,10 @@ jobs: with: python-version: "3.11" cache: "pip" + - name: Configura dpkg/apt para correr de manera eficiente + uses: abbbi/github-actions-tune@v1 + - name: Deshabilita triggers de postgresql-common + run: sudo sed -i '/postgresql-common/d' /var/lib/dpkg/triggers/File - name: Instalar dependencias de sistema run: | sudo apt-get update From 01f3d8c80d74c74ed15156f85d3f1e91a35bad81 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Fri, 27 Oct 2023 13:57:24 +0800 Subject: [PATCH 05/10] No corre apt update MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Para los paquetes que usamos no es necesario realizar esta operación, con lo cual nos ahorramos un poco de tiempo. --- .github/workflows/main.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65f24bd543..e262e15e5e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,6 @@ jobs: run: sudo sed -i '/postgresql-common/d' /var/lib/dpkg/triggers/File - name: Instalar dependencias de sistema run: | - sudo apt-get update sudo apt-get install -y hunspell hunspell-es gettext language-pack-es - name: Instalar dependencias de Python run: | From c3adbc2db8225bb2da3732306ac66f4b345e4cc7 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Fri, 27 Oct 2023 13:29:14 +0800 Subject: [PATCH 06/10] Instala locales-all MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Al instalar locales-all se evita la generación de los locales en español al momento de instalar language-pack-es. Esta generación de locales toma un tiempo considerable de CPU, por lo que instalar locales-all es finalmente menos costoso. --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e262e15e5e..058f6d653b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -28,7 +28,7 @@ jobs: run: sudo sed -i '/postgresql-common/d' /var/lib/dpkg/triggers/File - name: Instalar dependencias de sistema run: | - sudo apt-get install -y hunspell hunspell-es gettext language-pack-es + sudo apt-get install -y hunspell hunspell-es gettext language-pack-es locales-all - name: Instalar dependencias de Python run: | python -m pip install -r requirements.txt From 5fab9f9e88a84c5e80e28d526a2044dcd4b4f734 Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Wed, 1 Nov 2023 15:36:39 +0800 Subject: [PATCH 07/10] =?UTF-8?q?Agrega=20c=C3=A1lculo=20de=20archivos=20.?= =?UTF-8?q?po=20a=20chequear?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El job Test del workflow Test corre durante pull requests y durante pushes al branch principal del repositorio. En el primer caso, los PRs contienen normalmente un solo archivo .po que ha cambido, pero aún así los chequeos que se corren en CI se hacen contra todos los archivos .po, lo cual es ineficiente. En particular, pospell toma alrededor de un minuto y medio en correr, cuando tomaría alrededor de un segundo en correr sobre un solo archivo. Este commit introduce una serie de pasos en el job Test que calcula la lista de archivos .po sobre los cuales se correrán el resto de los chequeos. Cuando el trabajo corre como parte de un PR, sólo los archivos .po que han cambiado en el PR (si es que los hay) son incluidos. Cuando el trabajo corre como parte de un push a la rama principal del repositorio, todos los archivos son incluidos. Signed-off-by: Rodrigo Tobar --- .github/workflows/main.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 058f6d653b..da0e10100a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,6 +15,9 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'true' + # Necesario para que tj-actions/changed-files corra + # dentro de un tiempo adecuado + fetch-depth: 2 # Instalación de dependencias - name: Preparar Python v3.11 @@ -38,6 +41,32 @@ jobs: pospell --version powrap --version + # Cálculo de los archivos .po a verificar. + # En el caso de un PR, sólo se chequean los .po que se están editando, + # mientras que en caseo de un push a las ramas 3.* queremos revisar + # todos los archivos + - name: Obtiene la lista de archivos .po con cambios (sólo en PRs) + if: github.event_name == 'pull_request' + id: changed-po-files + uses: tj-actions/changed-files@v40 + with: + files: | + **/*.po + - name: Calcula lista de archivos .po a revisar + id: po-files-to-check + env: + PO_FILES_TO_CHECK: ${{ steps.changed-po-files.conclusion == 'skipped' && '**/*.po' || steps.changed-po-files.outputs.all_changed_files }} + run: | + echo "po_files_to_check=$PO_FILES_TO_CHECK" >> $GITHUB_OUTPUT + echo "any_po_files_to_check=`test -n \"$PO_FILES_TO_CHECK\" && echo true || echo false`" >> $GITHUB_OUTPUT + - name: Muestra outputs de steps anteriores para debugueo + env: + CHANGED_PO_FILES: ${{ toJson(steps.changed-po-files) }} + PO_FILES_TO_CHECK: ${{ toJson(steps.po-files-to-check) }} + run: | + echo "$PO_FILES_TO_CHECK" + echo "$CHANGED_PO_FILES" + # Chequeos a realizar - name: TRANSLATORS run: | From b4b709e54f35b0526fae00f5f7ad8ab4ed31d33d Mon Sep 17 00:00:00 2001 From: Rodrigo Tobar Date: Wed, 1 Nov 2023 15:53:24 +0800 Subject: [PATCH 08/10] =?UTF-8?q?Chequea=20s=C3=B3lo=20archivos=20.po=20pr?= =?UTF-8?q?eviamente=20calculados?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mírese el commit anterior para más detalles. Signed-off-by: Rodrigo Tobar --- .github/workflows/main.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index da0e10100a..11b1159d5c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -72,13 +72,14 @@ jobs: run: | diff -Naur TRANSLATORS <(LANG=es python scripts/sort.py < TRANSLATORS) - name: Powrap - run: powrap --check --quiet **/*.po + if: steps.po-files-to-check.outputs.any_po_files_to_check == 'true' + run: powrap --check --quiet ${{ steps.po-files-to-check.outputs.po_files_to_check }} - name: Sphinx lint - run: | - sphinx-lint */*.po + if: steps.po-files-to-check.outputs.any_po_files_to_check == 'true' + run: sphinx-lint ${{ steps.po-files-to-check.outputs.po_files_to_check }} - name: Pospell - run: | - python scripts/check_spell.py + if: steps.po-files-to-check.outputs.any_po_files_to_check == 'true' + run: python scripts/check_spell.py ${{ steps.po-files-to-check.outputs.po_files_to_check }} # Construcción de la documentación - name: Construir documentación From d6abde7895c568a351753678c540fe4da6f7cb18 Mon Sep 17 00:00:00 2001 From: rtobar Date: Thu, 2 Nov 2023 05:20:46 +0800 Subject: [PATCH 09/10] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Cristián Maureira-Fredes --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 11b1159d5c..a3a3665228 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v4 with: submodules: 'true' - # Necesario para que tj-actions/changed-files corra + # Necesario para que tj-actions/changed-files se ejecute # dentro de un tiempo adecuado fetch-depth: 2 @@ -25,7 +25,7 @@ jobs: with: python-version: "3.11" cache: "pip" - - name: Configura dpkg/apt para correr de manera eficiente + - name: Configura dpkg/apt para ejecutarse de manera eficiente uses: abbbi/github-actions-tune@v1 - name: Deshabilita triggers de postgresql-common run: sudo sed -i '/postgresql-common/d' /var/lib/dpkg/triggers/File From fc244c1e465f92f35d7585db2bdf70e33601da00 Mon Sep 17 00:00:00 2001 From: rtobar Date: Mon, 6 Nov 2023 09:26:53 +0800 Subject: [PATCH 10/10] =?UTF-8?q?Imprime=20nombres=20de=20variables=20de?= =?UTF-8?q?=20inter=C3=A9s?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a3a3665228..f3dfb25fc5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -64,8 +64,8 @@ jobs: CHANGED_PO_FILES: ${{ toJson(steps.changed-po-files) }} PO_FILES_TO_CHECK: ${{ toJson(steps.po-files-to-check) }} run: | - echo "$PO_FILES_TO_CHECK" - echo "$CHANGED_PO_FILES" + echo "steps.changed-po-files=$PO_FILES_TO_CHECK" + echo "steps.po-files-to-change.$CHANGED_PO_FILES" # Chequeos a realizar - name: TRANSLATORS