From b84a3f0934490e1e79120d5f5b483eb08f180ce9 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Thu, 3 Nov 2022 11:16:26 +0100 Subject: [PATCH 1/6] Test with different package names --- .github/workflows/test.yaml | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ac3ac481..b0cef008 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,6 +18,9 @@ jobs: matrix: python: ["3.8", "3.10"] os: [ubuntu-latest] + project-name: [package-name] + # one that matches project-name.lower().replace('-', '_'), one that doesn’t: + package-name: [package_name, package_alt] env: PROJECT_ROOT: project-name @@ -27,24 +30,12 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - + cache: 'pip' + cache-dependency-path: '**/pyproject.toml' - name: Install Ubuntu system dependencies if: matrix.os == 'ubuntu-latest' - run: | - sudo apt-get install pandoc - - - name: Get pip cache dir - id: pip-cache-dir - run: | - echo "::set-output name=dir::$(pip cache dir)" - - name: Restore pip cache - uses: actions/cache@v2 - with: - path: ${{ steps.pip-cache-dir.outputs.dir }} - key: pip-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('**/pyproject.toml') }} - restore-keys: | - pip-${{ runner.os }}-${{ env.pythonLocation }}- - - name: Install dependencies + run: sudo apt-get install pandoc + - name: Install build & check dependencies run: python -m pip install --upgrade pip wheel cookiecutter pre-commit - name: Build from template run: cookiecutter --no-input . @@ -57,7 +48,7 @@ jobs: run: | cd $PROJECT_ROOT pip install ".[doc]" - python -c "import project_name" + python -c "import {{ matrix.package-name }}" - name: Build the documentation env: SPHINXOPTS: -W --keep-going From 935547997bd4a49bf2ad5d22d20ab70034ef02b9 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 10:16:54 +0000 Subject: [PATCH 2/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index b0cef008..d335af72 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -30,8 +30,8 @@ jobs: uses: actions/setup-python@v2 with: python-version: ${{ matrix.python }} - cache: 'pip' - cache-dependency-path: '**/pyproject.toml' + cache: "pip" + cache-dependency-path: "**/pyproject.toml" - name: Install Ubuntu system dependencies if: matrix.os == 'ubuntu-latest' run: sudo apt-get install pandoc From ced0e9df1f8916f215d15a432800a257ab012110 Mon Sep 17 00:00:00 2001 From: Philipp A Date: Thu, 3 Nov 2022 11:22:19 +0100 Subject: [PATCH 3/6] Uses `project-name` --- .github/workflows/test.yaml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index d335af72..e8a9b5b5 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,16 +18,16 @@ jobs: matrix: python: ["3.8", "3.10"] os: [ubuntu-latest] - project-name: [package-name] - # one that matches project-name.lower().replace('-', '_'), one that doesn’t: - package-name: [package_name, package_alt] + # one that matches "project-name".lower().replace('-', '_'), one that doesn’t: + package-name: [project_name, package_alt] env: PROJECT_ROOT: project-name steps: + # Setup - uses: actions/checkout@v2 - name: Set up Python ${{ matrix.python }} - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python }} cache: "pip" @@ -37,8 +37,10 @@ jobs: run: sudo apt-get install pandoc - name: Install build & check dependencies run: python -m pip install --upgrade pip wheel cookiecutter pre-commit + # Build - name: Build from template run: cookiecutter --no-input . + # Check - name: Run pre-commit run: | cd "$PROJECT_ROOT" @@ -49,6 +51,7 @@ jobs: cd $PROJECT_ROOT pip install ".[doc]" python -c "import {{ matrix.package-name }}" + # Docs - name: Build the documentation env: SPHINXOPTS: -W --keep-going From 4814d626478d4c0901d375ab02a4b5feccb92a2c Mon Sep 17 00:00:00 2001 From: Philipp A Date: Thu, 3 Nov 2022 11:29:13 +0100 Subject: [PATCH 4/6] oops --- .github/workflows/test.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index e8a9b5b5..4966a24c 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -50,7 +50,7 @@ jobs: run: | cd $PROJECT_ROOT pip install ".[doc]" - python -c "import {{ matrix.package-name }}" + python -c "import ${{ matrix.package-name }}" # Docs - name: Build the documentation env: From 0dea140424d2cca87b4aa8b614a19544564b3d1a Mon Sep 17 00:00:00 2001 From: Philipp A Date: Thu, 3 Nov 2022 11:39:40 +0100 Subject: [PATCH 5/6] specify overrides --- .github/workflows/test.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 4966a24c..fc6922e6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -39,7 +39,11 @@ jobs: run: python -m pip install --upgrade pip wheel cookiecutter pre-commit # Build - name: Build from template - run: cookiecutter --no-input . + shell: python + run: | + from cookiecutter.main import cookiecutter + overrides = dict(package_name='${{ matrix.package-name }}') + cookiecutter('.', no_input=True, extra_context=overrides) # Check - name: Run pre-commit run: | From aef6652cfe4c9292a90ebfa5ea71a8f6518e9e63 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Thu, 3 Nov 2022 10:40:50 +0000 Subject: [PATCH 6/6] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .github/workflows/test.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index fc6922e6..9ace70d3 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -41,9 +41,9 @@ jobs: - name: Build from template shell: python run: | - from cookiecutter.main import cookiecutter - overrides = dict(package_name='${{ matrix.package-name }}') - cookiecutter('.', no_input=True, extra_context=overrides) + from cookiecutter.main import cookiecutter + overrides = dict(package_name='${{ matrix.package-name }}') + cookiecutter('.', no_input=True, extra_context=overrides) # Check - name: Run pre-commit run: |