Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit e0d7814

Browse filesBrowse files
authored
feat: automation with github action (#102)
* Pulling latest source strings from CPython daily and make the change as a PR (only support branch 3.9). * Maintainer should resolve the fuzzy entries before merging it. * If the PR for this task is existed, changes will be forced-push to the existing branch (checkout peter-evans/create-pull-request@v3). * Launch build flow during a pull request is opened (supported base branch: 3.7, 3.8, & 3.9). * Deploy to github page if any change is pushed to main branch (current: 3.9).
1 parent 2097fa6 commit e0d7814
Copy full SHA for e0d7814

File tree

Expand file treeCollapse file tree

4 files changed

+106
-4
lines changed
Filter options
Expand file treeCollapse file tree

4 files changed

+106
-4
lines changed

‎.github/workflows/ci.yml

Copy file name to clipboard
+20Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: build
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- "3.7"
7+
- "3.8"
8+
- "3.9"
9+
10+
jobs:
11+
ci:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v2
15+
16+
- name: Install Dependencies
17+
run: sudo apt-get install gettext
18+
19+
- name: Build
20+
run: VERSION=${{ github.event.pull_request.base.ref }} make

‎.github/workflows/deploy-gh-page.yml

Copy file name to clipboard
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: deploy-gh-page
2+
3+
on:
4+
push:
5+
branches:
6+
- "3.9"
7+
8+
jobs:
9+
cd:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
14+
- name: Install Dependencies
15+
run: sudo apt-get install gettext
16+
17+
- name: Build
18+
run: make
19+
20+
- name: Deploy to gh page
21+
uses: JamesIves/github-pages-deploy-action@3.7.1
22+
with:
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
BRANCH: gh-pages
25+
FOLDER: ../cpython/Doc/build/html
26+
CLEAN: true
+52Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: python-3.9-sync-with-cpython
2+
3+
on:
4+
push:
5+
branches:
6+
- "3.9"
7+
schedule:
8+
- cron: "0 0 * * *"
9+
10+
jobs:
11+
sync:
12+
runs-on: ubuntu-latest
13+
env:
14+
VERSION: "3.9"
15+
steps:
16+
- uses: actions/checkout@v2
17+
with:
18+
ref: ${{ env.VERSION }}
19+
20+
- name: Set env
21+
run: echo "LATEST_COMMIT_ID=$(git ls-remote https://github.com/python/CPython.git $VERSION | head -c 8)" >> $GITHUB_ENV
22+
23+
- name: Install Dependencies
24+
run: sudo apt-get install gettext
25+
26+
- name: Sync with CPython
27+
run: make clone && make merge && make rm_cpython
28+
29+
- name: Create Pull Request
30+
id: cpr
31+
uses: peter-evans/create-pull-request@v3
32+
with:
33+
commit-message: sync with cpython ${{ env.LATEST_COMMIT_ID }}
34+
committer: GitHub <noreply@github.com>
35+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
36+
base: ${{ env.VERSION }}
37+
branch: cron/sync/${{ env.VERSION }}
38+
delete-branch: true
39+
title: 'Sync with CPython ${{ env.VERSION }}'
40+
body: |
41+
Sync with CPython ${{ env.VERSION }}
42+
labels: |
43+
sync-cpython
44+
automation
45+
team-reviewers: |
46+
owners
47+
maintainers
48+
49+
- name: Check outputs
50+
run: |
51+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
52+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

‎Makefile

Copy file name to clipboardExpand all lines: Makefile
+8-4Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,20 @@ LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES
2222
VENV := ~/.venvs/python-docs-i18n/
2323
PYTHON := $(shell which python3)
2424
MODE := autobuild-dev-html
25-
BRANCH = $(shell git describe --contains --all HEAD)
25+
BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD))
2626
JOBS = 1
2727

2828

2929
.PHONY: all
30-
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb $(SPHINX_CONF)
30+
all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone
3131
mkdir -p $(LC_MESSAGES)
3232
for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done
3333
for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done
3434
. $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE)
3535

3636

37-
$(SPHINX_CONF):
38-
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE)
37+
clone:
38+
git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists"
3939
cd $(CPYTHON_CLONE) && git checkout $(BRANCH)
4040

4141

@@ -104,3 +104,7 @@ update_txconfig:
104104
.PHONY: fuzzy
105105
fuzzy:
106106
for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr
107+
108+
.PHONY: rm_cpython
109+
rm_cpython:
110+
rm -rf $(CPYTHON_CLONE)

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.