diff --git a/.github/scripts/requirements.sh b/.github/scripts/requirements.sh index ba0c59e..5dc0fcd 100644 --- a/.github/scripts/requirements.sh +++ b/.github/scripts/requirements.sh @@ -9,7 +9,7 @@ set -eo pipefail main () { - pip install cookiecutter poetry + python -m pip install cookiecutter poetry --verbose } diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml index f57d4f8..941f2f9 100644 --- a/.github/workflows/self-test.yml +++ b/.github/workflows/self-test.yml @@ -93,15 +93,15 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Ansible Lint -- Install Template Requirements - run: | - source ./template/.github/scripts/requirements.sh - - name: Ansible Lint -- Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Ansible Lint -- Install Template Requirements + run: | + source ./template/.github/scripts/requirements.sh + - name: Ansible Lint -- Initialize Cache Locations run: | mkdir -p ~/.cache/pypoetry/virtualenvs @@ -119,7 +119,7 @@ jobs: uses: actions/cache@v3 with: key: poetry-${{ hashFiles('./template/{{cookiecutter.profile_slug}}/pyproject.toml') }}-${{ runner.os }}-${{ env.CACHE_TTL }} - path: ~/.cache/pypoetry/virtualenvs/ + path: ~/.cache/pypoetry/virtualenvs - name: Ansible Lint -- Render Template run: | @@ -278,15 +278,15 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Documentation Test -- Install Template Requirements - run: | - source ./template/.github/scripts/requirements.sh - - name: Documentation Test -- Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Documentation Test -- Install Template Requirements + run: | + source ./template/.github/scripts/requirements.sh + - name: Documentation Test -- Render Template run: | source ./template/.github/scripts/template.sh @@ -342,6 +342,11 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} + - name: Pre-Commit Test -- Set up Python ${{ env.PYTHON_VERSION }} + uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYTHON_VERSION }} + - name: Pre-Commit Test -- Install Template Requirements run: | source ./template/.github/scripts/requirements.sh @@ -350,11 +355,6 @@ jobs: run: | sudo apt-get install -y golang-github-pelletier-go-toml - - name: Pre-Commit Test -- Set up Python ${{ env.PYTHON_VERSION }} - uses: actions/setup-python@v4 - with: - python-version: ${{ env.PYTHON_VERSION }} - - name: Pre-Commit -- Initialize Cache Locations run: | mkdir -p ~/.cache/pypoetry/virtualenvs @@ -372,7 +372,7 @@ jobs: uses: actions/cache@v3 with: key: poetry-${{ hashFiles('./template/{{cookiecutter.profile_slug}}/pyproject.toml') }}-${{ runner.os }}-${{ env.CACHE_TTL }} - path: ~/.cache/pypoetry/virtualenvs/ + path: ~/.cache/pypoetry/virtualenvs - name: Pre-Commit Test -- Render Template run: | @@ -434,15 +434,21 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Push Test -- Install Template Requirements - run: | - source ./template/.github/scripts/requirements.sh - - name: Push Test -- Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Push Test -- Install Template Requirements + run: | + source ./template/.github/scripts/requirements.sh + + - name: Push Test -- Clean Up Test Releases + run: | + source ./template/.github/scripts/prune_test_releases.sh + env: + GITHUB_TOKEN: ${{ secrets.REMOTE_TOKEN }} + - name: Push Test -- Render Template run: | source ./template/.github/scripts/template.sh "${SELECTION_TOML}" "GitHub Action" "action@github.com" @@ -545,15 +551,15 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Shellcheck -- Install Template Requirements - run: | - source ./template/.github/scripts/requirements.sh - - name: Shellcheck -- Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Shellcheck -- Install Template Requirements + run: | + source ./template/.github/scripts/requirements.sh + - name: Shellcheck -- Render Template run: | source ./template/.github/scripts/template.sh @@ -600,15 +606,15 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Toml Lint -- Install Template Requirements - run: | - source ./template/.github/scripts/requirements.sh - - name: Toml Lint -- Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Toml Lint -- Install Template Requirements + run: | + source ./template/.github/scripts/requirements.sh + - name: Toml Lint -- Render Template run: | source ./template/.github/scripts/template.sh @@ -651,15 +657,15 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Yaml Lint Test-- Install Template Requirements - run: | - source ./template/.github/scripts/requirements.sh - - name: Yaml Lint Test -- Set up Python ${{ env.PYTHON_VERSION }} uses: actions/setup-python@v4 with: python-version: ${{ env.PYTHON_VERSION }} + - name: Yaml Lint Test-- Install Template Requirements + run: | + source ./template/.github/scripts/requirements.sh + - name: Yaml Lint Test -- Render Template run: | source ./template/.github/scripts/template.sh "${SELECTION_TOML}" diff --git a/hooks/post_gen_project.sh b/hooks/post_gen_project.sh index 87814a6..0125535 100644 --- a/hooks/post_gen_project.sh +++ b/hooks/post_gen_project.sh @@ -35,7 +35,7 @@ initialize_git() { initialize_poetry() { if [[ "${PROFILE_GENERATOR_SKIP_POETRY}" != "1" ]]; then - poetry install + poetry install --verbose fi } diff --git a/{{cookiecutter.profile_slug}}/.github/scripts/poetry.sh b/{{cookiecutter.profile_slug}}/.github/scripts/poetry.sh index 040df51..856a428 100644 --- a/{{cookiecutter.profile_slug}}/.github/scripts/poetry.sh +++ b/{{cookiecutter.profile_slug}}/.github/scripts/poetry.sh @@ -7,9 +7,32 @@ set -eo pipefail +install_poetry() { + + python -m pip install poetry --verbose + +} + +install_project() { + + poetry install --verbose + +} + main () { - pip install poetry + case $1 in + install-poetry) + install_poetry + ;; + install-project) + install_project + ;; + *) + echo "Invalid option." + exit 127 + ;; + esac } diff --git a/{{cookiecutter.profile_slug}}/.github/workflows/push.yml b/{{cookiecutter.profile_slug}}/.github/workflows/push.yml index 690014c..6920f21 100644 --- a/{{cookiecutter.profile_slug}}/.github/workflows/push.yml +++ b/{{cookiecutter.profile_slug}}/.github/workflows/push.yml @@ -81,15 +81,15 @@ jobs: env: WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} - - name: Ansible Lint -- Install Poetry - run: | - source .github/scripts/poetry.sh - - name: Ansible Lint -- Set up Python ${{ env.PYTHON_VERSION }} uses: {% endraw %}{{ cookiecutter._GITHUB_ACTION_PYTHON }}{% raw %} with: python-version: ${{ env.PYTHON_VERSION }} + - name: Ansible Lint -- Install Poetry + run: | + source .github/scripts/poetry.sh "install-poetry" + - name: Ansible Lint -- Initialize Cache Locations run: | mkdir -p ~/.cache/pypoetry/virtualenvs @@ -111,7 +111,7 @@ jobs: - name: Ansible Lint -- Install Requirements run: | - poetry install + source .github/scripts/poetry.sh "install-project" - name: Ansible Lint -- Install Ansible Galaxy Dependencies run: | @@ -163,7 +163,7 @@ jobs: - name: Create Release -- Install poetry if: steps.filter.outputs.release_candidate == 'TRUE' run: | - source ./.github/scripts/poetry.sh + source ./.github/scripts/poetry.sh "install-poetry" - name: Create Release -- Check 'pyproject.toml' Matches Tag if: steps.filter.outputs.release_candidate == 'TRUE'