From 1884367ac1f39f57bf8aa64cc488ab848617c5f5 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 15 Aug 2020 21:18:10 +0300 Subject: [PATCH 1/3] Lint RST on GitHub Actions --- .github/workflows/lint.yml | 25 +++++++++++++++++++++++++ .pre-commit-config.yaml | 6 ++++++ Makefile | 3 +++ 3 files changed, 34 insertions(+) create mode 100644 .github/workflows/lint.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..a3d3a80c399 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,25 @@ +name: Lint + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U pre-commit + + - name: Lint + run: make lint + env: + PRE_COMMIT_COLOR: always diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000000..052f25994a2 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,6 @@ +repos: + - repo: https://github.com/pre-commit/pygrep-hooks + rev: v1.6.0 + hooks: + - id: rst-backticks + - id: rst-inline-touching-normal diff --git a/Makefile b/Makefile index 213bb75325f..20f602ddba3 100644 --- a/Makefile +++ b/Makefile @@ -51,3 +51,6 @@ package: all rss cp *.png build/peps/ cp *.rss build/peps/ tar -C build -czf build/peps.tar.gz peps + +lint: + pre-commit run --all-files From c14d2f38fbe634328195d16daa49e9b3cf7866a2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Sat, 15 Aug 2020 21:21:17 +0300 Subject: [PATCH 2/3] Exclude false positives from lint --- .pre-commit-config.yaml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 052f25994a2..abb0d224f09 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,4 +3,12 @@ repos: rev: v1.6.0 hooks: - id: rst-backticks + exclude: > + (?x)^( + pep-0012.rst| + pep-0505.rst| + pep-0550.rst| + pep-0567.rst| + pep-0572.rst + )$ - id: rst-inline-touching-normal From 222d96dba1697591db19e0c25a768851bd1689d2 Mon Sep 17 00:00:00 2001 From: Hugo van Kemenade Date: Wed, 19 Aug 2020 16:59:29 +0300 Subject: [PATCH 3/3] Build and deploy HTML on GitHub Actions --- .github/workflows/build.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..8471646c125 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,33 @@ +name: Build + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: 3.8 + + - name: Install dependencies + run: | + python -m pip install -U pip + python -m pip install -U docutils + + - name: Build + run: make -j$(nproc) + + - name: Deploy + if: > + ( + github.repository == 'python/peps' && + github.ref == 'refs/heads/master' + ) + + run: | + bash deploy.bash