diff --git a/.github/workflows/self-test.yml b/.github/workflows/self-test.yml index ac37ac69..a23c4230 100644 --- a/.github/workflows/self-test.yml +++ b/.github/workflows/self-test.yml @@ -13,6 +13,7 @@ on: workflow_dispatch: env: + CONFIGURE_PYTHON_VERSIONS: "[3.9]" PROJECT_NAME: "ansible-workbench" USERNAME: "niall-byrne" TEMPLATED_NAME: "flower-generator" @@ -20,13 +21,26 @@ env: jobs: + _create_python_versions: + + runs-on: ubuntu-latest + outputs: + python-versions: ${{ steps.create_matrix.outputs.python-versions }} + + steps: + - name: Create Python Versions -- Set Configured Python Versions as Output + id: create_matrix + run: | + echo "python-versions=${CONFIGURE_PYTHON_VERSIONS}" >> $GITHUB_OUTPUT + documentation_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Documentation Test -- Checkout Repository @@ -74,12 +88,13 @@ jobs: ./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: documentation checks failed!" molecule_lint_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Molecule Lint -- Checkout Repository @@ -115,13 +130,13 @@ jobs: ./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: molecule linting checks failed!" push_repository_test: - needs: [documentation_test, molecule_lint_test, security_test, shellcheck_test, workflow_lint_test] + needs: [_create_python_versions, documentation_test, molecule_lint_test, security_test, shellcheck_test, workflow_lint_test] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Push Test -- Checkout Repository @@ -241,12 +256,13 @@ jobs: ./{{cookiecutter.project_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: automated release creation has failed!" security_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Security Test -- Checkout Repository @@ -288,12 +304,13 @@ jobs: ./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: security checks failed!" shellcheck_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Shellcheck -- Checkout Repository @@ -385,12 +402,13 @@ jobs: ./template/{{cookiecutter.project_slug}}/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: error reporting job status!" workflow_lint_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Workflow Lint -- Checkout Repository diff --git a/README.md b/README.md index 8fd2e889..8a709aa5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Ansible Role Development Environment. This template generates a development environment for Ansible Roles with a functional CI/CD template for both Travis CI and Github. ## Requirements -You'll need [Python](https://www.python.org/) 3.8 or later to use this template. +You'll need [Python](https://www.python.org/) 3.9 or later to use this template. ## Quick Start Guide diff --git a/cookiecutter.json b/cookiecutter.json index 67b73710..40af60a7 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -8,6 +8,7 @@ "author": "Niall Byrne", "company": "Shared Vision Solutions", "email": "niall@niallbyrne.ca", + "_GITHUB_CI_PYTHON_VERSIONS": ["3.9"], "_GITHUB_ACTION_MARKDOWN_LINK_CHECK": "gaurav-nelson/github-action-markdown-link-check@1.0.13", "_GITHUB_GITLEAKS_ACTION": "zricethezav/gitleaks-action@v1.6.0", "_GITHUB_PUSH_ACTION": "ad-m/github-push-action@v0.6.0" diff --git a/{{cookiecutter.project_slug}}/.github/workflows/push.yml b/{{cookiecutter.project_slug}}/.github/workflows/push.yml index 832fa5be..5e6592ec 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/push.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/push.yml @@ -16,6 +16,18 @@ env: {% raw %} jobs: + _create_python_versions: + + runs-on: ubuntu-latest + outputs: + python-versions: ${{ steps.create_matrix.outputs.python-versions }} + + steps: + - name: Create Python Versions -- Set Configured Python Versions as Output + id: create_matrix + run: | + echo 'python-versions={% endraw %}{{ cookiecutter._GITHUB_CI_PYTHON_VERSIONS | tojson }}{% raw %}' >> $GITHUB_OUTPUT + create_release: needs: [molecule_test, molecule_lint, documentation_test, security_test, start_notification] @@ -96,12 +108,13 @@ jobs: ./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: documentation test has failed!" molecule_lint: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: @@ -139,12 +152,13 @@ jobs: ./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: molecule linting has failed!" molecule_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Molecule Test -- Checkout Repository @@ -181,12 +195,13 @@ jobs: ./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: molecule test has failed!" security_test: + needs: [_create_python_versions] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: [3.8] + python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} steps: - name: Security Test -- Checkout Repository diff --git a/{{cookiecutter.project_slug}}/.github/workflows/release.yml b/{{cookiecutter.project_slug}}/.github/workflows/release.yml index 49fe0037..a1e968e1 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/release.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/release.yml @@ -17,17 +17,15 @@ on: env: PROJECT_NAME: "{{ cookiecutter.project_slug }}" + PYTHON_VERSIONS: '{{ cookiecutter._GITHUB_CI_PYTHON_VERSIONS | tojson }}' USERNAME: "{{ cookiecutter.github_handle }}" {% raw %} jobs: + publish_to_galaxy: runs-on: ubuntu-latest - strategy: - max-parallel: 4 - matrix: - python-version: [3.8] steps: @@ -44,10 +42,10 @@ jobs: with: fetch-depth: 0 - - name: Publish to Galaxy -- Set up Python ${{ matrix.python-version }} + - name: Publish to Galaxy -- Set up Python ${{ toJSON(env.PYTHON_VERSIONS)[0] }} uses: actions/setup-python@v1 with: - python-version: ${{ matrix.python-version }} + python-version: ${{ toJSON(env.PYTHON_VERSIONS)[0] }} - name: Publish to Galaxy -- Setup Environment run: | diff --git a/{{cookiecutter.project_slug}}/pyproject.toml b/{{cookiecutter.project_slug}}/pyproject.toml index 61bd2727..48d3cd74 100644 --- a/{{cookiecutter.project_slug}}/pyproject.toml +++ b/{{cookiecutter.project_slug}}/pyproject.toml @@ -5,7 +5,7 @@ description = "{{cookiecutter.description}}" authors = ["{{cookiecutter.author}} <{{cookiecutter.email}}>"] [tool.poetry.dependencies] -python = ">=3.8.0,<4.0" +python = ">={{ cookiecutter._GITHUB_CI_PYTHON_VERSIONS | first }}.0,<4.0" [tool.poetry.dev-dependencies] ansible = "^5.2.0"