Skip to content

Commit 3fef330

Browse files
authored
Add new actions
1 parent 1362ae5 commit 3fef330

File tree

3 files changed

+169
-122
lines changed

3 files changed

+169
-122
lines changed

.github/workflows/build.yml

+76-76
Original file line numberDiff line numberDiff line change
@@ -1,76 +1,76 @@
1-
name: Tests
2-
3-
on:
4-
workflow_dispatch:
5-
push:
6-
branches:
7-
- '*.*'
8-
pull_request:
9-
branches:
10-
- '*.*'
11-
12-
jobs:
13-
checks:
14-
strategy:
15-
matrix:
16-
tool:
17-
- name: sphinx-lint
18-
package: sphinx-lint
19-
command: 'sphinx-lint --enable default-role --ignore .git'
20-
- name: Line length
21-
command: 'awk ''{if (length($0) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}'' $CHANGED_PO_FILES'
22-
23-
name: ${{ matrix.tool.name }} (${{ matrix.tool.package }})
24-
runs-on: ubuntu-latest
25-
steps:
26-
- uses: actions/checkout@v3
27-
- uses: lots0logs/gh-action-get-changed-files@2.1.4
28-
id: changed_files
29-
with:
30-
token: ${{ secrets.GITHUB_TOKEN }}
31-
- uses: actions/setup-python@v4
32-
with:
33-
python-version: '3.10'
34-
- name: Install ${{ matrix.tool.package }}
35-
run: |
36-
if [ -n "${{ matrix.tool.apt_dependencies }}" ]; then
37-
sudo apt-get update && sudo apt-get install -y ${{ matrix.tool.apt_dependencies }}
38-
fi
39-
if [ -n "${{ matrix.tool.package }}" ]; then
40-
python -m pip install --upgrade pip setuptools wheel
41-
python -m pip install ${{ matrix.tool.package }}
42-
fi
43-
- name: Run ${{ matrix.tool.package }}
44-
env:
45-
ADDED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.added), ' ') }}
46-
MODIFIED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.modified), ' ') }}
47-
run: |
48-
CHANGED_PO_FILES=$(printf "%s %s\n" "$ADDED_FILES" "$MODIFIED_FILES" | tr ' ' '\n' | grep '.po$'; true)
49-
pwd
50-
tree -L 2
51-
if [ -n "$CHANGED_PO_FILES" ]
52-
then
53-
echo "Running on:" $CHANGED_PO_FILES
54-
${{ matrix.tool.command }}
55-
else
56-
echo "No changed po files, nothing to check."
57-
fi
58-
59-
sphinx:
60-
name: 'Generate docs (sphinx)'
61-
runs-on: ubuntu-latest
62-
timeout-minutes: 30
63-
steps:
64-
- uses: actions/checkout@v3
65-
- uses: actions/setup-python@v4
66-
with:
67-
python-version: '3.10'
68-
- name: Prepare environment
69-
run: |
70-
pwd
71-
tree -L 2
72-
git clone https://github.com/python/cpython.git venv/cpython/
73-
python -m pip install --upgrade pip setuptools wheel
74-
python -m pip install -r requirements.txt -r venv/cpython/Doc/requirements.txt
75-
- name: Make
76-
run: make
1+
name: Tests
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- '**'
8+
pull_request:
9+
branches:
10+
- '**'
11+
12+
jobs:
13+
checks:
14+
strategy:
15+
matrix:
16+
tool:
17+
- name: sphinx-lint
18+
package: sphinx-lint
19+
command: 'sphinx-lint --enable default-role --ignore .git'
20+
- name: Line length
21+
command: 'awk ''{if (length($0) > 80 && length(gensub(/[^ ]/, "", "g")) > 1) {print FILENAME ":" FNR, "line too long:", $0; ERRORS+=1}} END {if (ERRORS>0) {exit 1}}'' $CHANGED_PO_FILES'
22+
23+
name: ${{ matrix.tool.name }} (${{ matrix.tool.package }})
24+
runs-on: ubuntu-latest
25+
steps:
26+
- uses: actions/checkout@v3
27+
- uses: lots0logs/gh-action-get-changed-files@2.1.4
28+
id: changed_files
29+
with:
30+
token: ${{ secrets.GITHUB_TOKEN }}
31+
- uses: actions/setup-python@v4
32+
with:
33+
python-version: '3.11'
34+
- name: Install ${{ matrix.tool.package }}
35+
run: |
36+
if [ -n "${{ matrix.tool.apt_dependencies }}" ]; then
37+
sudo apt-get update && sudo apt-get install -y ${{ matrix.tool.apt_dependencies }}
38+
fi
39+
if [ -n "${{ matrix.tool.package }}" ]; then
40+
python -m pip install --upgrade pip setuptools wheel
41+
python -m pip install ${{ matrix.tool.package }}
42+
fi
43+
- name: Run ${{ matrix.tool.package }}
44+
env:
45+
ADDED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.added), ' ') }}
46+
MODIFIED_FILES: ${{ join(fromJSON(steps.changed_files.outputs.modified), ' ') }}
47+
run: |
48+
CHANGED_PO_FILES=$(printf "%s %s\n" "$ADDED_FILES" "$MODIFIED_FILES" | tr ' ' '\n' | grep '.po$'; true)
49+
pwd
50+
tree -L 2
51+
if [ -n "$CHANGED_PO_FILES" ]
52+
then
53+
echo "Running on:" $CHANGED_PO_FILES
54+
${{ matrix.tool.command }}
55+
else
56+
echo "No changed po files, nothing to check."
57+
fi
58+
59+
sphinx:
60+
name: 'Generate docs (sphinx)'
61+
runs-on: ubuntu-latest
62+
timeout-minutes: 30
63+
steps:
64+
- uses: actions/checkout@v3
65+
- uses: actions/setup-python@v4
66+
with:
67+
python-version: '3.11'
68+
- name: Prepare environment
69+
run: |
70+
pwd
71+
tree -L 2
72+
git clone https://github.com/python/cpython.git venv/cpython/
73+
python -m pip install --upgrade pip setuptools wheel
74+
python -m pip install -r requirements.txt -r venv/cpython/Doc/requirements.txt
75+
- name: Make
76+
run: make

.github/workflows/update_doc.yml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Update Doc
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: '0 0 1 * *'
6+
7+
jobs:
8+
create_pr:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- uses: actions/checkout@v3
13+
14+
- name: Clone CPython Repo
15+
run: git clone https://github.com/python/cpython venv/cpython
16+
17+
- name: Set Up Python 3.11
18+
uses: actions/setup-python@v4
19+
with:
20+
python-version: "3.11"
21+
22+
- name: Install dependencies
23+
run: pip install -r requirements.txt && sudo apt install gettext -y
24+
25+
- name: Run merge.py
26+
run: python merge.py ${GITHUB_REF##*/}
27+
28+
- name: Commit changes
29+
run: |
30+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
31+
git config --local user.name "github-actions[bot]"
32+
git commit -m "Get changes from CPython Doc for ${{ github.ref_name }}"
33+
34+
- name: Create Pull Request
35+
uses: peter-evans/create-pull-request@v4.2.3
36+
with:
37+
commit-message: Get changes from CPython Doc for ${{ github.ref_name }}
38+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
39+
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
40+
branch: translation-update-${{ github.ref_name }}
41+
delete-branch: true
42+
title: Translation Update ${{ github.ref_name }}
43+
body: There are some changes, don't forget to translate them!
44+
labels: update
45+
reviewers: |
46+
egeakman
47+
ardasak

.github/workflows/wrap_branch.yml

+46-46
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
name: "Wrap All"
2-
3-
on:
4-
workflow_dispatch:
5-
schedule:
6-
- cron: '0 0 15 * *'
7-
8-
jobs:
9-
wrap:
10-
runs-on: ubuntu-latest
11-
steps:
12-
- name: Checkout repo
13-
uses: actions/checkout@v3
14-
15-
- name: Set Up Python 3.11
16-
uses: actions/setup-python@v4
17-
with:
18-
python-version: "3.11"
19-
20-
# Upgrade pip
21-
- name: Upgrade pip
22-
run: python -m pip install --upgrade pip
23-
24-
# Install dependencies
25-
- name: Install dependencies
26-
run: python -m pip install --upgrade -r requirements.txt && sudo apt install -y gettext
27-
28-
# Wrap all po files
29-
- name: Wrap
30-
run: powrap *.po */*.po
31-
32-
# Create pull request
33-
- name: Create Pull Request
34-
uses: peter-evans/create-pull-request@v4.2.3
35-
with:
36-
commit-message: 'Wrap all files on: ${{ github.ref_name }}'
37-
branch: ${{ github.ref_name }}-wrapped
38-
delete-branch: true
39-
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
40-
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
41-
title: 'Wrap branch: ${{ github.ref_name }}'
42-
body: 'Wrapped all files on branch: ${{ github.ref_name }}.'
43-
labels: wrap
44-
reviewers: |
45-
egeakman
46-
ardasak
1+
name: "Wrap All"
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
- cron: '0 0 15 * *'
7+
8+
jobs:
9+
wrap:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Checkout repo
13+
uses: actions/checkout@v3
14+
15+
- name: Set Up Python 3.11
16+
uses: actions/setup-python@v4
17+
with:
18+
python-version: "3.11"
19+
20+
# Upgrade pip
21+
- name: Upgrade pip
22+
run: python -m pip install --upgrade pip
23+
24+
# Install dependencies
25+
- name: Install dependencies
26+
run: python -m pip install --upgrade -r requirements.txt && sudo apt install -y gettext
27+
28+
# Wrap all po files
29+
- name: Wrap
30+
run: powrap *.po */*.po
31+
32+
# Create pull request
33+
- name: Create Pull Request
34+
uses: peter-evans/create-pull-request@v4.2.3
35+
with:
36+
commit-message: 'Wrap all files on: ${{ github.ref_name }}'
37+
branch: ${{ github.ref_name }}-wrapped
38+
delete-branch: true
39+
committer: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
40+
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
41+
title: 'Wrap branch: ${{ github.ref_name }}'
42+
body: 'Wrapped all files on branch: ${{ github.ref_name }}.'
43+
labels: wrap
44+
reviewers: |
45+
egeakman
46+
ardasak

0 commit comments

Comments
 (0)