-
-
Notifications
You must be signed in to change notification settings - Fork 38
166 lines (141 loc) · 4.79 KB
/
check.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
# Run some tests in the Python Doc translations
name: Check
on:
workflow_dispatch:
inputs:
version:
description: "Branch name corresponding to a Python version"
required: true
type: string
tx_project:
description: "Name of the Transifex translation project"
required: true
type: string
workflow_call:
inputs:
version:
description: "Branch name corresponding to a Python version"
required: true
type: string
tx_project:
description: "Name of the Transifex translation project"
required: true
type: string
secrets:
TELEGRAM_TOKEN:
description: "Token required for interacting with Telegram API"
required: false
TELEGRAM_TO:
description: "Account ID that will receive the telegram notification"
required: false
permissions:
contents: read
env:
PYDOC_LANGUAGE: pt_BR
PYDOC_REPO: ${{ github.server_url }}/${{ github.repository }}
PYDOC_VERSION: ${{ inputs.version }}
jobs:
# Build documentation handling warnings as errors.
# If success, upload built docs. If failure, notify telegram and upload logs.
build:
name: Build translated docs
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.version }}
cache: pip
allow-prereleases: true
- name: Make sure the repository is up to date
if: github.event_name != 'pull_request'
run: git pull --rebase
- name: setup
run: ./scripts/setup.sh
- name: Add problem matcher
uses: sphinx-doc/[email protected]
- name: Build docs
id: build
run: ./scripts/build.sh
- name: Upload artifact - docs
if: steps.build.outcome == 'success'
uses: actions/[email protected]
with:
name: docs
path: cpython/Doc/build/html
- name: Prepare notification (only on error)
if: always() && steps.build.outcome == 'failure'
id: prepare
run: |
scripts/prepmsg.sh logs/sphinxwarnings.txt logs/notify.txt
cat logs/notify.txt
env:
GITHUB_JOB: ${{ github.job }}
GITHUB_RUN_ID: ${{ github.run_id }}
- name: Notify via Telegram
if: always() && steps.prepare.outcome == 'success' && github.event_name == 'schedule' && inputs.tx_project == 'python-newest'
uses: appleboy/[email protected]
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
disable_web_page_preview: true
message_file: logs/notify.txt
- name: Upload artifact - log files
if: always() && steps.build.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.version }}-build-logs
path: logs/*
# Run sphinx-lint to find wrong reST syntax in PO files. Always store logs.
# If issues are found, notify telegram and upload logs.
lint:
name: Lint translations
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 5
- name: Set up Python 3
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.version }}
cache: pip
allow-prereleases: true
- name: Make sure the repository is up to date
if: github.event_name != 'pull_request'
run: git pull --rebase
- name: setup
run: ./scripts/setup.sh
- name: Add problem matcher
uses: rffontenelle/[email protected]
- name: lint translations files
id: lint
run: ./scripts/lint.sh
- name: Prepare notification (only on error)
if: always() && steps.lint.outcome == 'failure'
id: prepare
run: |
scripts/prepmsg.sh logs/sphinxlint.txt logs/notify.txt
cat logs/notify.txt
env:
GITHUB_JOB: ${{ github.job }}
GITHUB_RUN_ID: ${{ github.run_id }}
- name: Notify via Telegram
if: always() && steps.prepare.outcome == 'success' && github.event_name == 'schedule' && inputs.tx_project == 'python-newest'
uses: appleboy/[email protected]
with:
to: ${{ secrets.TELEGRAM_TO }}
token: ${{ secrets.TELEGRAM_TOKEN }}
format: markdown
disable_web_page_preview: true
message_file: logs/notify.txt
- name: Upload artifact - log files
if: always() && steps.lint.outcome == 'failure'
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.version }}-lint-logs
path: logs/*