Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions .github/workflows/ansible.ansible-lint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Ansible - ansible-lint


on:
workflow_call:
inputs:
ansible_lint_version:
type: string
required: false
default: latest
description: "(Optional) The version of `ansible-lint` to install. Defaults to `latest`. Not implemented yet."
python_version:
type: string
required: false
default: latest
description: "(Optional) The Python version (installed via mise) used to run `ansible-lint`. Defaults to `latest`."
working_directory:
type: string
required: false
default: ./
description: "(Optional) The directory to run `ansible-lint` from (where `.ansible-lint` / `ansible.cfg` live). Defaults to `./`."
galaxy_requirements_file:
type: string
required: false
default: ""
description: "(Optional) Path to a Galaxy `requirements` file. When set, its collections are installed and made resolvable to `ansible-lint`."

secrets:
token:
required: false
description: "(Optional) The GitHub API token to use when communicating with GitHub API."


jobs:
ansible-lint:
name: Lint Ansible content
runs-on: ubuntu-latest

env:
ANSIBLE_COLLECTIONS_PATH: ${{ github.workspace }}/.ansible/collections

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6

- name: Set up tools
id: setup-tools
uses: tedilabs/github-actions/.github/actions/mise.setup-tools@main
with:
mise_toml: |
[tools]
python = "${{ inputs.python_version }}"

- name: Install ansible-lint
id: install-ansible-lint
run: python -m pip install ansible-lint

- name: Install Galaxy collections
id: install-collections
if: ${{ inputs.galaxy_requirements_file != '' }}
run: |
ansible-galaxy collection install \
-r ${{ inputs.galaxy_requirements_file }} \
-p ${{ github.workspace }}/.ansible/collections

- name: Run ansible-lint
id: ansible-lint
working-directory: ${{ inputs.working_directory }}
run: ansible-lint --format github
45 changes: 45 additions & 0 deletions .github/workflows/packer.fmt.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Packer - Format


on:
workflow_call:
inputs:
packer_version:
type: string
required: false
default: latest
description: "(Optional) The version of `packer` to install. Defaults to `latest`."
packer_target_dir:
type: string
required: false
default: ./
description: "(Optional) A directory path to check formatting (recursively). Defaults to `./`."

secrets:
token:
required: false
description: "(Optional) The GitHub API token to use when communicating with GitHub API."


jobs:
fmt:
name: Check Packer formatting
runs-on: ubuntu-latest

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6

- name: Set up tools
id: setup-tools
uses: tedilabs/github-actions/.github/actions/mise.setup-tools@main
with:
mise_toml: |
[tools]
packer = "${{ inputs.packer_version }}"

- name: Check Format
id: fmt
run: |
packer fmt -check -diff -recursive ${{ inputs.packer_target_dir }}
56 changes: 56 additions & 0 deletions .github/workflows/packer.validate.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Packer - Validate


on:
workflow_call:
inputs:
packer_version:
type: string
required: false
default: latest
description: "(Optional) The version of `packer` to install. Defaults to `latest`."
packer_target_dir:
type: string
required: false
default: ./
description: "(Optional) The Packer template directory to initialize and validate. Defaults to `./`."
aws_region:
type: string
required: false
default: us-east-1
description: "(Optional) A region exported as `AWS_DEFAULT_REGION` so `packer validate` can resolve a region without credentials. Defaults to `us-east-1`."

secrets:
token:
required: false
description: "(Optional) The GitHub API token to use when communicating with GitHub API."


jobs:
validate:
name: Validate Packer template
runs-on: ubuntu-latest

env:
AWS_DEFAULT_REGION: ${{ inputs.aws_region }}

steps:
- name: Checkout
id: checkout
uses: actions/checkout@v6

- name: Set up tools
id: setup-tools
uses: tedilabs/github-actions/.github/actions/mise.setup-tools@main
with:
mise_toml: |
[tools]
packer = "${{ inputs.packer_version }}"

- name: Packer Init
id: init
run: packer init ${{ inputs.packer_target_dir }}

- name: Packer Validate
id: validate
run: packer validate ${{ inputs.packer_target_dir }}