Skip to content

Revamp infra #228

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 6, 2024
Merged

Revamp infra #228

merged 11 commits into from
Sep 6, 2024

Conversation

rffontenelle
Copy link
Collaborator

Este pull request visa mudar a scripts, workflows, etc. para atualização e teste das traduções para português brasileiro.

Vejo os seguintes problemas na solução atual:

  • Polui os branches de arquivos de tradução (3.13), pois os scripts são feitos considerando estar em um branch de arquivos de tradução.
  • Makefile não é das sintaxes mais amigáveis e o script estava bem longo, dificultando sua manutenção.
  • Uso duplicado do pomerge, tendo em vista que a própria infraestrutura de scripts do projeto do Transifex já faz isso.
  • requirements.txt contendo requisitos já fornecidos pela documentação do cpython; melhor ter um requirements.txt mais enxuto, e usar o arquivo do cpython (e seu arquivo constraints.txt)
  • Arquivo de problem-matcher no repositório, quando poderia-se usar o action específico

A nova solução foi em muito baseada na do time python-docs-zh-cn, e tem as seguintes características:

  • Branch main como principal e, portanto, será de onde os workflows do GitHub Actions serão executados.
  • Os scripts ficarão no diretório scripts/ e será removido Makefile em favor de Shell e Python (com os quais tenho mais afinidade)
  • Cada versão Python terá seu próprio arquivo workflow. Isso permite ter no README um badge para cada versão acusando a situação da construção.
  • O README terá a porcentagem de tradução de cada versão usando ./scripts/tx_stats.py.
  • Como testar localmente:
PYDOC_VERSION=3.13
PYDOC_TX_PROJECT=python-newest
PYDOC_LANGUAGE=pt_BR
PYDOC_REPO=https://github.com/python/python-docs-pt-br
./scripts/setup.sh      # clona repositórios e instala dependências
./scripts/pull_translations.sh library/os.po   # argumento opcional para baixar um específico
./scripts/build.sh      # usa sphinx-build -b html para levantar erros de sintaxe
./scripts/lint.sh       # usa sphinx-lint

A este pull request seguirá uma limpeza em cada branch de versão, de forma que cada branch de versão tenha apenas:

  • arquivos de tradução
  • potodo.md (uma lista de traduções incompletas)
  • stats.json (o arquivo que conterá a porcentagem de tradução)
  • README resumido sobre aquela versão

Copy link
Contributor

@vinigfer vinigfer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some suggestions.
Other than that, LGTM

- name: Prepare notification (only on error)
if: steps.build.outcome == 'failure'
if: always() && steps.build.outcome == 'failure'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This always is really necessary? With the &&, doesn't ends up going back to being just steps.build.outcome == 'failure'?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird enough, it is necessary as it wouldn't run otherwise.

id: prepare
run: .github/scripts/prepmsg.sh logs/build/err*.txt logs/notify.txt
run: |
scripts/prepmsg.sh logs/sphinxwarnings.txt logs/notify.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could/should move this logs/sphinxwarnings.txt and logs/notify.txt to environment variables/constants.
Since it's being used on multiple places and different files. That way if we change it, already updates everywhere it's necessary.

@@ -0,0 +1,21 @@
name: python-310
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe an easier to understand name?
How about

Suggested change
name: python-310
name: Sync python 3.10 docs

?

Same for the other python-3*.yml files

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So far, this is the easiest solution to make easier to copy and paste the Transifex project name across the YAML files. Notice how I used ${{ github.workflow }} as value below; this uses the 'name', which is 'python-310' in this case.

And it seems GitHub actions doesn't allow passing environment variable as input to reusable workflow (i tested it!), e.g.:

env:
  PROJECT='python-310'
  VERSION='3.10'

jobs:
  sync:
    uses: ./.github/workflows/sync.yml
    with:
      tx_project: ${{ env.PROJECT }}
      version: ${{ env.VERSION }}
    secrets: inherit

@rffontenelle rffontenelle merged commit d00554a into main Sep 6, 2024
3 checks passed
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
rffontenelle added a commit that referenced this pull request Sep 6, 2024
@rffontenelle rffontenelle deleted the revamp-infra branch November 26, 2024 02:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants