From 6420a3ef45b927f9d158d2b9af6621b0f484fce2 Mon Sep 17 00:00:00 2001 From: Niall Byrne <9848926+niall-byrne@users.noreply.github.com> Date: Tue, 28 Feb 2023 09:40:50 -0500 Subject: [PATCH] ci(GITHUB): parameterize test platform --- cookiecutter.json | 5 ++-- .../.github/workflows/push.yml | 28 ++++++++++++------- 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/cookiecutter.json b/cookiecutter.json index dca75b13..6619d073 100644 --- a/cookiecutter.json +++ b/cookiecutter.json @@ -11,12 +11,13 @@ "email": "niall@niallbyrne.ca", "_BRANCH_NAME_BASE": "master", "_BRANCH_NAME_DEVELOPMENT": "dev", - "_GITHUB_CI_PYTHON_VERSIONS": ["3.9"], "_GITHUB_ACTION_CACHE": "actions/cache@v3", "_GITHUB_ACTION_CHECKOUT": "actions/checkout@v3", "_GITHUB_ACTION_MARKDOWN_LINK_CHECK": "gaurav-nelson/github-action-markdown-link-check@v1", "_GITHUB_ACTION_PYTHON": "actions/setup-python@v4", "_GITHUB_ACTION_SCRIPT": "actions/github-script@v6", "_GITHUB_ACTION_TRUFFLEHOG": "trufflesecurity/trufflehog@v3.28.0", - "_GITHUB_ACTION_YAMLLINT": "ibiqlik/action-yamllint@v3" + "_GITHUB_ACTION_YAMLLINT": "ibiqlik/action-yamllint@v3", + "_GITHUB_CI_PYTHON_VERSIONS": ["3.9"], + "_GITHUB_CI_MOLECULE_TEST_PLATFORMS": ["ubuntu-latest"] } diff --git a/{{cookiecutter.project_slug}}/.github/workflows/push.yml b/{{cookiecutter.project_slug}}/.github/workflows/push.yml index 9e33eeee..8217cbb0 100644 --- a/{{cookiecutter.project_slug}}/.github/workflows/push.yml +++ b/{{cookiecutter.project_slug}}/.github/workflows/push.yml @@ -16,17 +16,24 @@ env: {% raw %} jobs: - _create_python_versions: + _create_configuration: runs-on: ubuntu-latest outputs: - python-versions: ${{ steps.create_matrix.outputs.python-versions }} + configuration: ${{ steps.read_configuration.outputs.configuration }} steps: - - name: Create Python Versions -- Set Configured Python Versions as Output - id: create_matrix + - name: Create Configuration -- Checkout Repository + uses: actions/checkout@v3 + + - name: Create Configuration -- Set Configuration as Output + id: read_configuration run: | - echo 'python-versions={% endraw %}{{ cookiecutter._GITHUB_CI_PYTHON_VERSIONS | tojson }}{% raw %}' >> $GITHUB_OUTPUT + { + echo "configuration<> $GITHUB_OUTPUT _start_notification: @@ -232,13 +239,13 @@ jobs: ./.github/scripts/notifications.sh "${NOTIFICATION}" ":x: documentation test has failed!" molecule_lint_test: - needs: [_create_python_versions] + needs: [_create_configuration] runs-on: ubuntu-latest strategy: max-parallel: 4 matrix: - python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} + python-version: ${{ fromJson(needs._create_configuration.outputs.configuration)._GITHUB_CI_PYTHON_VERSIONS }} steps: @@ -302,13 +309,14 @@ jobs: ./role/.github/scripts/notifications.sh "${NOTIFICATION}" ":x: molecule linting has failed!" molecule_test: - needs: [_create_python_versions] + needs: [_create_configuration] - runs-on: ubuntu-latest + runs-on: ${{ matrix.platform }} strategy: max-parallel: 4 matrix: - python-version: ${{ fromJson(needs._create_python_versions.outputs.python-versions) }} + platform: ${{ fromJson(needs._create_configuration.outputs.configuration)._GITHUB_CI_MOLECULE_TEST_PLATFORMS }} + python-version: ${{ fromJson(needs._create_configuration.outputs.configuration)._GITHUB_CI_PYTHON_VERSIONS }} scenario: ["docker1", "hostmachine1"] steps: