Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
133 changes: 84 additions & 49 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,36 @@
name: Build and update documentation

# Daily at 0 am
on:
schedule:
- cron: '0 0 * * *'
#on:
# schedule:
# - cron: '0 0 * * *'
on: push

# Branch where translation takes place
env:
BRANCH: 3.8

jobs:
build:

# Job to pull, build and push translations from Transifex to the repository
update:
if: (github.event_name == 'schedule' && github.repository == 'python/python-docs-pt-br') || (github.event_name != 'schedule')

runs-on: ubuntu-latest
strategy:
max-parallel: 4
matrix:
python-version: [3.7]

steps:
- uses: actions/checkout@v2
with:
ref: 3.8
- run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies via package manager
run: |
sudo apt update
sudo apt install -y gettext hunspell hunspell-pt-br
msgfmt -V
hunspell -v

- name: Prepare virtual environment
run: |
make venv
venv/bin/pip --version
venv/bin/tx --version
venv/bin/sphinx-intl --help
venv/bin/powrap --version

- name: If failed, make the log file an artifact
if: failure()
uses: actions/upload-artifact@v1
with:
name: pip-install-log
path: venv/pip-install.log
ref: ${{ env.BRANCH }}

- name: Recreate an up-to-date project .tx/config
run: |
make tx-config
- uses: actions/setup-python@v2
- run: sudo apt update
- run: sudo apt install -y gettext
- run: make tx-config

- name: Update translations from Transifex
- name: Run make pull
run: |
if [[ -n "$TRANSIFEX_APIKEY" ]]; then
echo -e "[https://www.transifex.com]\n" \
Expand All @@ -69,30 +45,89 @@ jobs:
env:
TRANSIFEX_APIKEY: ${{ secrets.TRANSIFEX_APIKEY }}

- name: Build documentation
run: |
make build CPYTHON_PATH=/tmp/cpython/ SPHINXERRORHANDLING=''
- run: make build CPYTHON_PATH=/tmp/cpython/ SPHINXERRORHANDLING=''

- name: Push translations
- name: Run make push
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
make push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check spelling of translations
# Job to check spelling of translations
spellcheck:
needs: update
runs-on: ubuntu-latest
strategy:
max-parallel: 4

steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH }}

- uses: actions/setup-python@v2
- run: sudo apt update
- run: sudo apt install -y gettext hunspell hunspell-pt-br

- name: Run make spell
run: |
make spell
cd .pospell/
tar -czf ../pospell-out.tar.gz *.txt **/*.txt

- name: Make spellchecking output available
uses: actions/upload-artifact@v1
- name: Update artifact spellchecking-output
uses: actions/upload-artifact@v2
with:
name: spellchecking-output
path: pospell-out.tar.gz

- name: Build documentation treating warnings as errors
# Job to merge translation from current BRANCH to older ones
merge:
needs: update
runs-on: ubuntu-latest
strategy:
max-parallel: 4

steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH }}

- run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*

- uses: actions/setup-python@v2
- run: sudo apt update
- run: sudo apt install -y gettext

- name: Run make push
run: |
make build CPYTHON_PATH=/tmp/cpython/
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"
make merge
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# Job to build translated documentation treating warnings as errors
build-warn-as-err:
needs: update
runs-on: ubuntu-latest
strategy:
max-parallel: 4

steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.BRANCH }}

- uses: actions/setup-python@v2
- run: make build CPYTHON_PATH=/tmp/cpython/ 2> >(tee -a build-log.txt >&2)

- name: Update artifact spellchecking-output
if: ${{ failure() }}
uses: actions/upload-artifact@v2
with:
name: build-output
path: build-log.txt
Loading