diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000000..309dd81fa7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,20 @@ +name: build + +on: + pull_request: + branches: + - "3.7" + - "3.8" + - "3.9" + +jobs: + ci: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Dependencies + run: sudo apt-get install gettext + + - name: Build + run: VERSION=${{ github.event.pull_request.base.ref }} make diff --git a/.github/workflows/deploy-gh-page.yml b/.github/workflows/deploy-gh-page.yml new file mode 100644 index 0000000000..45d4735762 --- /dev/null +++ b/.github/workflows/deploy-gh-page.yml @@ -0,0 +1,26 @@ +name: deploy-gh-page + +on: + push: + branches: + - "3.9" + +jobs: + cd: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Install Dependencies + run: sudo apt-get install gettext + + - name: Build + run: make + + - name: Deploy to gh page + uses: JamesIves/github-pages-deploy-action@3.7.1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + BRANCH: gh-pages + FOLDER: ../cpython/Doc/build/html + CLEAN: true diff --git a/.github/workflows/py39-sync-cpython.yml b/.github/workflows/py39-sync-cpython.yml new file mode 100644 index 0000000000..4f06711940 --- /dev/null +++ b/.github/workflows/py39-sync-cpython.yml @@ -0,0 +1,52 @@ +name: python-3.9-sync-with-cpython + +on: + push: + branches: + - "3.9" + schedule: + - cron: "0 0 * * *" + +jobs: + sync: + runs-on: ubuntu-latest + env: + VERSION: "3.9" + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ env.VERSION }} + + - name: Set env + run: echo "LATEST_COMMIT_ID=$(git ls-remote https://github.com/python/CPython.git $VERSION | head -c 8)" >> $GITHUB_ENV + + - name: Install Dependencies + run: sudo apt-get install gettext + + - name: Sync with CPython + run: make clone && make merge && make rm_cpython + + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + commit-message: sync with cpython ${{ env.LATEST_COMMIT_ID }} + committer: GitHub + author: github-actions[bot] + base: ${{ env.VERSION }} + branch: cron/sync/${{ env.VERSION }} + delete-branch: true + title: 'Sync with CPython ${{ env.VERSION }}' + body: | + Sync with CPython ${{ env.VERSION }} + labels: | + sync-cpython + automation + team-reviewers: | + owners + maintainers + + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}" \ No newline at end of file diff --git a/Makefile b/Makefile index ab78bd1ab5..f8e256f82f 100644 --- a/Makefile +++ b/Makefile @@ -22,20 +22,20 @@ LC_MESSAGES := $(CPYTHON_CLONE)/Doc/locales/$(LANGUAGE)/LC_MESSAGES VENV := ~/.venvs/python-docs-i18n/ PYTHON := $(shell which python3) MODE := autobuild-dev-html -BRANCH = $(shell git describe --contains --all HEAD) +BRANCH := $(or $(VERSION), $(shell git describe --contains --all HEAD)) JOBS = 1 .PHONY: all -all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb $(SPHINX_CONF) +all: $(VENV)/bin/sphinx-build $(VENV)/bin/blurb clone mkdir -p $(LC_MESSAGES) for dirname in $$(find . -name '*.po' | xargs -n1 dirname | sort -u | grep -v '^\.$$'); do mkdir -p $(LC_MESSAGES)/$$dirname; done for file in *.po */*.po; do ln -f $$file $(LC_MESSAGES)/$$file; done . $(VENV)/bin/activate; $(MAKE) -C $(CPYTHON_CLONE)/Doc/ SPHINXOPTS='-j$(JOBS) -D locale_dirs=locales -D language=$(LANGUAGE) -D gettext_compact=0' $(MODE) -$(SPHINX_CONF): - git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) +clone: + git clone --depth 1 --no-single-branch https://github.com/python/cpython.git $(CPYTHON_CLONE) || echo "cpython exists" cd $(CPYTHON_CLONE) && git checkout $(BRANCH) @@ -104,3 +104,7 @@ update_txconfig: .PHONY: fuzzy fuzzy: for file in *.po */*.po; do echo $$(msgattrib --only-fuzzy --no-obsolete "$$file" | grep -c '#, fuzzy') $$file; done | grep -v ^0 | sort -gr + +.PHONY: rm_cpython +rm_cpython: + rm -rf $(CPYTHON_CLONE)