From 446a8f7bfce65c6571c18b0b3a9c65e27bfd807c Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 15:29:24 +0800 Subject: [PATCH 1/7] Check template consistency via Github Actions. --- .github/workflows/ci.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e1e6501..a10e1bcc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,4 +1,23 @@ jobs: + consistency: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + cache: pip + python-version: ${{ matrix.python-version }} + - run: pip install copier + - run: copier -r HEAD -f . . + - run: ([ -n `git status --porcelain` ] && exit 1) + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' lint: runs-on: ubuntu-latest steps: From 2e378c284669bfb740b3fdac95f35456234b3bbf Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 15:40:07 +0800 Subject: [PATCH 2/7] Try. --- .github/workflows/ci.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a10e1bcc..92f9542e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,10 @@ jobs: python-version: ${{ matrix.python-version }} - run: pip install copier - run: copier -r HEAD -f . . - - run: ([ -n `git status --porcelain` ] && exit 1) + - run: | + if [[ -n `git status --porcelain` ]]; then + exit 1 + fi strategy: matrix: python-version: From f0fab19d123fc25d9ae4500e787763beda20daa6 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 15:41:21 +0800 Subject: [PATCH 3/7] Test. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 92f9542e..4eb47274 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ jobs: python-version: ${{ matrix.python-version }} - run: pip install copier - run: copier -r HEAD -f . . + - run: git status --porcelain - run: | if [[ -n `git status --porcelain` ]]; then exit 1 From 3f50d82446ede59184126b253d56dc06a6a9b60d Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 15:42:33 +0800 Subject: [PATCH 4/7] Test. --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4eb47274..6f914ce5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,6 +10,7 @@ jobs: python-version: ${{ matrix.python-version }} - run: pip install copier - run: copier -r HEAD -f . . + - run: git diff - run: git status --porcelain - run: | if [[ -n `git status --porcelain` ]]; then From 40382cb9b263f699b68afa808ed43c1ae1698ae9 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 15:49:23 +0800 Subject: [PATCH 5/7] Fix the inconsistency in README. --- README.md.jinja | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md.jinja b/README.md.jinja index ae7dee83..86f0b784 100644 --- a/README.md.jinja +++ b/README.md.jinja @@ -39,6 +39,7 @@ If you find this helpful, please consider [sponsorship](https://github.com/spons ## Quickstart 1. [Install Copier](https://copier.readthedocs.io/en/stable/#installation). +1. Install the necessary tools for development: `pipenv` and `pre-commit`. 1. Generate the project with the `copier` command. ``` From 5f4938f30905cef494255857ecf233e7e816b08b Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 15:56:46 +0800 Subject: [PATCH 6/7] Add ci yaml template. --- .github/workflows/ci.yml.jinja | 76 ++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/ci.yml.jinja diff --git a/.github/workflows/ci.yml.jinja b/.github/workflows/ci.yml.jinja new file mode 100644 index 00000000..daed9859 --- /dev/null +++ b/.github/workflows/ci.yml.jinja @@ -0,0 +1,76 @@ +jobs: +{%- if project_name == "Serious Scaffold Python" %} + consistency: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + cache: pip + python-version: ${{ matrix.python-version }} + - run: pip install copier + - run: copier -r HEAD -f . . + - run: git diff + - run: git status --porcelain + - run: | + if [[ -n `git status --porcelain` ]]; then + exit 1 + fi + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' +{%- endif %} + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + cache: pip + python-version: ${{ matrix.python-version }} + - run: make dev-lint + - run: make lint + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' + tests: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + cache: pip + python-version: ${{ matrix.python-version }} + - run: make dev-tests + - run: make tests + - name: Upload coverage to Codecov + uses: codecov/codecov-action@v3 + with: + flags: ${{ matrix.python-version }} + strategy: + matrix: + python-version: + - '3.8' + - '3.9' + - '3.10' + - '3.11' +name: CI +on: + pull_request: + types: + - opened + - synchronize + push: + branches: + - main From a970bd4edf0dba3f598e89fbcd43a54901d066f8 Mon Sep 17 00:00:00 2001 From: Xuan Hu Date: Wed, 24 May 2023 16:00:02 +0800 Subject: [PATCH 7/7] Fix escape of double brackets. --- .github/workflows/ci.yml.jinja | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml.jinja b/.github/workflows/ci.yml.jinja index daed9859..5f471fe8 100644 --- a/.github/workflows/ci.yml.jinja +++ b/.github/workflows/ci.yml.jinja @@ -4,11 +4,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python {{ '${{ matrix.python-version }}' }} uses: actions/setup-python@v4 with: cache: pip - python-version: ${{ matrix.python-version }} + python-version: {{ '${{ matrix.python-version }}' }} - run: pip install copier - run: copier -r HEAD -f . . - run: git diff @@ -29,11 +29,11 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python {{ '${{ matrix.python-version }}' }} uses: actions/setup-python@v4 with: cache: pip - python-version: ${{ matrix.python-version }} + python-version: {{ '${{ matrix.python-version }}' }} - run: make dev-lint - run: make lint strategy: @@ -47,17 +47,17 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - name: Set up Python ${{ matrix.python-version }} + - name: Set up Python {{ '${{ matrix.python-version }}' }} uses: actions/setup-python@v4 with: cache: pip - python-version: ${{ matrix.python-version }} + python-version: {{ '${{ matrix.python-version }}' }} - run: make dev-tests - run: make tests - name: Upload coverage to Codecov uses: codecov/codecov-action@v3 with: - flags: ${{ matrix.python-version }} + flags: {{ '${{ matrix.python-version }}' }} strategy: matrix: python-version: