Skip to content

Commit

Permalink
feat: allow setting language versions in all workflows
Browse files Browse the repository at this point in the history
fix: remove pre-commit action from terraform-lint as the separate workflow should be used
fix: rename final workflow from .yml to .yaml
feat: move all shared workflows to their own directory outside `.github`
  • Loading branch information
coreone committed Dec 7, 2023
1 parent a593f8c commit 85ea1b4
Show file tree
Hide file tree
Showing 14 changed files with 56 additions and 28 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
- name: Checkout repo
uses: actions/checkout@v4
- name: Lint Markdown files
uses: DavidAnson/markdownlint-cli2-action@v14
uses: 'DavidAnson/markdownlint-cli2-action@v14'
with:
config: ${{ inputs.config_file }}
fix: ${{ inputs.fix }}
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
description: The version of Puppet to use in PDK
required: false
type: string
ruby_version:
description: The version of Ruby to use for the run.
default: '3.2'
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
Expand All @@ -37,18 +42,18 @@ jobs:
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
- name: "Set up Ruby ${{ inputs.ruby_version }}"
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ inputs.puppet_version }}"
with:
bundler-cache: true
ruby-version: '3.2'
ruby-version: "${{ inputs.ruby_version }}"
rubygems: 'latest'
- name: 'Module build'
run: 'bundle exec pdk build --force'
- name: 'Test module install'
run: 'bundle exec puppet module install pkg/${{ inputs.puppet_package_name }}-*.tar.gz'
run: "bundle exec puppet module install pkg/${{ inputs.puppet_package_name }}-*.tar.gz"
timeout-minutes: ${{ inputs.timeout_minutes }}
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
description: The version of Puppet to use in PDK
required: false
type: string
ruby_version:
description: The version of Ruby to use for the run.
default: '3.2'
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
Expand All @@ -35,15 +40,15 @@ jobs:
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
- name: "Set up Ruby ${{ inputs.ruby_version }}"
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ inputs.puppet_version }}"
with:
bundler-cache: true
ruby-version: '3.2'
ruby-version: "${{ inputs.ruby_version }}"
rubygems: 'latest'
- name: 'Module build'
run: 'bundle exec pdk build --force'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
description: The version of Puppet to use in PDK
required: false
type: string
ruby_version:
description: The version of Ruby to use for the run.
default: '3.2'
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
Expand All @@ -32,15 +37,15 @@ jobs:
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
- name: "Set up Ruby ${{ inputs.ruby_version }}"
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ inputs.puppet_version }}"
with:
bundler-cache: true
ruby-version: '3.2'
ruby-version: "${{ inputs.ruby_version }}"
rubygems: 'latest'
- name: 'Run static analysis'
run: bundle exec pdk validate --puppet-version=${{ inputs.puppet_version }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
steps:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Set up Ruby'
- name: "Set up Ruby ${{ matrix.ruby }}"
uses: 'ruby/[email protected]'
env:
BUNDLE_SILENCE_ROOT_WARNING: '1'
BUNDLE_WITH: 'development'
PUPPET_GEM_VERSION: "~> ${{ matrix.puppet }}"
with:
bundler-cache: true
ruby-version: ${{ matrix.ruby }}
ruby-version: "${{ matrix.ruby }}"
rubygems: 'latest'
- name: 'Run unit tests'
run: 'bundle exec pdk test unit --puppet-version=${{ matrix.puppet }} -v'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ name: pypi_deploy
description: The runner group on which jobs will run.
required: false
type: string
python_version:
description: The version of Python to use for the run.
default: '3.11'
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
Expand Down Expand Up @@ -43,11 +48,11 @@ jobs:
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.11
- name: "Set up Python ${{ inputs.python_version }}"
uses: actions/setup-python@v4
with:
cache: poetry
python-version: '3.11'
python-version: "${{ inputs.python_version }}"
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ name: python-linting
description: The runner group on which jobs will run.
required: false
type: string
python_version:
description: The version of Python to use for the run.
default: '3.11'
required: false
type: string
ruff_version:
default: '0.1.0'
description: The version of ruff to run.
Expand Down Expand Up @@ -54,11 +59,11 @@ jobs:
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.11
- name: "Set up Python ${{ inputs.python_version }}"
uses: actions/setup-python@v4
with:
cache: poetry
python-version: '3.11'
python-version: "${{ inputs.python_version }}"
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
Expand All @@ -72,5 +77,5 @@ jobs:
if: ${{ inputs.use_ruff }}
uses: chartboost/ruff-action@v1
with:
version: ${{ inputs.ruff_version }}
version: "${{ inputs.ruff_version }}"
timeout-minutes: ${{ inputs.timeout_minutes }}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@ name: pypi_test_deploy
description: The runner group on which jobs will run.
required: false
type: string
python_version:
description: The version of Python to use for the run.
default: '3.11'
required: false
type: string
timeout_minutes:
description: The maximum time (in minutes) for a job to run.
default: 5
Expand Down Expand Up @@ -43,11 +48,11 @@ jobs:
uses: actions/checkout@v4
- name: Install poetry
run: pipx install poetry
- name: Set up Python 3.11
- name: "Set up Python ${{ inputs.python_version }}"
uses: actions/setup-python@v4
with:
cache: poetry
python-version: '3.11'
python-version: "${{ inputs.python_version }}"
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Install dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
uses: actions/setup-python@v4
with:
cache: poetry
python-version: ${{ matrix.python-version }}
python-version: "${{ matrix.python-version }}"
- name: Configure Poetry
run: poetry config virtualenvs.in-project true
- name: Check pyproject.toml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@ jobs:
- name: 'Checkout repo'
uses: 'actions/checkout@v4'
- name: 'Setup TFLint'
uses: terraform-linters/setup-tflint@v4
- name: 'Run pre-commit'
uses: 'pre-commit/[email protected]'
uses: 'terraform-linters/setup-tflint@v4'
- name: 'Run TFLint'
run: tflint -c ${{ inputs.tflint_config_path }}
timeout-minutes: ${{ inputs.timeout_minutes }}
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
github_token: ${{ secrets.wf_github_token }}
- name: Run Trivy vulnerability scanner in IaC mode
if: ${{ inputs.run_trivy == true }}
uses: aquasecurity/[email protected]
uses: 'aquasecurity/[email protected]'
with:
scan-type: 'config'
hide-progress: false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,22 +73,22 @@ jobs:
- name: Check terragrunt HCL
uses: gruntwork-io/terragrunt-action@v2
with:
tf_version: ${{ inputs.terraform_version }}
tg_version: ${{ inputs.terragrunt_version }}
tf_version: "${{ inputs.terraform_version }}"
tg_version: "${{ inputs.terragrunt_version }}"
tg_dir: ${{ inputs.working_directory }}
tg_command: hclfmt --terragrunt-check --terragrunt-diff
- name: Initialize Terraform
uses: gruntwork-io/terragrunt-action@v2
with:
tf_version: ${{ inputs.terraform_version }}
tg_version: ${{ inputs.terragrunt_version }}
tf_version: "${{ inputs.terraform_version }}"
tg_version: "${{ inputs.terragrunt_version }}"
tg_dir: "${{ inputs.working_directory }}/${{ inputs.terragrunt_directory }}"
tg_command: init
- name: Validate Terraform
uses: gruntwork-io/terragrunt-action@v2
with:
tf_version: ${{ inputs.terraform_version }}
tg_version: ${{ inputs.terragrunt_version }}
tf_version: "${{ inputs.terraform_version }}"
tg_version: "${{ inputs.terragrunt_version }}"
tg_dir: "${{ inputs.working_directory }}/${{ inputs.terragrunt_directory }}"
tg_command: validate
timeout-minutes: ${{ inputs.timeout_minutes }}

0 comments on commit 85ea1b4

Please sign in to comment.