Skip to content
This repository has been archived by the owner on Nov 7, 2023. It is now read-only.

Commit

Permalink
ci(GITHUB): parameterize test platform
Browse files Browse the repository at this point in the history
  • Loading branch information
niall-byrne committed Mar 10, 2023
1 parent 2a73c3c commit 6420a3e
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 12 deletions.
5 changes: 3 additions & 2 deletions cookiecutter.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
"email": "[email protected]",
"_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/[email protected]",
"_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"]
}
28 changes: 18 additions & 10 deletions {{cookiecutter.project_slug}}/.github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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<<EOF"
cat .cookiecutter/cookiecutter.json
echo "EOF"
} >> $GITHUB_OUTPUT
_start_notification:

Expand Down Expand Up @@ -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:

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 6420a3e

Please sign in to comment.